Skip to content

Commit 2e8f430

Browse files
authored
Authenticate the Terraform workflows with OIDC (#188)
1 parent 2224804 commit 2e8f430

3 files changed

Lines changed: 23 additions & 6 deletions

File tree

‎.github/workflows/terraform-apply.yaml‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ jobs:
1515
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1616

1717
permissions:
18+
id-token: write
1819
contents: read
1920
pull-requests: write
2021

@@ -24,9 +25,9 @@ jobs:
2425
- name: Configure AWS Credentials
2526
uses: aws-actions/configure-aws-credentials@v4
2627
with:
27-
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
28-
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
29-
aws-region: us-west-2
28+
role-to-assume: arn:aws:iam::035866691871:role/devops-security-tf-apply
29+
role-session-name: devopssecuritytfapply
30+
aws-region: us-west-2
3031

3132
- name: Terraform Apply
3233
uses: dflook/terraform-apply@v1

‎.github/workflows/terraform-plan.yaml‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ jobs:
1515
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1616

1717
permissions:
18+
id-token: write
1819
contents: read
1920
pull-requests: write
2021

@@ -24,9 +25,9 @@ jobs:
2425
- name: Configure AWS Credentials
2526
uses: aws-actions/configure-aws-credentials@v4
2627
with:
27-
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
28-
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
29-
aws-region: us-west-2
28+
role-to-assume: arn:aws:iam::035866691871:role/devops-security-tf-plan
29+
role-session-name: devopssecuritytfplan
30+
aws-region: us-west-2
3031

3132
- name: Terraform Plan
3233
uses: dflook/terraform-plan@v1

‎terraform/aws-gha-oidc-providers.tf‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
// This file declares the OIDC roles used by hackforla/incubator CI. The two
2+
// roles used by THIS repo's CI -- devops-security-tf-plan and
3+
// devops-security-tf-apply -- are deliberately NOT here. They were created by
4+
// hand in account 035866691871 on 2026-09-05 and are tagged managed-by=exempt,
5+
// which is what keeps them out of the AWS/Terraform coverage report rather than
6+
// showing up as unmanaged.
7+
//
8+
// The reason is a bootstrap problem, not an oversight. The workflow that would
9+
// run the Terraform creating these roles is the same workflow that has to assume
10+
// them to authenticate, so they cannot exist before the first run that needs
11+
// them. Declaring them here would reintroduce that circularity. See
12+
// hackforla/devops-security#182.
13+
//
14+
// Do not "fix" their absence by adding them below.
15+
116
module "iam_oidc_gha_incubator" {
217
source = "./modules/aws-gha-oidc-providers"
318

0 commit comments

Comments
 (0)