Skip to content

Instantly share code, notes, and snippets.

@michaelsauter
Created January 23, 2017 10:02
Show Gist options
  • Save michaelsauter/415d9d8c699ef59a85bf69bf05857b8f to your computer and use it in GitHub Desktop.
Save michaelsauter/415d9d8c699ef59a85bf69bf05857b8f to your computer and use it in GitHub Desktop.
Terraform Makefile
check:
@terraform version | grep "Terraform v0\.8\.[0-9]*" >/dev/null; case $$? in \
1) echo You need Terraform version 0.8.x!; exit 1;; \
esac
config: check
@terraform remote config -backend=s3 -backend-config="bucket=xxx-terraform-state" -backend-config="key=yyy/terraform.tfstate" -backend-config="region=eu-central-1"
plan: config
@terraform plan -out terraform.tfplan
plan-apply: plan
@echo ""
@read -p "Apply plan? (y/n) " choice; \
case "$$choice" in \
y|Y ) terraform apply terraform.tfplan;; \
* ) echo "Aborting.";; \
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment