-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: use oicd to authenticate github actions build
- Loading branch information
1 parent
0118dac
commit 3fff580
Showing
3 changed files
with
78 additions
and
13 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
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
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,67 @@ | ||
AWSTemplateFormatVersion: 2010-09-09 | ||
Description: GitHub OIDC for when GitHub wants to communicate with AWS. | ||
Resources: | ||
|
||
# This is the bare-bones role. | ||
GitHubActionsRole: | ||
Type: AWS::IAM::Role | ||
Properties: | ||
RoleName: GitHub_Actions_Role | ||
AssumeRolePolicyDocument: | ||
Version: 2012-10-17 | ||
Statement: | ||
- Effect: Allow | ||
Principal: | ||
Federated: !Sub arn:aws:iam::${AWS::AccountId}:oidc-provider/token.actions.githubusercontent.com | ||
Action: sts:AssumeRoleWithWebIdentity | ||
Condition: | ||
StringLike: | ||
## THESE ARE CASE SENSITIVE! | ||
'token.actions.githubusercontent.com:sub': ['repo:asfadmin/Discovery-SearchUI'] | ||
StringEqualsIgnoreCase: | ||
'token.actions.githubusercontent.com:aud': sts.amazonaws.com | ||
Policies: | ||
- PolicyName: OidcSafetyPolicy | ||
PolicyDocument: | ||
Version: '2012-10-17' | ||
Statement: | ||
- Sid: OidcSafeties | ||
Effect: Deny | ||
Action: | ||
- sts:AssumeRole | ||
Resource: "*" | ||
- PolicyName: GitHubActionsDeployPolicy | ||
PolicyDocument: | ||
Version: '2012-10-17' | ||
Statement: | ||
- Sid: AllowS3SyncActions | ||
Effect: Allow | ||
Action: | ||
- s3:DeleteObject | ||
- s3:GetBucketLocation | ||
- s3:GetObject | ||
- s3:ListBucket | ||
- s3:PutObject | ||
Resource: | ||
- arn:aws:s3:::search-ui-custom-deployments | ||
- arn:aws:s3:::search-ui-custom-deployments/* | ||
- PolicyName: CloudfrontInvalidation | ||
PolicyDocument: | ||
Version: '2012-10-17' | ||
Statement: | ||
- Sid: AllowInvalidations | ||
Effect: Allow | ||
Action: | ||
- cloudfront:CreateInvalidation | ||
Resource: "*" | ||
|
||
|
||
# This is the OIDC provider hookup itself. This tells AWS to delegate authN GitHub | ||
GitHubActionsOidcProvider: | ||
Type: AWS::IAM::OIDCProvider | ||
Properties: | ||
ClientIdList: | ||
- sts.amazonaws.com | ||
ThumbprintList: | ||
- 6938fd4d98bab03faadb97b34396831e3780aea1 | ||
Url: https://token.actions.githubusercontent.com |