forked from aws-samples/aws-proton-workshop-code
-
Notifications
You must be signed in to change notification settings - Fork 0
/
GitHubConfiguration.yaml
54 lines (50 loc) · 2.01 KB
/
GitHubConfiguration.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
Parameters:
FullRepoName:
Type: String
Description: "The organization and name of the repository within which you will be utilizing created IAM Role within GitHub Actions (e.g. org/repo_name)"
Resources:
Role:
Type: AWS::IAM::Role
# Creates the role that will be passed to Terraform to be able to deploy
# infrastructure in your AWS account. You will enter this role in your
# env_config.json file
# Note that this role has administrator access to your account, so that
# it can be used to provision any infrastructure in your templates. We
# recommend you scope down the role permissions to the resources that will be used
# in your Proton templates
Properties:
RoleName: ExampleGithubRole
ManagedPolicyArns: [arn:aws:iam::aws:policy/AdministratorAccess]
AssumeRolePolicyDocument:
Statement:
- Effect: Allow
Action: sts:AssumeRoleWithWebIdentity
Principal:
Federated: !Ref GithubOidc
Condition:
StringLike:
token.actions.githubusercontent.com:sub: !Sub repo:${FullRepoName}:*
GithubOidc:
# This identity provider is required to accept OpenID Connect credentials
# from GitHub
Type: AWS::IAM::OIDCProvider
Properties:
Url: https://token.actions.githubusercontent.com
ThumbprintList: [6938fd4d98bab03faadb97b34396831e3780aea1]
ClientIdList:
- sts.amazonaws.com
StateFileBucket:
# This bucket will be used to store your Terraform Open Source state files
Type: AWS::S3::Bucket
Properties:
BucketName: !Join
- ''
- - 'aws-proton-terraform-bucket-'
- !Ref AWS::AccountId
Outputs:
Role:
Description: "The role that will be used to provision infrastructure. Configure it per environment in your env_config.json file"
Value: !GetAtt Role.Arn
BucketName:
Description: "Name of the bucket for our state files. Configure it per environment in your env_config.json file"
Value: !Ref StateFileBucket