Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into huijbers/x-stack-re…
Browse files Browse the repository at this point in the history
…ferences
  • Loading branch information
rix0rrr committed Jan 8, 2019
2 parents 5694b9c + 2169015 commit d1a643e
Show file tree
Hide file tree
Showing 101 changed files with 415 additions and 284 deletions.
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
15 changes: 13 additions & 2 deletions docs/src/cloudformation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -149,18 +149,29 @@ Outputs
Conditions
----------
.. NEEDS SOME INTRO TEXT
`cdk.Condition` can be used to define CloudFormation "Condition" elements in the template.
The `cdk.Fn.conditionXx()` static methods can be used to produce "condition expressions".
.. code-block:: js
import sqs = require('@aws-cdk/aws-sqs');
import cdk = require('@aws-cdk/cdk');
const param = new cdk.Parameter(this, 'Param1', { type: 'String' });
const cond1 = new cdk.Condition(this, 'Condition1', { expression: cdk.Fn.conditionEquals("a", "b") });
const cond2 = new cdk.Condition(this, 'Condition2', { expression: cdk.Fn.conditionContains([ "a", "b", "c" ], "c") });
const cond3 = new cdk.Condition(this, 'Condition3', { expression: cdk.Fn.conditionEquals(param, "hello") });
const cond4 = new cdk.Condition(this, 'Condition4', {
expression: cdk.Fn.conditionOr(cond1, cond2, cdk.Fn.conditionNot(cond3))
});
const cond = new cdk.Condition(this, 'MyCondition', {
expression: new cdk.FnIf(...)
});
const queue = new sqs.CfnQueue(this, 'MyQueue');
queue.options.condition = cond;
queue.options.condition = cond4;
.. _intrinsic_functions:
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"
},
"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 this.node.stringifyJson({ 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
@@ -1,6 +1,6 @@
import cpapi = require('@aws-cdk/aws-codepipeline-api');
import cdk = require('@aws-cdk/cdk');
import { cloudformation } from './codepipeline.generated';
import { CfnCustomActionType } from './codepipeline.generated';

/**
* The creation attributes used for defining a configuration property
Expand Down Expand Up @@ -119,7 +119,7 @@ export class CustomActionRegistration extends cdk.Construct {
constructor(parent: cdk.Construct, id: string, props: CustomActionRegistrationProps) {
super(parent, id);

new cloudformation.CustomActionTypeResource(this, 'Resource', {
new CfnCustomActionType(this, 'Resource', {
category: props.category,
inputArtifactDetails: {
minimumCount: props.artifactBounds.minInputs,
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
Loading

0 comments on commit d1a643e

Please sign in to comment.