Skip to content

Instantly share code, notes, and snippets.

@emsearcy
Last active December 1, 2017 17:29
Show Gist options
  • Select an option

  • Save emsearcy/40cdef0efa80d5e61116474f2442eff9 to your computer and use it in GitHub Desktop.

Select an option

Save emsearcy/40cdef0efa80d5e61116474f2442eff9 to your computer and use it in GitHub Desktop.
Makefile for Terraform with local build of patched DNS Made Easy provider
# Terraform Makefile
#
# Automates management of secrets from pass.
# pass variable for DNS Made Easy
#export TF_VAR_dme_skey := $(shell pass show services/dns/dme)
.PHONY: error init plan apply clean
error:
@echo "Valid targets: plan clean"
@exit 2
.terraform: terraform-provider-dme
terraform init
# Run "make plan" instead of "terraform plan" for TF_VAR pass support
plan: .terraform
terraform get --update
terraform plan -out terraform.tfplan
# This intentionally does NOT depend on terraform.tfplan because make and apply
# need to be separate make invocations. This target is just for convenience;
# running "terraform apply" directly is fine.
apply:
terraform apply terraform.tfplan
clean:
rm -vf terraform.tfplan
###
### DNS Made Easy Provider local patch/build
###
### Requires local Go toolchain and $GOPATH set up
### https://github.com/golang/go/wiki/SettingGOPATH
###
terraform-provider-dme: $(GOPATH)/bin/terraform-provider-dme
test -d "$(GOPATH)" # $$GOPATH set?
cp $(GOPATH)/bin/terraform-provider-dme terraform-provider-dme
$(GOPATH)/bin/terraform-provider-dme: $(GOPATH)/src/github.com/terraform-providers/terraform-provider-dme
test -d "$(GOPATH)" # $$GOPATH set?
cd $(GOPATH)/src/github.com/terraform-providers/terraform-provider-dme; make
$(GOPATH)/src/github.com/terraform-providers/terraform-provider-dme:
test -d "$(GOPATH)" # $$GOPATH set?
git clone -b tld-records https://github.com/emsearcy/terraform-provider-dme $(GOPATH)/src/github.com/terraform-providers/terraform-provider-dme
cd $(GOPATH)/src/github.com/terraform-providers/terraform-provider-dme; git reset --hard 513fb17 --
rm -Rf $(GOPATH)/src/github.com/terraform-providers/terraform-provider-dme/vendor/github.com/soniah/dnsmadeeasy
git clone -b fix_record_update https://github.com/samcrang/dnsmadeeasy $(GOPATH)/src/github.com/terraform-providers/terraform-provider-dme/vendor/github.com/soniah/dnsmadeeasy
cd $(GOPATH)/src/github.com/terraform-providers/terraform-provider-dme/vendor/github.com/soniah/dnsmadeeasy; git reset --hard 6e1609e --
# vim: ai noet ts=4 sw=4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment