From 81c589001bf223da2ecd8f573d6584bf91c2a549 Mon Sep 17 00:00:00 2001 From: noahspannbauer Date: Mon, 13 Jul 2026 11:31:00 -0500 Subject: [PATCH 1/4] switching terraform backend to azure storage --- infrastructure/terraform.tf | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/infrastructure/terraform.tf b/infrastructure/terraform.tf index 41559a5..37e4145 100644 --- a/infrastructure/terraform.tf +++ b/infrastructure/terraform.tf @@ -16,12 +16,10 @@ terraform { } } - backend "remote" { - hostname = "app.terraform.io" - organization = "noahspan" - - workspaces { - prefix = "noahspan-" - } + backend "azurerm" { + resource_group_name = "noahspan" + storage_account_name = "noahspanterraform" + container_name = "tfstate-flying-test" + key = "terraform.tfstate" } } \ No newline at end of file -- 2.49.1 From 875b8a0d903a3740909e2231e2926d20c0bb1d55 Mon Sep 17 00:00:00 2001 From: noahspannbauer Date: Mon, 13 Jul 2026 11:46:41 -0500 Subject: [PATCH 2/4] switching terraform backend to azure storage --- .gitea/workflows/pull_request.yaml | 2 +- .gitea/workflows/terraform.yaml | 4 ++-- infrastructure/prod.backend.tfvars | 1 + infrastructure/test.backend.tfvars | 1 + 4 files changed, 5 insertions(+), 3 deletions(-) create mode 100644 infrastructure/prod.backend.tfvars create mode 100644 infrastructure/test.backend.tfvars diff --git a/.gitea/workflows/pull_request.yaml b/.gitea/workflows/pull_request.yaml index d4f26aa..884819c 100644 --- a/.gitea/workflows/pull_request.yaml +++ b/.gitea/workflows/pull_request.yaml @@ -23,7 +23,7 @@ jobs: name: terraform-plan needs: - changes - uses: ./.gitea/workflows/infrastructure.yaml + uses: ./.gitea/workflows/terraform.yaml with: environment_name: test secrets: inherit diff --git a/.gitea/workflows/terraform.yaml b/.gitea/workflows/terraform.yaml index d82fcb8..6eb7ef3 100644 --- a/.gitea/workflows/terraform.yaml +++ b/.gitea/workflows/terraform.yaml @@ -1,6 +1,6 @@ name: 'Terraform' on: - workflow_dispatch: + workflow_call: inputs: environment_name: type: string @@ -31,7 +31,7 @@ jobs: - name: Terraform init run: | - terraform -chdir=./infrastructure init -input=false + terraform -chdir=./infrastructure init -reconfigure -backend-config="${{ inputs.environment_name }}.backend.tfvars" -input=false - name: Terraform plan if: ${{ github.event_name == 'pull_request' }} diff --git a/infrastructure/prod.backend.tfvars b/infrastructure/prod.backend.tfvars new file mode 100644 index 0000000..d9a86a6 --- /dev/null +++ b/infrastructure/prod.backend.tfvars @@ -0,0 +1 @@ +container_name = "tfstate-flying-prod" \ No newline at end of file diff --git a/infrastructure/test.backend.tfvars b/infrastructure/test.backend.tfvars new file mode 100644 index 0000000..42299b4 --- /dev/null +++ b/infrastructure/test.backend.tfvars @@ -0,0 +1 @@ +container_name = "tfstate-flying-test" \ No newline at end of file -- 2.49.1 From b8ec5be269751ea6a16c5a1f2221306c77fa7bf8 Mon Sep 17 00:00:00 2001 From: noahspannbauer Date: Mon, 13 Jul 2026 11:47:30 -0500 Subject: [PATCH 3/4] switching terraform backend to azure storage --- infrastructure/terraform.tf | 1 - 1 file changed, 1 deletion(-) diff --git a/infrastructure/terraform.tf b/infrastructure/terraform.tf index 37e4145..eef9209 100644 --- a/infrastructure/terraform.tf +++ b/infrastructure/terraform.tf @@ -19,7 +19,6 @@ terraform { backend "azurerm" { resource_group_name = "noahspan" storage_account_name = "noahspanterraform" - container_name = "tfstate-flying-test" key = "terraform.tfstate" } } \ No newline at end of file -- 2.49.1 From a54105e8e5b375b95e63a294d5c64fe8136da6f5 Mon Sep 17 00:00:00 2001 From: noahspannbauer Date: Mon, 13 Jul 2026 11:50:31 -0500 Subject: [PATCH 4/4] switching terraform backend to azure storage --- .gitea/workflows/pull_request.yaml | 10 ---------- .gitea/workflows/terraform.yaml | 13 ++++++------- infrastructure/{ => backend}/prod.backend.tfvars | 0 infrastructure/{ => backend}/test.backend.tfvars | 0 4 files changed, 6 insertions(+), 17 deletions(-) rename infrastructure/{ => backend}/prod.backend.tfvars (100%) rename infrastructure/{ => backend}/test.backend.tfvars (100%) diff --git a/.gitea/workflows/pull_request.yaml b/.gitea/workflows/pull_request.yaml index 884819c..2bed9a6 100644 --- a/.gitea/workflows/pull_request.yaml +++ b/.gitea/workflows/pull_request.yaml @@ -17,13 +17,3 @@ jobs: environment_name: test version_number: ${{ github.run_id }} secrets: inherit - - terraform: - if: ${{ needs.changes.outputs.infrastructure == 'true' }} - name: terraform-plan - needs: - - changes - uses: ./.gitea/workflows/terraform.yaml - with: - environment_name: test - secrets: inherit diff --git a/.gitea/workflows/terraform.yaml b/.gitea/workflows/terraform.yaml index 6eb7ef3..c8630e0 100644 --- a/.gitea/workflows/terraform.yaml +++ b/.gitea/workflows/terraform.yaml @@ -1,6 +1,6 @@ name: 'Terraform' on: - workflow_call: + workflow_dispatch: inputs: environment_name: type: string @@ -31,15 +31,14 @@ jobs: - name: Terraform init run: | - terraform -chdir=./infrastructure init -reconfigure -backend-config="${{ inputs.environment_name }}.backend.tfvars" -input=false + terraform -chdir=./infrastructure init -reconfigure -backend-config="./backend/${{ inputs.environment_name }}.backend.tfvars" -input=false - name: Terraform plan - if: ${{ github.event_name == 'pull_request' }} run: | terraform -chdir=./infrastructure plan -no-color -input=false - - name: Terraform apply - if: ${{ github.event_name != 'pull_request' }} - run: | - terraform -chdir=./infrastructure apply -no-color -input=false + # - name: Terraform apply + # if: ${{ github.event_name != 'pull_request' }} + # run: | + # terraform -chdir=./infrastructure apply -no-color -input=false \ No newline at end of file diff --git a/infrastructure/prod.backend.tfvars b/infrastructure/backend/prod.backend.tfvars similarity index 100% rename from infrastructure/prod.backend.tfvars rename to infrastructure/backend/prod.backend.tfvars diff --git a/infrastructure/test.backend.tfvars b/infrastructure/backend/test.backend.tfvars similarity index 100% rename from infrastructure/test.backend.tfvars rename to infrastructure/backend/test.backend.tfvars -- 2.49.1