Skip to content

Merge pull request #837 from ministryofjustice/dependabot/terraform/m… #66

Merge pull request #837 from ministryofjustice/dependabot/terraform/m…

Merge pull request #837 from ministryofjustice/dependabot/terraform/m… #66

name: terraform apply (management-account)
on:
push:
paths:
- 'management-account/terraform/**'
- 'modules/**'
- '.github/workflows/management-account-plan.yml'
- '.github/workflows/management-account-apply.yml'
branches:
- main
jobs:
apply:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
defaults:
run:
working-directory: ./management-account/terraform
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: aws-actions/configure-aws-credentials@010d0da01d0b5a38af31e9c3470dbfdabdecca3a # v4.0.1
with:
role-to-assume: arn:aws:iam::${{secrets.AWS_ROOT_ACCOUNT_ID}}:role/github-actions-apply
role-session-name: GitHubActions
aws-region: eu-west-2
- uses: hashicorp/setup-terraform@633666f66e0061ca3b725c73b2ec20cd13a8fdd1 # v2.0.3
with:
terraform_version: 1.5.2
- run: terraform fmt -check
continue-on-error: true
- run: terraform init
- run: terraform validate -no-color
- run: terraform plan -no-color
- run: terraform apply -auto-approve
if: github.event.ref == 'refs/heads/main'