Skip to content

chore(ci): change token permissions / update aws-credentials action #5861

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions .github/workflows/bootstrap_region.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
name: Region Bootstrap

# bootstraps new regions
#
# PURPOSE
Expand Down Expand Up @@ -27,7 +29,6 @@ on:
required: true
description: AWS region to bootstrap (i.e. eu-west-1)

name: Region Bootstrap
run-name: Region Bootstrap ${{ inputs.region }}

permissions:
Expand All @@ -38,13 +39,13 @@ jobs:
name: Install CDK
runs-on: ubuntu-latest
permissions:
contents: write
contents: read
id-token: write
environment: layer-${{ inputs.environment }}
steps:
- id: credentials
name: AWS Credentials
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2
with:
aws-region: ${{ inputs.region }}
role-to-assume: ${{ secrets.REGION_IAM_ROLE }}
Expand All @@ -69,7 +70,7 @@ jobs:
name: Copy Layers
runs-on: ubuntu-latest
permissions:
contents: write
contents: read
id-token: write
strategy:
matrix:
Expand All @@ -90,7 +91,7 @@ jobs:
steps:
- id: credentials
name: AWS Credentials
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2
with:
aws-region: us-east-1
role-to-assume: ${{ secrets.REGION_IAM_ROLE }}
Expand All @@ -106,4 +107,4 @@ jobs:
run: go install github.com/aws-powertools/actions/layer-balancer/cmd/balance@latest
- id: run-balance
name: Run Balance
run: balance -read-region us-east-1 -write-region ${{ inputs.region }} -write-role ${{ secrets.BALANCE_ROLE_ARN }} -layer-name ${{ matrix.layer }} -dry-run=false
run: balance -read-region us-east-1 -write-region ${{ inputs.region }} -write-role ${{ secrets.BALANCE_ROLE_ARN }} -layer-name ${{ matrix.layer }} -dry-run=false
6 changes: 5 additions & 1 deletion .github/workflows/layer_govcloud.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
name: Layer Deployment (GovCloud)

# GovCloud Layer Publish
# ---
# This workflow publishes a specific layer version in an AWS account based on the environment input.
Expand Down Expand Up @@ -32,9 +34,11 @@ on:
type: string
required: true

name: Layer Deployment (GovCloud)
run-name: Layer Deployment (GovCloud) - ${{ inputs.environment }}

permissions:
contents: read

jobs:
download:
runs-on: ubuntu-latest
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish_v3_layer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,8 @@ jobs:
needs: [update_v3_layer_arn_docs, prepare_docs_alias]
permissions:
# lower privilege propagated from parent workflow (release.yml)
contents: write
pages: write
#contents: write
#pages: write
pull-requests: none
id-token: write
secrets: inherit
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/reusable_deploy_v3_layer_stack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,12 @@ jobs:

- name: Install poetry
run: pipx install git+https://github.com/python-poetry/poetry@68b88e5390720a3dd84f02940ec5200bfce39ac6 # v1.5.0
- name: aws credentials
uses: aws-actions/configure-aws-credentials@5fd3084fc36e372ff1fff382a39b10d03659f355 # v2.2.0
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2
with:
aws-region: ${{ matrix.region }}
role-to-assume: ${{ secrets.AWS_LAYERS_ROLE_ARN }}
mask-aws-account-id: true
- name: Setup Node.js
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
with:
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/reusable_deploy_v3_sar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,12 @@ jobs:
artifact_name: ${{ inputs.source_code_artifact_name }}


- name: AWS credentials
uses: aws-actions/configure-aws-credentials@5fd3084fc36e372ff1fff382a39b10d03659f355 # v2.2.0
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2
with:
aws-region: ${{ env.AWS_REGION }}
role-to-assume: ${{ secrets.AWS_LAYERS_ROLE_ARN }}
mask-aws-account-id: true

# NOTE
# We connect to Layers account to log our intent to publish a SAR Layer
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/reusable_publish_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ jobs:
runs-on: ubuntu-latest
environment: "Docs"
permissions:
contents: write # push to gh-pages
contents: read # push to gh-pages
id-token: write # trade JWT token for AWS credentials in AWS Docs account
pages: write # uncomment if mike fails as we migrated to S3 hosting
#pages: write # uncomment if mike fails as we migrated to S3 hosting
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
Expand Down Expand Up @@ -79,10 +79,11 @@ jobs:
poetry run mike set-default --push latest

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@5fd3084fc36e372ff1fff382a39b10d03659f355
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2
with:
aws-region: us-east-1
role-to-assume: ${{ secrets.AWS_DOCS_ROLE_ARN }}
mask-aws-account-id: true
- name: Copy API Docs
run: |
cp -r api site/
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/run-e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,12 @@ jobs:
npm ci
npx cdk --version
- name: Install dependencies
run: dev-quality-code
run: make dev-quality-code
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@5fd3084fc36e372ff1fff382a39b10d03659f355 # v2.2.0
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2
with:
role-to-assume: ${{ secrets.AWS_TEST_ROLE_ARN }}
aws-region: ${{ env.AWS_DEFAULT_REGION }}
mask-aws-account-id: true
- name: Test
run: make e2e-test
10 changes: 5 additions & 5 deletions .github/workflows/update_ssm.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
name: SSM Parameters
run-name: SSM Parameters - Python

# SSM Parameters update
#
# PROCESS
Expand Down Expand Up @@ -38,9 +41,6 @@ on:
type: string
required: true

name: SSM Parameters
run-name: SSM Parameters - Python

permissions:
contents: read

Expand All @@ -59,14 +59,14 @@ jobs:
]

permissions:
contents: write
contents: read
id-token: write
steps:
- id: transform
run: |
echo 'CONVERTED_REGION=${{ matrix.region }}' | tr 'a-z\-' 'A-Z_' >> "$GITHUB_OUTPUT"
- id: creds
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2
with:
aws-region: ${{ matrix.region }}
role-to-assume: ${{ secrets[format('{0}', steps.transform.outputs.CONVERTED_REGION)] }}
Expand Down
Loading