From cd1739c901ef74a332ba1eff94004467c0731208 Mon Sep 17 00:00:00 2001 From: Piyush Jain <122745947+d3vb0ox@users.noreply.github.com> Date: Thu, 27 Mar 2025 07:10:24 +0530 Subject: [PATCH] chore: updates enable PR comments for terraform plan (#5073) --- .../workflows/terrafrom-plan-and-apply.yml | 30 +++++++++---------- infra/terraform/main.tf | 8 +++++ 2 files changed, 23 insertions(+), 15 deletions(-) diff --git a/.github/workflows/terrafrom-plan-and-apply.yml b/.github/workflows/terrafrom-plan-and-apply.yml index 49f2b99081..04897411fc 100644 --- a/.github/workflows/terrafrom-plan-and-apply.yml +++ b/.github/workflows/terrafrom-plan-and-apply.yml @@ -3,16 +3,17 @@ name: 'Terraform' on: workflow_dispatch: # TODO: enable it back when migration is completed. -# push: -# branches: -# - main -# pull_request: -# branches: -# - main + push: + branches: + - main + pull_request: + branches: + - main permissions: id-token: write contents: write + pull-requests: write jobs: terraform: @@ -58,18 +59,17 @@ jobs: run: terraform plan -out .planfile working-directory: infra/terraform -# - name: Post PR comment -# uses: borchero/terraform-plan-comment@3399d8dbae8b05185e815e02361ede2949cd99c4 # v2.4.0 -# if: always() && github.ref != 'refs/heads/main' && (steps.validate.outcome == 'success' || steps.validate.outcome == 'failure') -# with: -# token: ${{ github.token }} -# planfile: .planfile -# working-directory: "infra/terraform" -# skip-comment: true + - name: Post PR comment + uses: borchero/terraform-plan-comment@3399d8dbae8b05185e815e02361ede2949cd99c4 # v2.4.0 + if: always() && github.ref != 'refs/heads/main' && (steps.plan.outcome == 'success' || steps.plan.outcome == 'failure') + with: + token: ${{ github.token }} + planfile: .planfile + working-directory: "infra/terraform" - name: Terraform Apply id: apply -# if: github.ref == 'refs/heads/main' && github.event_name == 'push' + if: github.ref == 'refs/heads/main' && github.event_name == 'push' run: terraform apply .planfile working-directory: "infra/terraform" diff --git a/infra/terraform/main.tf b/infra/terraform/main.tf index 05bf6bcd1a..774cd66aa9 100644 --- a/infra/terraform/main.tf +++ b/infra/terraform/main.tf @@ -469,6 +469,14 @@ module "formbricks_s3_bucket" { enabled = true } policy = data.aws_iam_policy_document.replication_bucket_policy.json + cors_rule = [ + { + allowed_methods = ["POST"] + allowed_origins = ["https://*"] + allowed_headers = ["*"] + expose_headers = [] + } + ] } module "formbricks_app_iam_policy" {