-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #274 from ministryofjustice/setup-aws-profile
Github Action to setup AWS profile
- Loading branch information
Showing
2 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Setup AWS Profile Action | ||
|
||
A GitHub Action to setup an aws profile. | ||
|
||
## Usage | ||
|
||
``` | ||
- uses: ministryofjustice/github-actions/setup-aws-profile@v18.2.1 | ||
with: | ||
role-arn: ${{ secrets.MY_AWS_ROLE_ARN }} | ||
profile-name: ${{ secrets.MY_PROFILE }} | ||
``` | ||
|
||
| Parameter | Description | Required | Default | | ||
| ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | ---------------------------------------------------------------- | | ||
| role-arn | ARN of IAM role to create profile for | true | N/A | | ||
| profile-name | Name of AWS profile | true | N/A | | ||
| aws-region | AWS region | false | eu-west-2 | |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: "Setup AWS Profile" | ||
description: "A GitHub Action to setup an aws profile." | ||
inputs: | ||
role-arn: | ||
description: "ARN of IAM role to create profile for" | ||
required: true | ||
profile-name: | ||
description: "Name of AWS profile" | ||
required: true | ||
aws-region: | ||
description: "AWS region" | ||
required: false | ||
default: "eu-west-2" | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Configure AWS credentials for profile | ||
uses: aws-actions/configure-aws-credentials@v4 | ||
with: | ||
role-to-assume: ${{ inputs.role-arn }} | ||
aws-region: ${{ inputs.aws-region }} | ||
role-duration-seconds: 900 | ||
|
||
- name: Create AWS profile | ||
shell: bash | ||
run: | | ||
aws configure set region ${{ env.AWS_REGION }} --profile ${{ inputs.profile-name }} | ||
aws configure set aws_access_key_id ${{ env.AWS_ACCESS_KEY_ID }} --profile ${{ inputs.profile-name }} | ||
aws configure set aws_secret_access_key ${{ env.AWS_SECRET_ACCESS_KEY }} --profile ${{ inputs.profile-name }} | ||
aws configure set aws_session_token ${{ env.AWS_SESSION_TOKEN }} --profile ${{ inputs.profile-name }} | ||