Skip to content

Commit

Permalink
fix(terraform): update tfstate storage account name, fix other recrea…
Browse files Browse the repository at this point in the history
…te errors

Add a '2' suffix after storage account name,
due to "A storage account already exists with this name" error when trying to
recreate infra in new tenant.

Fix a couple of other deploy errors trying to recreate infra in new tenant.
  • Loading branch information
Christian Fosli committed Jan 26, 2024
1 parent c55a8a9 commit 27bccc4
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/terraform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ jobs:
terraform -v
terraform init --input=false \
-backend-config="resource_group_name=rg-snake-${{ env.TF_VAR_ENVIRONMENT }}" \
-backend-config="storage_account_name=stsnake${{ env.TF_VAR_ENVIRONMENT }}" \
-backend-config="storage_account_name=stsnake${{ env.TF_VAR_ENVIRONMENT }}2" \
-backend-config="key=${{ env.TF_VAR_ENVIRONMENT }}.terraform.tfstate"
- name: Validate
Expand Down
3 changes: 2 additions & 1 deletion terraform/api.tf
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ resource "azurerm_container_app" "highscoreApi" {
target_port = 3000

traffic_weight {
percentage = 100
percentage = 100
latest_revision = true
}

# traffic weight will be adjusted during CI/CD as new revisions are published
Expand Down
2 changes: 2 additions & 0 deletions terraform/cleanup-job.tf
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ resource "null_resource" "createCleanupJob" {
--env-vars "DB_CONNSTR=secretref:db-connstr"
EOF

interpreter = ["/bin/bash"]

# nonsensitive used on sensitive value to prevent all stdout from being hidden
}
}
2 changes: 1 addition & 1 deletion terraform/data.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ data "azurerm_resource_group" "rg" {
}

data "azurerm_storage_account" "st" {
name = "stsnake${var.ENVIRONMENT}"
name = "stsnake${var.ENVIRONMENT}2"
resource_group_name = data.azurerm_resource_group.rg.name
}

Expand Down
2 changes: 1 addition & 1 deletion terraform/main.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
terraform {
backend "azurerm" {
resource_group_name = "rg-snake-staging"
storage_account_name = "stsnakestaging"
storage_account_name = "stsnakestaging2"
container_name = "tfstate"
key = "staging.terraform.tfstate"
use_oidc = true
Expand Down

0 comments on commit 27bccc4

Please sign in to comment.