Skip to content

Commit

Permalink
WIP loop over envs and create all (mostly TODOs)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ilkka Poutanen authored and majori committed Mar 7, 2023
1 parent a5381ee commit e24aad1
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit e24aad1

Please sign in to comment.