From e24aad18c47ea01550bac019b00bc2a94b04320c Mon Sep 17 00:00:00 2001 From: Ilkka Poutanen Date: Fri, 24 Feb 2023 17:13:52 +0200 Subject: [PATCH] WIP loop over envs and create all (mostly TODOs) --- .../terraform-bootstrap/templates/terraform/Taskfile.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/examples/terraform-bootstrap/templates/terraform/Taskfile.yml b/examples/terraform-bootstrap/templates/terraform/Taskfile.yml index c301b8db..e43649fa 100644 --- a/examples/terraform-bootstrap/templates/terraform/Taskfile.yml +++ b/examples/terraform-bootstrap/templates/terraform/Taskfile.yml @@ -2,10 +2,14 @@ version: "3" tasks: tf-state-init: - cmds: + cmds: # TODO: loop over this to create all envs (ask user what envs to create) - terraform init - terraform workspace new {{ `{{.CLI_ARGS}}` }} - terraform apply -target azurerm_storage_account.tfstate -auto-approve -input=false - echo "access_key=\"$(az storage account keys list --resource-group {{ .Variables.RESOURCE_GROUP_NAME }} --account-name $(terraform output -raw tfstate_storage_account_name) --query '[0].value' --output tsv)\"" > terraform-backend.config - terraform apply -target local_file.backend_config -auto-approve -input=false - terraform init -migrate-state -force-copy -backend-config="key=tfstate_" -backend-config="terraform-backend.config" + +# TODO: task to delete state resources for a particular env +# TODO: validate resource group name when prompting +# TODO: clear out local tf stuff between different envs (so it doesn't migrate dev state to qa etc) \ No newline at end of file