-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(readme): include deployment instruction for CFN (#81)
- Loading branch information
1 parent
05c7a04
commit 71f61e4
Showing
3 changed files
with
250 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,159 @@ | ||
# Reference - https://github.com/marketplace/actions/configure-aws-credentials-action-for-github-actions | ||
AWSTemplateFormatVersion: 2010-09-09 | ||
Description: | | ||
Maintainers Only: Used to provision access for Github actions to deploy the serverless application | ||
Transform: AWS::Serverless-2016-10-31 | ||
|
||
Parameters: | ||
GitHubOrg: | ||
Type: String | ||
Default: "Versent" | ||
RepositoryName: | ||
Type: String | ||
Description: Github Repo name that has permissions to deploy this stack | ||
OIDCProviderArn: | ||
Type: String | ||
Description: arn:aws:for the GitHub OIDC Provider. | ||
Default: "" | ||
|
||
|
||
Conditions: | ||
CreateOIDCProvider: !Equals | ||
- !Ref OIDCProviderArn | ||
- "" | ||
|
||
Resources: | ||
|
||
GithubAssumeRole: | ||
Type: AWS::IAM::Role | ||
Properties: | ||
Description: Allow github actions to assume this role to deploy resources to AWS | ||
AssumeRolePolicyDocument: | ||
Statement: | ||
- Effect: Allow | ||
Action: sts:AssumeRoleWithWebIdentity | ||
Principal: | ||
Federated: !If | ||
- CreateOIDCProvider | ||
- !Ref GithubOidc | ||
- !Ref OIDCProviderArn | ||
Condition: | ||
StringLike: | ||
token.actions.githubusercontent.com:sub: !Sub repo:${GitHubOrg}/${RepositoryName}:* | ||
Policies: | ||
- PolicyName: GithubActionsPolicy | ||
PolicyDocument: | ||
Statement: | ||
- Effect: Allow | ||
Action: | ||
- ssm:GetParameter | ||
Resource: | ||
- !Sub arn:aws:ssm:${AWS::Region}:${AWS::AccountId}:parameter/orchestrator/stax/* | ||
- Effect: Allow | ||
Action: | ||
- lambda:GetFunction | ||
- lambda:CreateFunction | ||
- lambda:DeleteFunction | ||
- lambda:GetFunctionConfiguration | ||
- lambda:AddPermission | ||
- lambda:RemovePermission | ||
- lambda:InvokeFunction | ||
- lambda:UpdateFunctionCode | ||
- lambda:UpdateFunctionConfiguration | ||
- lambda:ListTags | ||
- lambda:TagResource | ||
- lambda:UntagResource | ||
- lambda:PutFunctionEventInvokeConfig | ||
- lambda:DeleteFunctionEventInvokeConfig | ||
Resource: | ||
- !Sub arn:aws:lambda:${AWS::Region}:${AWS::AccountId}:function:orchestrator-stax-* | ||
- Effect: Allow | ||
Action: | ||
- lambda:DeleteLayerVersion | ||
- lambda:GetLayerVersion | ||
- lambda:PublishLayerVersion | ||
Resource: | ||
- !Sub arn:aws:lambda:${AWS::Region}:${AWS::AccountId}:layer:orchestrator-stax-* | ||
- !Sub arn:aws:lambda:*:*:layer:orchestrator-stax-* | ||
- Effect: Allow | ||
Action: | ||
- cloudformation:* | ||
Resource: | ||
- !Sub arn:aws:cloudformation:${AWS::Region}:${AWS::AccountId}:stack/orchestrator-stax-* | ||
- !Sub arn:aws:cloudformation:${AWS::Region}:aws:transform/* | ||
- Effect: Allow | ||
Action: | ||
- s3:GetObject | ||
- s3:PutObject* | ||
- s3:CreateMultipartUpload | ||
Resource: | ||
- !Sub arn:aws:s3:::versent-stax-orchestrator-* | ||
- Effect: Allow | ||
Action: | ||
- iam:PassRole | ||
- iam:AttachRolePolicy | ||
- iam:CreateRole | ||
- iam:GetPolicy | ||
- iam:GetRole | ||
- iam:GetRolePolicy | ||
- iam:CreatePolicy | ||
- iam:DeleteRole | ||
- iam:DetachRolePolicy | ||
- iam:UpdateRole | ||
- iam:DeleteRolePolicy | ||
- iam:PutRolePolicy | ||
- iam:CreatePolicyVersion | ||
- iam:DeletePolicyVersion | ||
- iam:DeletePolicy | ||
- iam:ListPolicyVersions | ||
- iam:TagRole | ||
- iam:UntagRole | ||
Resource: | ||
- !Sub arn:aws:iam::${AWS::AccountId}:role/orchestrator-stax-* | ||
- !Sub arn:aws:iam::${AWS::AccountId}:policy/orchestrator-stax-* | ||
- Effect: Allow | ||
Action: | ||
- logs:CreateLogGroup | ||
- logs:DeleteLogGroup | ||
- logs:PutLogEvents | ||
- logs:TagResource | ||
- logs:PutRetentionPolicy | ||
- logs:DeleteRetentionPolicy | ||
Resource: !Sub arn:aws:logs:${AWS::Region}:${AWS::AccountId}:log-group:/aws/lambda/orchestrator-stax-* | ||
- Effect: Allow | ||
Action: | ||
- states:DescribeStateMachine | ||
- states:DeleteStateMachine | ||
- states:ListExecutions | ||
- states:UpdateStateMachine | ||
- states:CreateStateMachine | ||
- states:ListTagsForResource | ||
- states:TagResource | ||
- states:UntagResource | ||
- states:StartExecution | ||
Resource: | ||
- arn:aws:states:*:*:stateMachine:orchestrator-stax-* | ||
- Effect: Allow | ||
Action: | ||
- serverlessrepo:CreateApplication | ||
Resource: !Sub arn:aws:serverlessrepo:${AWS::Region}:${AWS::AccountId}:applications/* | ||
- Effect: Allow | ||
Action: | ||
- serverlessrepo:CreateApplicationVersion | ||
- serverlessrepo:UpdateApplication | ||
Resource: !Sub arn:aws:serverlessrepo:${AWS::Region}:${AWS::AccountId}:applications/stax-orchestrator | ||
|
||
GithubOidc: | ||
Type: AWS::IAM::OIDCProvider | ||
Condition: CreateOIDCProvider | ||
Properties: | ||
Url: https://token.actions.githubusercontent.com | ||
ClientIdList: | ||
- sts.amazonaws.com | ||
ThumbprintList: | ||
- 6938fd4d98bab03faadb97b34396831e3780aea1 | ||
- 1c58a3a8518e8759bf075b76b750d4f2df264fcd | ||
|
||
Outputs: | ||
GithubAssumeRoleArn: | ||
Value: !GetAtt GithubAssumeRole.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
AWSTemplateFormatVersion: '2010-09-09' | ||
|
||
Description: | | ||
Maintainers Only: Create a S3 bucket used for hosting the artifacts in the AWS SAM package process | ||
Resources: | ||
ArtifactBucket: | ||
Type: AWS::S3::Bucket | ||
Properties: | ||
BucketEncryption: | ||
ServerSideEncryptionConfiguration: | ||
- ServerSideEncryptionByDefault: | ||
SSEAlgorithm: AES256 | ||
PublicAccessBlockConfiguration: | ||
BlockPublicAcls: true | ||
BlockPublicPolicy: true | ||
IgnorePublicAcls: true | ||
RestrictPublicBuckets: true | ||
AccessControl: Private | ||
LifecycleConfiguration: | ||
Rules: | ||
- Id: BasicLifeCycle | ||
Status: Enabled | ||
Transitions: | ||
- TransitionInDays: 1 | ||
StorageClass: INTELLIGENT_TIERING | ||
|
||
ArtifactBucketPolicy: | ||
Type: AWS::S3::BucketPolicy | ||
Properties: | ||
Bucket: !Ref ArtifactBucket | ||
PolicyDocument: | ||
Statement: | ||
- Effect: Allow | ||
Principal: | ||
Service: serverlessrepo.amazonaws.com | ||
Action: s3:GetObject | ||
Resource: !Sub arn:aws:s3:::${ArtifactBucket}/* | ||
Condition: | ||
StringEquals: | ||
aws:SourceAccount: !Ref AWS::AccountId | ||
|
||
- | ||
Sid: AllowSSLRequestsOnly | ||
Action: s3:* | ||
Effect: Deny | ||
Resource: | ||
- !Sub ${ArtifactBucket.Arn} | ||
- !Sub ${ArtifactBucket.Arn}/* | ||
Condition: | ||
Bool: | ||
aws:SecureTransport: false | ||
Principal: "*" | ||
|
||
|
||
ArtifactBucketArn: | ||
Type: AWS::SSM::Parameter | ||
Properties: | ||
Name: /orchestrator/stax/artifact/bucket/name | ||
Description: Bucket name used for artifact storage | ||
Type: String | ||
Value: !Ref ArtifactBucket |
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