Skip to content

auto-terraform-apply-03-aws-github-actions-oidc #6305

auto-terraform-apply-03-aws-github-actions-oidc

auto-terraform-apply-03-aws-github-actions-oidc #6305

---
name: auto-terraform-apply-03-aws-github-actions-oidc
permissions:
id-token: write # for fetching the OIDC token
contents: read # for actions/checkout
pull-requests: write # For dflook comments on PR
on:
workflow_dispatch:
schedule:
- cron: "0 10 * * *"
jobs:
tf-apply:
runs-on: ubuntu-latest
name: 03-aws-github-actions-oidc - apply approved terraform plan
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
with:
ref: master
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@010d0da01d0b5a38af31e9c3470dbfdabdecca3a # v4
with:
role-to-assume: ${{ secrets.OIDC_ROLE_ARN }}
role-session-name: GithubActionsTerraform
aws-region: eu-west-1
- name: Terraform apply
uses: dflook/terraform-apply@61d32f33d4290ac22d21e1e546f9b44ccd776240 # v1
with:
path: examples/03-aws-github-actions-oidc
auto_approve: true
# TODO: maybe we can try to 'docker push' here to the ECR repo as an example that the OIDC works