-
-
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.
- Loading branch information
Showing
3 changed files
with
61 additions
and
1 deletion.
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,9 @@ | ||
## Setup | ||
|
||
In order to let GitHub Actions retrieve layer versions from the Bref AWS account, we authorize GitHub via [OIDC](https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/configuring-openid-connect-in-amazon-web-services) instead of hardcoded AWS access keys. | ||
|
||
This needs to be done once in the AWS console (because no access keys have permissions to deploy via CloudFormation). | ||
|
||
- file: `github-role.yml` | ||
- stack name: github-oidc-layers-js | ||
- `FullRepoName` parameter: `brefphp/layers.js` |
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,37 @@ | ||
AWSTemplateFormatVersion: 2010-09-09 | ||
Description: OIDC provider that lets brefphp/layers.js retrieve layer versions | ||
|
||
Parameters: | ||
FullRepoName: | ||
Type: String | ||
|
||
Resources: | ||
Role: | ||
Type: AWS::IAM::Role | ||
Properties: | ||
RoleName: bref-layer-js-github-actions | ||
AssumeRolePolicyDocument: | ||
Statement: | ||
- Effect: Allow | ||
Action: sts:AssumeRoleWithWebIdentity | ||
Principal: | ||
Federated: arn:aws:iam::534081306603:oidc-provider/token.actions.githubusercontent.com | ||
Condition: | ||
StringLike: | ||
token.actions.githubusercontent.com:sub: !Sub repo:${FullRepoName}:* | ||
Policies: | ||
- PolicyName: RetrieveLayersForLayerJsRole | ||
PolicyDocument: | ||
Statement: | ||
- Effect: Allow | ||
Action: | ||
- lambda:GetLayerVersion | ||
- lambda:GetLayerVersionPolicy | ||
- lambda:ListLayers | ||
- lambda:ListLayerVersions | ||
Resource: | ||
- '*' | ||
|
||
Outputs: | ||
Role: | ||
Value: !GetAtt Role.Arn |
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