Skip to content
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

github oidc role #16

Merged
merged 1 commit into from
May 25, 2024
Merged
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
31 changes: 31 additions & 0 deletions templates/tvratings_alexa_skill.template
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ Parameters:
Type: String
Default: tvratings_skill.alexa_lambda_handler

githubUser:
Default: rrigato
Description: 'GitHub organization name'
Type: String

lambdaExecutionRoleName:
Type: String
Default: tvratings_lambda_role
Expand All @@ -38,6 +43,11 @@ Parameters:
MinValue: 1
MaxValue: 900

oidcAudience:
Default: 'sts.amazonaws.com'
Description: 'The audience for the OIDC provider'
Type: String

projectName:
Type: String
Default: tvratings
Expand Down Expand Up @@ -83,3 +93,24 @@ Resources:
Timeout: !Ref lambdaTimeout
TracingConfig:
Mode: Active

projectRoleForGitHubActions:
Type: AWS::IAM::Role
Properties:
AssumeRolePolicyDocument:
Statement:
- Effect: Allow
Action: sts:AssumeRoleWithWebIdentity
Principal:
Federated:
Fn::ImportValue:
githubOidcProviderArn
Condition:
StringEquals:
token.actions.githubusercontent.com:aud: !Ref oidcAudience
StringLike:
token.actions.githubusercontent.com:sub: !Sub repo:${githubUser}/${projectName}:*
Description: !Sub '${projectName} GitHub Actions role to assume'
ManagedPolicyArns:
- !Sub arn:aws:iam::${AWS::AccountId}:policy/${projectName}_pipeline_permissions
RoleName: !Sub ${projectName}-github-actions-role
Loading