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

feat: no more generated attribute types in CFN layer (L1) #1489

Merged
merged 6 commits into from
Jan 8, 2019
Merged
Show file tree
Hide file tree
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
16 changes: 16 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,22 @@ Here are a few useful commands:
evaluate only the rule specified [awslint README](./tools/awslint/README.md)
for details on include/exclude rule patterns.

### cfn2ts

This tool is used to generate our low-level CloudFormation resources
(L1/`CfnFoo`). It is executed as part of the build step of all modules in the
AWS Construct Library.

The tool consults the `cdk-build.cloudformation` key in `package.json` to
determine which CloudFormation namespace this library represents (e.g.
`AWS::EC2` is the namespace for `aws-ec2`). We maintain strict 1:1 relationship
between those.

Each module also has an npm script called `cfn2ts`:

* `npm run cfn2ts`: generates L1 for a specific module
* `lerna run cfn2ts`: generates L1 for the entire repo

## Development Workflows

### Full clean build
Expand Down
3 changes: 2 additions & 1 deletion packages/@aws-cdk/alexa-ask/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
"pkglint": "pkglint -f",
"test": "cdk-test",
"watch": "cdk-watch",
"awslint": "cdk-awslint"
"awslint": "cdk-awslint",
"cfn2ts": "cfn2ts"
eladb marked this conversation as resolved.
Show resolved Hide resolved
},
"cdk-build": {
"cloudformation": "Alexa::ASK"
Expand Down
3 changes: 2 additions & 1 deletion packages/@aws-cdk/aws-amazonmq/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
"pkglint": "pkglint -f",
"test": "cdk-test",
"watch": "cdk-watch",
"awslint": "cdk-awslint"
"awslint": "cdk-awslint",
"cfn2ts": "cfn2ts"
},
"cdk-build": {
"cloudformation": "AWS::AmazonMQ"
Expand Down
3 changes: 2 additions & 1 deletion packages/@aws-cdk/aws-apigateway/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
"integ": "cdk-integ",
"pkglint": "pkglint -f",
"package": "cdk-package",
"awslint": "cdk-awslint"
"awslint": "cdk-awslint",
"cfn2ts": "cfn2ts"
},
"cdk-build": {
"cloudformation": "AWS::ApiGateway"
Expand Down
3 changes: 2 additions & 1 deletion packages/@aws-cdk/aws-applicationautoscaling/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
"integ": "cdk-integ",
"pkglint": "pkglint -f",
"package": "cdk-package",
"awslint": "cdk-awslint"
"awslint": "cdk-awslint",
"cfn2ts": "cfn2ts"
},
"cdk-build": {
"cloudformation": "AWS::ApplicationAutoScaling"
Expand Down
3 changes: 2 additions & 1 deletion packages/@aws-cdk/aws-appstream/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
"pkglint": "pkglint -f",
"test": "cdk-test",
"watch": "cdk-watch",
"awslint": "cdk-awslint"
"awslint": "cdk-awslint",
"cfn2ts": "cfn2ts"
},
"cdk-build": {
"cloudformation": "AWS::AppStream"
Expand Down
3 changes: 2 additions & 1 deletion packages/@aws-cdk/aws-appsync/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
"integ": "cdk-integ",
"pkglint": "pkglint -f",
"package": "cdk-package",
"awslint": "cdk-awslint"
"awslint": "cdk-awslint",
"cfn2ts": "cfn2ts"
},
"cdk-build": {
"cloudformation": "AWS::AppSync"
Expand Down
3 changes: 2 additions & 1 deletion packages/@aws-cdk/aws-athena/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@
"integ": "cdk-integ",
"pkglint": "pkglint -f",
"package": "cdk-package",
"awslint": "cdk-awslint"
"awslint": "cdk-awslint",
"cfn2ts": "cfn2ts"
},
"keywords": [
"aws",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ export class AutoScalingGroup extends cdk.Construct implements IAutoScalingGroup

// use delayed evaluation
const machineImage = props.machineImage.getImage(this);
const userDataToken = new cdk.Token(() => cdk.Fn.base64((machineImage.os.createUserData(this.userDataLines))));
const userDataToken = new cdk.Token(() => cdk.Fn.base64((machineImage.os.createUserData(this.userDataLines)))).toString();
const securityGroupsToken = new cdk.Token(() => this.securityGroups.map(sg => sg.securityGroupId));

const launchConfig = new CfnLaunchConfiguration(this, 'LaunchConfig', {
Expand Down
3 changes: 2 additions & 1 deletion packages/@aws-cdk/aws-autoscaling/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
"integ": "cdk-integ",
"pkglint": "pkglint -f",
"package": "cdk-package",
"awslint": "cdk-awslint"
"awslint": "cdk-awslint",
"cfn2ts": "cfn2ts"
},
"cdk-build": {
"cloudformation": "AWS::AutoScaling"
Expand Down
3 changes: 2 additions & 1 deletion packages/@aws-cdk/aws-autoscalingplans/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
"integ": "cdk-integ",
"pkglint": "pkglint -f",
"package": "cdk-package",
"awslint": "cdk-awslint"
"awslint": "cdk-awslint",
"cfn2ts": "cfn2ts"
},
"cdk-build": {
"cloudformation": "AWS::AutoScalingPlans"
Expand Down
3 changes: 2 additions & 1 deletion packages/@aws-cdk/aws-batch/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
"integ": "cdk-integ",
"pkglint": "pkglint -f",
"package": "cdk-package",
"awslint": "cdk-awslint"
"awslint": "cdk-awslint",
"cfn2ts": "cfn2ts"
},
"cdk-build": {
"cloudformation": "AWS::Batch"
Expand Down
3 changes: 2 additions & 1 deletion packages/@aws-cdk/aws-budgets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
"integ": "cdk-integ",
"pkglint": "pkglint -f",
"package": "cdk-package",
"awslint": "cdk-awslint"
"awslint": "cdk-awslint",
"cfn2ts": "cfn2ts"
},
"cdk-build": {
"cloudformation": "AWS::Budgets"
Expand Down
3 changes: 2 additions & 1 deletion packages/@aws-cdk/aws-certificatemanager/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
"integ": "cdk-integ",
"pkglint": "pkglint -f",
"package": "cdk-package",
"awslint": "cdk-awslint"
"awslint": "cdk-awslint",
"cfn2ts": "cfn2ts"
},
"cdk-build": {
"cloudformation": "AWS::CertificateManager"
Expand Down
3 changes: 2 additions & 1 deletion packages/@aws-cdk/aws-cloud9/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
"integ": "cdk-integ",
"pkglint": "pkglint -f",
"package": "cdk-package",
"awslint": "cdk-awslint"
"awslint": "cdk-awslint",
"cfn2ts": "cfn2ts"
},
"cdk-build": {
"cloudformation": "AWS::Cloud9"
Expand Down
3 changes: 2 additions & 1 deletion packages/@aws-cdk/aws-cloudformation/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
"integ": "cdk-integ",
"pkglint": "pkglint -f",
"package": "cdk-package",
"awslint": "cdk-awslint"
"awslint": "cdk-awslint",
"cfn2ts": "cfn2ts"
},
"cdk-build": {
"cloudformation": "AWS::CloudFormation"
Expand Down
3 changes: 2 additions & 1 deletion packages/@aws-cdk/aws-cloudfront/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
"integ": "cdk-integ",
"pkglint": "pkglint -f",
"package": "cdk-package",
"awslint": "cdk-awslint"
"awslint": "cdk-awslint",
"cfn2ts": "cfn2ts"
},
"cdk-build": {
"cloudformation": "AWS::CloudFront"
Expand Down
3 changes: 2 additions & 1 deletion packages/@aws-cdk/aws-cloudtrail/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
"test": "cdk-test",
"pkglint": "pkglint -f",
"package": "cdk-package",
"awslint": "cdk-awslint"
"awslint": "cdk-awslint",
"cfn2ts": "cfn2ts"
},
"cdk-build": {
"cloudformation": "AWS::CloudTrail"
Expand Down
4 changes: 2 additions & 2 deletions packages/@aws-cdk/aws-cloudwatch/lib/dashboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ export class Dashboard extends Construct {
// This is a bug in CloudFormation, but we don't want CDK users to have a bad
// experience. We'll generate a name here if you did not supply one.
// See: https://github.com/awslabs/aws-cdk/issues/213
const dashboardName = (props && props.dashboardName) || new Token(() => this.generateDashboardName());
const dashboardName = (props && props.dashboardName) || new Token(() => this.generateDashboardName()).toString();

this.dashboard = new CfnDashboard(this, 'Resource', {
dashboardName,
dashboardBody: new Token(() => {
const column = new Column(...this.rows);
column.position(0, 0);
return CloudFormationJSON.stringify({ widgets: column.toJson() });
})
}).toString()
});
}

Expand Down
3 changes: 2 additions & 1 deletion packages/@aws-cdk/aws-cloudwatch/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
"integ": "cdk-integ",
"pkglint": "pkglint -f",
"package": "cdk-package",
"awslint": "cdk-awslint"
"awslint": "cdk-awslint",
"cfn2ts": "cfn2ts"
},
"cdk-build": {
"cloudformation": "AWS::CloudWatch"
Expand Down
3 changes: 2 additions & 1 deletion packages/@aws-cdk/aws-codebuild/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
"integ": "cdk-integ",
"pkglint": "pkglint -f",
"package": "cdk-package",
"awslint": "cdk-awslint"
"awslint": "cdk-awslint",
"cfn2ts": "cfn2ts"
},
"cdk-build": {
"cloudformation": "AWS::CodeBuild"
Expand Down
3 changes: 2 additions & 1 deletion packages/@aws-cdk/aws-codecommit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
"integ": "cdk-integ",
"pkglint": "pkglint -f",
"package": "cdk-package",
"awslint": "cdk-awslint"
"awslint": "cdk-awslint",
"cfn2ts": "cfn2ts"
},
"cdk-build": {
"cloudformation": "AWS::CodeCommit"
Expand Down
3 changes: 2 additions & 1 deletion packages/@aws-cdk/aws-codedeploy/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
"integ": "cdk-integ",
"pkglint": "pkglint -f",
"package": "cdk-package",
"awslint": "cdk-awslint"
"awslint": "cdk-awslint",
"cfn2ts": "cfn2ts"
},
"cdk-build": {
"cloudformation": "AWS::CodeDeploy"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export class GitHubSourceAction extends actions.SourceAction {
new CfnWebhook(this, 'WebhookResource', {
authentication: 'GITHUB_HMAC',
authenticationConfiguration: {
secretToken: props.oauthToken,
secretToken: props.oauthToken.toString(),
},
filters: [
{
Expand Down
3 changes: 2 additions & 1 deletion packages/@aws-cdk/aws-codepipeline/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
"integ": "cdk-integ",
"pkglint": "pkglint -f",
"package": "cdk-package",
"awslint": "cdk-awslint"
"awslint": "cdk-awslint",
"cfn2ts": "cfn2ts"
},
"cdk-build": {
"cloudformation": "AWS::CodePipeline"
Expand Down
3 changes: 2 additions & 1 deletion packages/@aws-cdk/aws-cognito/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
"integ": "cdk-integ",
"pkglint": "pkglint -f",
"package": "cdk-package",
"awslint": "cdk-awslint"
"awslint": "cdk-awslint",
"cfn2ts": "cfn2ts"
},
"cdk-build": {
"cloudformation": "AWS::Cognito"
Expand Down
3 changes: 2 additions & 1 deletion packages/@aws-cdk/aws-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
"integ": "cdk-integ",
"pkglint": "pkglint -f",
"package": "cdk-package",
"awslint": "cdk-awslint"
"awslint": "cdk-awslint",
"cfn2ts": "cfn2ts"
},
"cdk-build": {
"cloudformation": "AWS::Config"
Expand Down
3 changes: 2 additions & 1 deletion packages/@aws-cdk/aws-datapipeline/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
"integ": "cdk-integ",
"pkglint": "pkglint -f",
"package": "cdk-package",
"awslint": "cdk-awslint"
"awslint": "cdk-awslint",
"cfn2ts": "cfn2ts"
},
"cdk-build": {
"cloudformation": "AWS::DataPipeline"
Expand Down
3 changes: 2 additions & 1 deletion packages/@aws-cdk/aws-dax/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
"integ": "cdk-integ",
"pkglint": "pkglint -f",
"package": "cdk-package",
"awslint": "cdk-awslint"
"awslint": "cdk-awslint",
"cfn2ts": "cfn2ts"
},
"cdk-build": {
"cloudformation": "AWS::DAX"
Expand Down
3 changes: 2 additions & 1 deletion packages/@aws-cdk/aws-directoryservice/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
"integ": "cdk-integ",
"pkglint": "pkglint -f",
"package": "cdk-package",
"awslint": "cdk-awslint"
"awslint": "cdk-awslint",
"cfn2ts": "cfn2ts"
},
"cdk-build": {
"cloudformation": "AWS::DirectoryService"
Expand Down
3 changes: 2 additions & 1 deletion packages/@aws-cdk/aws-dlm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
"pkglint": "pkglint -f",
"test": "cdk-test",
"watch": "cdk-watch",
"awslint": "cdk-awslint"
"awslint": "cdk-awslint",
"cfn2ts": "cfn2ts"
},
"cdk-build": {
"cloudformation": "AWS::DLM"
Expand Down
3 changes: 2 additions & 1 deletion packages/@aws-cdk/aws-dms/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
"integ": "cdk-integ",
"pkglint": "pkglint -f",
"package": "cdk-package",
"awslint": "cdk-awslint"
"awslint": "cdk-awslint",
"cfn2ts": "cfn2ts"
},
"cdk-build": {
"cloudformation": "AWS::DMS"
Expand Down
3 changes: 2 additions & 1 deletion packages/@aws-cdk/aws-dynamodb/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
"integ": "cdk-integ",
"pkglint": "pkglint -f",
"package": "cdk-package",
"awslint": "cdk-awslint"
"awslint": "cdk-awslint",
"cfn2ts": "cfn2ts"
},
"cdk-build": {
"cloudformation": "AWS::DynamoDB"
Expand Down
3 changes: 2 additions & 1 deletion packages/@aws-cdk/aws-ec2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
"integ": "cdk-integ",
"pkglint": "pkglint -f",
"package": "cdk-package",
"awslint": "cdk-awslint"
"awslint": "cdk-awslint",
"cfn2ts": "cfn2ts"
},
"cdk-build": {
"cloudformation": "AWS::EC2"
Expand Down
3 changes: 2 additions & 1 deletion packages/@aws-cdk/aws-ecr/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
"integ": "cdk-integ",
"pkglint": "pkglint -f",
"package": "cdk-package",
"awslint": "cdk-awslint"
"awslint": "cdk-awslint",
"cfn2ts": "cfn2ts"
},
"cdk-build": {
"cloudformation": "AWS::ECR"
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-ecs/lib/base/task-definition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ export class TaskDefinition extends cdk.Construct {
const taskDef = new CfnTaskDefinition(this, 'Resource', {
containerDefinitions: new cdk.Token(() => this.containers.map(x => x.renderContainerDefinition())),
volumes: new cdk.Token(() => this.volumes),
executionRoleArn: new cdk.Token(() => this.executionRole && this.executionRole.roleArn),
executionRoleArn: new cdk.Token(() => this.executionRole && this.executionRole.roleArn).toString(),
family: this.family,
taskRoleArn: this.taskRole.roleArn,
requiresCompatibilities: [
Expand Down
3 changes: 2 additions & 1 deletion packages/@aws-cdk/aws-ecs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
"integ": "cdk-integ",
"pkglint": "pkglint -f",
"package": "cdk-package",
"awslint": "cdk-awslint"
"awslint": "cdk-awslint",
"cfn2ts": "cfn2ts"
},
"cdk-build": {
"cloudformation": "AWS::ECS"
Expand Down
3 changes: 2 additions & 1 deletion packages/@aws-cdk/aws-efs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
"integ": "cdk-integ",
"pkglint": "pkglint -f",
"package": "cdk-package",
"awslint": "cdk-awslint"
"awslint": "cdk-awslint",
"cfn2ts": "cfn2ts"
},
"cdk-build": {
"cloudformation": "AWS::EFS"
Expand Down
Loading