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