Skip to content

Commit

Permalink
github oidc role
Browse files Browse the repository at this point in the history
  • Loading branch information
rrigato committed May 25, 2024
1 parent 8244d0f commit ae9bdd4
Showing 1 changed file with 31 additions and 0 deletions.
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

0 comments on commit ae9bdd4

Please sign in to comment.