Skip to content

Commit 023f222

Browse files
Update terraform.yml
1 parent 91f1489 commit 023f222

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

.github/workflows/terraform.yml

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: Terraform CI/CD - LiveKit Infra
22

33
on:
4-
workflow_dispatch:
4+
workflow_dispatch: # allow manual trigger
55
pull_request:
66
paths:
77
- 'livekit/infra/**'
@@ -13,13 +13,12 @@ on:
1313

1414
permissions:
1515
contents: 'read' # needed by checkout
16-
id-token: 'write' # only if you use OIDC (not required here)
16+
id-token: 'write' # only if you use OIDC (optional here)
1717

1818
jobs:
1919
terraform-plan:
20-
name: Terraform Plan (PRs & push)
20+
name: Terraform Plan
2121
runs-on: ubuntu-latest
22-
if: github.event_name == 'pull_request' || github.event_name == 'push'
2322
steps:
2423
- name: Checkout repo
2524
uses: actions/checkout@v4
@@ -41,7 +40,6 @@ jobs:
4140
- name: Create terraform.tfvars from secrets
4241
working-directory: livekit/infra
4342
run: |
44-
# Create terraform.tfvars dynamically (values come from repo secrets)
4543
cat > terraform.tfvars <<'TFVARS'
4644
aws_region = "${{ secrets.AWS_REGION }}"
4745
tfstate_s3_bucket = "${{ secrets.TFSTATE_S3_BUCKET }}"
@@ -71,8 +69,8 @@ jobs:
7169

7270
- name: Terraform Plan
7371
working-directory: livekit/infra
74-
run: |
75-
terraform plan -input=false -var-file="terraform.tfvars" -out=tfplan
72+
run: terraform plan -input=false -var-file="terraform.tfvars" -out=tfplan
73+
7674
- name: Upload plan artifact (optional)
7775
if: github.event_name == 'pull_request'
7876
uses: actions/upload-artifact@v4
@@ -81,10 +79,10 @@ jobs:
8179
path: livekit/infra/tfplan
8280

8381
terraform-apply:
84-
name: Terraform Apply (main)
82+
name: Terraform Apply
8583
runs-on: ubuntu-latest
8684
needs: terraform-plan
87-
if: github.ref == 'refs/heads/main'
85+
if: github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch'
8886
steps:
8987
- name: Checkout repo
9088
uses: actions/checkout@v4

0 commit comments

Comments
 (0)