diff --git a/.gitea/workflows/pull_request.yaml b/.gitea/workflows/pull_request.yaml index d4f26aa..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/infrastructure.yaml - with: - environment_name: test - secrets: inherit diff --git a/.gitea/workflows/terraform.yaml b/.gitea/workflows/terraform.yaml index d82fcb8..c8630e0 100644 --- a/.gitea/workflows/terraform.yaml +++ b/.gitea/workflows/terraform.yaml @@ -31,15 +31,14 @@ jobs: - name: Terraform init run: | - terraform -chdir=./infrastructure init -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/backend/prod.backend.tfvars b/infrastructure/backend/prod.backend.tfvars new file mode 100644 index 0000000..d9a86a6 --- /dev/null +++ b/infrastructure/backend/prod.backend.tfvars @@ -0,0 +1 @@ +container_name = "tfstate-flying-prod" \ No newline at end of file diff --git a/infrastructure/backend/test.backend.tfvars b/infrastructure/backend/test.backend.tfvars new file mode 100644 index 0000000..42299b4 --- /dev/null +++ b/infrastructure/backend/test.backend.tfvars @@ -0,0 +1 @@ +container_name = "tfstate-flying-test" \ No newline at end of file diff --git a/infrastructure/terraform.tf b/infrastructure/terraform.tf index 41559a5..eef9209 100644 --- a/infrastructure/terraform.tf +++ b/infrastructure/terraform.tf @@ -16,12 +16,9 @@ terraform { } } - backend "remote" { - hostname = "app.terraform.io" - organization = "noahspan" - - workspaces { - prefix = "noahspan-" - } + backend "azurerm" { + resource_group_name = "noahspan" + storage_account_name = "noahspanterraform" + key = "terraform.tfstate" } } \ No newline at end of file