add plan-iac push trigger #14
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: plan-iac | |
on: | |
push: | |
workflow_call: | |
workflow_run: | |
workflows: [validate-iac] | |
types: | |
- completed | |
env: | |
tf_version: '1.6.2' | |
tg_version: '0.55.15' | |
environment: 'stage' | |
AWS_REGION: us-east-1 | |
permissions: | |
id-token: write | |
contents: read | |
jobs: | |
plan-iac: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
role-to-assume: ${{ secrets.IAM_ROLE}} | |
role-session-name: GitHub_to_AWS_via_FederatedOIDC | |
aws-region: ${{ env.AWS_REGION }} | |
- name: install opentofu | |
uses: opentofu/setup-opentofu@v1 | |
with: | |
tofu_version: ${{ env.tf_version }} | |
tofu_wrapper: false | |
- name: install terragrunt | |
run: | | |
sudo wget -q -O /bin/terragrunt "https://github.com/gruntwork-io/terragrunt/releases/download/v${{ env.tg_version }}/terragrunt_linux_amd64" | |
sudo chmod +x /bin/terragrunt | |
terragrunt -v | |
- name: plan vpc | |
working-directory: ./tofu/environments/${{ env.environment}}/network/vpc | |
run: | | |
terragrunt init | |
terragrunt plan -out tfplan-vpc | |
- name: plan backend | |
working-directory: ./tofu/environments/${{ env.environment}}/services/backend-infra | |
run: | | |
terragrunt init | |
terragrunt plan -out tfplan-vpc | |
- name: plan cache | |
working-directory: ./tofu/environments/${{ env.environment}}/data-store/cache | |
run: | | |
terragrunt init | |
terragrunt plan -out tfplan-vpc | |
- name: plan database | |
working-directory: ./tofu/environments/${{ env.environment}}/data-store/database | |
run: | | |
terragrunt init | |
terragrunt plan -out tfplan-vpc | |
- name: plan frontend | |
working-directory: ./tofu/environments/${{ env.environment}}/services/frontend | |
run: | | |
terragrunt init | |
terragrunt plan -out tfplan-vpc |