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

chore(CFN): check in CFN #1375

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
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
101 changes: 101 additions & 0 deletions cfn/JavaScriptESDK.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
Outputs:
StackArn:
Description: >-
Do not remove this output! Pipelines needs this to do its association. (And
LPT. Removing it will break things)
Value: !Ref 'AWS::StackId'
Comment on lines +1 to +6
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: If we maintain the CFN here, we cannot use BONES pipelines to maintain the Stack.

Suggested change
Outputs:
StackArn:
Description: >-
Do not remove this output! Pipelines needs this to do its association. (And
LPT. Removing it will break things)
Value: !Ref 'AWS::StackId'

Parameters:
DeploymentBucketImportName:
Default: 'BONESBootstrap-PDX-beta-DeploymentBucket'
Description: >-
This parameter is meant to be passed by LPT (and piplines). It holds the
name of import that points to the bucket that holds your artifacts. You
should use this as the import (Fn::ImportValue: {Ref: DeploymentBucket})
for getting any BATS related artifacts.
Type: String
Stage:
Default: 'beta'
Type: String
PipelinesControlledRegionBucket:
Type: String
Description: The regionalized bucket to read the artifact from.
Default: 'placeholder'
Comment on lines +8 to +22
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: If we maintain the CFN here, we cannot use BONES pipelines to maintain the Stack.

Suggested change
DeploymentBucketImportName:
Default: 'BONESBootstrap-PDX-beta-DeploymentBucket'
Description: >-
This parameter is meant to be passed by LPT (and piplines). It holds the
name of import that points to the bucket that holds your artifacts. You
should use this as the import (Fn::ImportValue: {Ref: DeploymentBucket})
for getting any BATS related artifacts.
Type: String
Stage:
Default: 'beta'
Type: String
PipelinesControlledRegionBucket:
Type: String
Description: The regionalized bucket to read the artifact from.
Default: 'placeholder'

NumberOfBuildsInBatch:
Type: Number
MaxValue: 100
MinValue: 1
Default: 16
Description: The number of builds you expect to run in a batch

Resources:
CodeBuildRole:
Properties:
Comment on lines +31 to +32
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion/Nit: I find it easier to read CFN if I know the Type first.

Suggested change
CodeBuildRole:
Properties:
CodeBuildRole:
Type: 'AWS::IAM::Role'
Properties:

AssumeRolePolicyDocument: >-
{"Version":"2012-10-17","Statement":[{"Effect":"Allow","Principal":{"Service":"codebuild.amazonaws.com"},"Action":"sts:AssumeRole"},{"Effect":"Allow","Principal":{"Federated":"arn:aws:iam::587316601012:oidc-provider/token.actions.githubusercontent.com"},"Action":"sts:AssumeRoleWithWebIdentity","Condition":{"StringEquals":{"token.actions.githubusercontent.com:aud":"sts.amazonaws.com"},"StringLike":{"token.actions.githubusercontent.com:sub":"repo:aws/aws-encryption-sdk-javascript:*"}}}]}
Policies:
- PolicyDocument:
Statement:
- Action:
- 'logs:CreateLogGroup'
- 'logs:CreateLogStream'
- 'logs:PutLogEvents'
- 'logs:GetLogEvents'
Effect: Allow
Resource:
- '*'
- Action:
- 'kms:Encrypt'
- 'kms:Decrypt'
- 'kms:GenerateDataKey'
Effect: Allow
Resource:
- '*'
- Action:
- 's3:PutObject'
Effect: Allow
Resource:
- '*'
- Action:
- 'codebuild:StartBuild'
- 'codebuild:StopBuild'
- 'codebuild:RetryBuild'
- 'codebuild:BatchGetBuilds'
Effect: Allow
Resource:
- !Sub 'arn:aws:codebuild:${AWS::Region}:${AWS::AccountId}:project/JavaScriptESDK'
PolicyName: !Sub '${AWS::StackName}CloudWatchLogsPolicy'
Type: 'AWS::IAM::Role'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion/Nit: I find it easier to read CFN if I know the Type first.

Suggested change
Type: 'AWS::IAM::Role'

ExampleWaitHandle:
Properties: {}
Type: 'AWS::CloudFormation::WaitConditionHandle'
Comment on lines +68 to +70
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: Remove Example code from yee old BONES template

Suggested change
ExampleWaitHandle:
Properties: {}
Type: 'AWS::CloudFormation::WaitConditionHandle'

JavaScriptESDK:
Properties:
Comment on lines +71 to +72
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion/Nit: I find it easier to read CFN if I know the Type first.

Suggested change
JavaScriptESDK:
Properties:
JavaScriptESDK:
Type: 'AWS::CodeBuild::Project'
Properties:

Artifacts:
Type: NO_ARTIFACTS
Environment:
ComputeType: BUILD_GENERAL1_SMALL
Image: 'aws/codebuild/standard:5.0'
Type: LINUX_CONTAINER
LogsConfig:
S3Logs:
Location: !Sub '${LogBucket}/JavaScriptESDK'
Status: ENABLED
Name: JavaScriptESDK
ServiceRole: !GetAtt CodeBuildRole.Arn
BuildBatchConfig:
ServiceRole: !GetAtt CodeBuildRole.Arn
Restrictions:
MaximumBuildsAllowed: !Ref NumberOfBuildsInBatch
ComputeTypesAllowed:
- BUILD_GENERAL1_SMALL
- BUILD_GENERAL1_MEDIUM
- BUILD_GENERAL1_LARGE
TimeoutInMins: 480
Source:
Location: 'https://github.com/aws/aws-encryption-sdk-javascript'
ReportBuildStatus: 'true'
Type: GITHUB
Type: 'AWS::CodeBuild::Project'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion/Nit: I find it easier to read CFN if I know the Type first.

Suggested change
Type: 'AWS::CodeBuild::Project'

LogBucket:
Type: 'AWS::S3::Bucket'

Loading