Created
July 18, 2020 15:31
-
-
Save sylwit/b1668f355e5772f2c95a62f408f80689 to your computer and use it in GitHub Desktop.
Terraform with aw-vault template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
account := acc | |
VARS_ENV="variables/$(TF_WORKSPACE).tfvars" | |
VARS_SECRETS="variables/$(TF_WORKSPACE)-secrets.tfvars" | |
fmt: | |
terraform fmt | |
workspace: | |
aws-vault exec $(account) -- terraform workspace list | |
init: | |
aws-vault exec $(account) -- terraform init | |
plan: check-env | |
aws-vault exec $(account) -- \ | |
terraform plan \ | |
-var-file=$(VARS_ENV) \ | |
-var-file=$(VARS_SECRETS) | |
apply: check-env | |
aws-vault exec $(account) -- \ | |
terraform apply \ | |
-var-file=$(VARS_ENV) \ | |
-var-file=$(VARS_SECRETS) | |
check-env: | |
ifndef TF_WORKSPACE | |
$(error TF_WORKSPACE is undefined) | |
endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment