Skip to content

Commit

Permalink
OPSEXP-2775 Support issue comment terraform apply (#744)
Browse files Browse the repository at this point in the history
  • Loading branch information
gionn authored Sep 23, 2024
1 parent eaee4a2 commit 3a9ddc1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/terraform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,13 @@ jobs:
unzip -q awscliv2.zip
fi
./aws/install
# https://github.com/dflook/terraform-github-actions/tree/main/terraform-apply#applying-a-plan-using-a-comment
PR_CHECKOUT_REF: refs/pull/${{ github.event.issue.number }}/merge
steps:
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
ref: ${{ github.event_name == 'issue_comment' && env.PR_CHECKOUT_REF || '' }}

- name: Assume AWS Role if AWS_ROLE_ARN var is set
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2
Expand Down Expand Up @@ -128,7 +132,7 @@ jobs:
- name: Terraform apply
uses: dflook/terraform-apply@7d435d4d115a11e5db1e710ac969f5382f0f6f9f # v1.44.0
if: github.event_name == 'push' || inputs.terraform_operation == 'apply'
if: github.event_name == 'push' || inputs.terraform_operation == 'apply' || (github.event_name == 'issue_comment' && contains(github.event.comment.body, 'terraform apply'))
with:
label: ${{ vars.RESOURCE_NAME }} ${{ inputs.terraform_root_path }}
path: ${{ inputs.terraform_root_path }}
Expand Down
3 changes: 3 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1609,6 +1609,9 @@ on:
branches:
- main
- develop
# optional - to trigger a terraform apply adding a pr comment with text 'terraform apply'
issue_comment:
types: [created]
workflow_dispatch:
inputs:
terraform_operation:
Expand Down
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v7.0.0
v7.1.0

0 comments on commit 3a9ddc1

Please sign in to comment.