diff --git a/CHANGELOG.md b/CHANGELOG.md index 9c49498acd67d..b6b124a3ba4da 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,54 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +## [0.33.0](https://github.com/awslabs/aws-cdk/compare/v0.32.0...v0.33.0) (2019-05-30) + +**IMPORTANT**: apps created with the CDK version 0.33.0 and above cannot be used with an older CLI version. + +### Bug Fixes + +* **core:** Fn.cidr should return a list and not a string ([#2678](https://github.com/awslabs/aws-cdk/issues/2678)) ([9d2ea2a](https://github.com/awslabs/aws-cdk/commit/9d2ea2a)), closes [#2671](https://github.com/awslabs/aws-cdk/issues/2671) +* **cli:** fix ts-node usage on Windows ([#2660](https://github.com/awslabs/aws-cdk/issues/2660)) ([5fe0af5](https://github.com/awslabs/aws-cdk/commit/5fe0af5)) +* **cli:** make `cdk docs` open the new API reference ([#2633](https://github.com/awslabs/aws-cdk/issues/2633)) ([6450758](https://github.com/awslabs/aws-cdk/commit/6450758)) +* **cli:** correctly pass build args to docker build ([#2634](https://github.com/awslabs/aws-cdk/issues/2634)) ([9c58d6f](https://github.com/awslabs/aws-cdk/commit/9c58d6f)) +* **core:** hide `dependencyRoots` from public API ([#2668](https://github.com/awslabs/aws-cdk/issues/2668)) ([2ba5ad2](https://github.com/awslabs/aws-cdk/commit/2ba5ad2)), closes [#2348](https://github.com/awslabs/aws-cdk/issues/2348) +* **autoscaling:** move lifecycle hook targets to their own module ([#2628](https://github.com/awslabs/aws-cdk/issues/2628)) ([b282132](https://github.com/awslabs/aws-cdk/commit/b282132)), closes [#2447](https://github.com/awslabs/aws-cdk/issues/2447) +* **codepipeline:** no longer allow providing an index when adding a Stage to a Pipeline. ([#2624](https://github.com/awslabs/aws-cdk/issues/2624)) ([ce39b12](https://github.com/awslabs/aws-cdk/commit/ce39b12)) +* **codepipeline-actions:** correctly serialize the userParameters passed to the Lambda invoke Action. ([#2537](https://github.com/awslabs/aws-cdk/issues/2537)) ([ceaf54a](https://github.com/awslabs/aws-cdk/commit/ceaf54a)) +* **cx-api:** improve compatibility messages for cli <=> app ([#2676](https://github.com/awslabs/aws-cdk/issues/2676)) ([38a9894](https://github.com/awslabs/aws-cdk/commit/38a9894)) +* **ecs:** move high level ECS constructs into aws-ecs-patterns ([#2623](https://github.com/awslabs/aws-cdk/issues/2623)) ([f901313](https://github.com/awslabs/aws-cdk/commit/f901313)) +* **logs:** move log destinations into 'aws-logs-destinations' ([#2655](https://github.com/awslabs/aws-cdk/issues/2655)) ([01601c2](https://github.com/awslabs/aws-cdk/commit/01601c2)), closes [#2444](https://github.com/awslabs/aws-cdk/issues/2444) +* **s3:** move notification destinations into their own module ([#2659](https://github.com/awslabs/aws-cdk/issues/2659)) ([185951c](https://github.com/awslabs/aws-cdk/commit/185951c)), closes [#2445](https://github.com/awslabs/aws-cdk/issues/2445) + +### Features + +* **cli:** decouple "synth" and "deploy" through cloud assemblies ([#2636](https://github.com/awslabs/aws-cdk/issues/2636)) ([c52bcfc](https://github.com/awslabs/aws-cdk/commit/c52bcfc)), closes [#1893](https://github.com/awslabs/aws-cdk/issues/1893) [#2093](https://github.com/awslabs/aws-cdk/issues/2093) [#1954](https://github.com/awslabs/aws-cdk/issues/1954) [#2310](https://github.com/awslabs/aws-cdk/issues/2310) [#2073](https://github.com/awslabs/aws-cdk/issues/2073) [#1245](https://github.com/awslabs/aws-cdk/issues/1245) [#341](https://github.com/awslabs/aws-cdk/issues/341) [#956](https://github.com/awslabs/aws-cdk/issues/956) [#233](https://github.com/awslabs/aws-cdk/issues/233) [#2016](https://github.com/awslabs/aws-cdk/issues/2016) +* **acm:** allow specifying region for validated certificates ([#2626](https://github.com/awslabs/aws-cdk/issues/2626)) ([1a7d4db](https://github.com/awslabs/aws-cdk/commit/1a7d4db)) +* **apigateway:** support for UsagePlan, ApiKey, UsagePlanKey ([#2564](https://github.com/awslabs/aws-cdk/issues/2564)) ([203f114](https://github.com/awslabs/aws-cdk/commit/203f114)), closes [#723](https://github.com/awslabs/aws-cdk/issues/723) +* **autoscaling:** allow setting spotPrice ([#2571](https://github.com/awslabs/aws-cdk/issues/2571)) ([d640055](https://github.com/awslabs/aws-cdk/commit/d640055)), closes [#2208](https://github.com/awslabs/aws-cdk/issues/2208) +* **cfn:** update CloudFormation spec to v3.3.0 ([#2669](https://github.com/awslabs/aws-cdk/issues/2669)) ([0f553ee](https://github.com/awslabs/aws-cdk/commit/0f553ee)) +* **cli:** disable `noUnusedLocals` and `noUnusedParameters` from typescript templates ([#2654](https://github.com/awslabs/aws-cdk/issues/2654)) ([b061826](https://github.com/awslabs/aws-cdk/commit/b061826)) +* **cloudformation:** aws-api custom resource ([#1850](https://github.com/awslabs/aws-cdk/issues/1850)) ([9a48b66](https://github.com/awslabs/aws-cdk/commit/9a48b66)) +* **cloudwatch:** support all Y-Axis properties ([#2406](https://github.com/awslabs/aws-cdk/issues/2406)) ([8904c3e](https://github.com/awslabs/aws-cdk/commit/8904c3e)), closes [#2385](https://github.com/awslabs/aws-cdk/issues/2385) + + +### BREAKING CHANGES + +* **logs:** using a Lambda or Kinesis Stream as CloudWatch log subscription destination now requires an integration object from the `@aws-cdk/aws-logs-destinations` package. +* **codepipeline-actions:** removed the `addPutJobResultPolicy` property when creating LambdaInvokeAction. +* **cli:** `--interactive` has been removed +* **cli:** `--numbered` has been removed +* **cli:** `--staging` is now a boolean flag that indicates whether assets should be copied to the `--output` directory or directly referenced (`--no-staging` is useful for e.g. local debugging with SAM CLI) +* **assets:** Assets (e.g. Lambda code assets) are now referenced relative to the output directory. +* **assert:** `SynthUtils.templateForStackName` has been removed (use `SynthUtils.synthesize(stack).template`). +* **cx-api:** `cxapi.SynthesizedStack` renamed to `cxapi.CloudFormationStackArtifact` with multiple API changes. +* **core:** `cdk.App.run()` now returns a `cxapi.CloudAssembly` instead of `cdk.ISynthesisSession`. +* **s3:** using a Topic, Queue or Lambda as bucket notification destination now requires an integration object from the `@aws-cdk/aws-s3-notifications` package. +* **autoscaling:** using a Topic, Queue or Lambda as Lifecycle Hook Target now requires an integration object from the `@aws-cdk/aws-autoscaling-hooktargets` package. +* **codepipeline:** the property atIndex has been removed from the StagePlacement interface. +* **aws-ecs:** These changes move all L3 and higher constructs out of the aws-ecs module into the aws-ecs-patterns module. The following constructs have been moved into the aws-ecs-patterns module: `EcsQueueWorkerService`, `FargateQueueWorkerService`, `LoadBalancedEcsService`, `LoadBalancedFargateService` and `LoadBalancedFargateServiceApplets`. +* **cloudwatch:** rename `leftAxisRange` => `leftYAxis`, `rightAxisRange` => `rightYAxis`, rename `YAxisRange` => `YAxisProps`. + ## [0.32.0](https://github.com/awslabs/aws-cdk/compare/v0.31.0...v0.32.0) (2019-05-24) diff --git a/buildspec.yaml b/buildspec.yaml index b23384f617e95..4277a228ff3bf 100644 --- a/buildspec.yaml +++ b/buildspec.yaml @@ -12,7 +12,7 @@ phases: - /bin/bash ./build.sh post_build: commands: - - "[ -f .BUILD_COMPLETED ] && /bin/bash ./pack.sh" + - "[ -f .BUILD_COMPLETED ] && [ -z \"${SKIP_PACK:-}\" ] && /bin/bash ./pack.sh" artifacts: files: - "**/*" diff --git a/bump.sh b/bump.sh index 5a23b6019b79e..6fa0f41664b48 100755 --- a/bump.sh +++ b/bump.sh @@ -12,10 +12,6 @@ export NODE_OPTIONS="--max-old-space-size=4096 ${NODE_OPTIONS:-}" lerna publish --force-publish=* --skip-npm --skip-git --repo-version ${ver} -# align "peerDependencies" to actual dependencies after bump -# this is technically only required for major version bumps, but in the meantime we shall do it in every bump -/bin/bash scripts/fix-peer-deps.sh - # Update CHANGELOG.md only at the root cat > /tmp/context.json < /tmp/context.json </dev/null | grep -v "(private)" | cut -d" " -f1 | xargs -n1 # Run the "cdk-package" script in all modules. For jsii modules, this invokes jsii-pacmak which generates and builds multi-language # outputs. For non-jsii module, it will just run "npm pack" and place the output in dist/npm # (which is similar to how pacmak outputs it). -lerna run ${scopes} --sort --stream package +lerna run ${scopes} --sort --concurrency=1 --stream package # Collect dist/ from all modules into the root dist/ for dir in $(find packages -name dist | grep -v node_modules); do diff --git a/packages/@aws-cdk/alexa-ask/package.json b/packages/@aws-cdk/alexa-ask/package.json index 238a55e97a87d..db23f761a4dc9 100644 --- a/packages/@aws-cdk/alexa-ask/package.json +++ b/packages/@aws-cdk/alexa-ask/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/alexa-ask", - "version": "0.32.0", + "version": "0.33.0", "description": "The CDK Construct Library for Alexa::ASK", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -61,18 +61,18 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "cdk-build-tools": "^0.32.0", - "cfn2ts": "^0.32.0", - "pkglint": "^0.32.0" + "@aws-cdk/assert": "^0.33.0", + "cdk-build-tools": "^0.33.0", + "cfn2ts": "^0.33.0", + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "peerDependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "engines": { "node": ">= 8.10.0" } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/app-delivery/package-lock.json b/packages/@aws-cdk/app-delivery/package-lock.json index 25f1f66095044..1767d107f8010 100644 --- a/packages/@aws-cdk/app-delivery/package-lock.json +++ b/packages/@aws-cdk/app-delivery/package-lock.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/app-delivery", - "version": "0.32.0", + "version": "0.33.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/@aws-cdk/app-delivery/package.json b/packages/@aws-cdk/app-delivery/package.json index 6248604886010..bee6561bfe3c7 100644 --- a/packages/@aws-cdk/app-delivery/package.json +++ b/packages/@aws-cdk/app-delivery/package.json @@ -1,7 +1,7 @@ { "name": "@aws-cdk/app-delivery", "description": "Continuous Integration / Continuous Delivery for CDK Applications", - "version": "0.32.0", + "version": "0.33.0", "main": "lib/index.js", "types": "lib/index.d.ts", "jsii": { @@ -38,21 +38,21 @@ "build+test": "npm run build && npm test" }, "dependencies": { - "@aws-cdk/aws-cloudformation": "^0.32.0", - "@aws-cdk/aws-codebuild": "^0.32.0", - "@aws-cdk/aws-codepipeline": "^0.32.0", - "@aws-cdk/aws-codepipeline-actions": "^0.32.0", - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0", - "@aws-cdk/cx-api": "^0.32.0" + "@aws-cdk/aws-cloudformation": "^0.33.0", + "@aws-cdk/aws-codebuild": "^0.33.0", + "@aws-cdk/aws-codepipeline": "^0.33.0", + "@aws-cdk/aws-codepipeline-actions": "^0.33.0", + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0", + "@aws-cdk/cx-api": "^0.33.0" }, "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "@aws-cdk/aws-s3": "^0.32.0", - "cdk-build-tools": "^0.32.0", - "cdk-integ-tools": "^0.32.0", + "@aws-cdk/assert": "^0.33.0", + "@aws-cdk/aws-s3": "^0.33.0", + "cdk-build-tools": "^0.33.0", + "cdk-integ-tools": "^0.33.0", "fast-check": "^1.14.0", - "pkglint": "^0.32.0" + "pkglint": "^0.33.0" }, "repository": { "type": "git", @@ -71,15 +71,15 @@ "cdk" ], "peerDependencies": { - "@aws-cdk/aws-cloudformation": "^0.32.0", - "@aws-cdk/aws-codebuild": "^0.32.0", - "@aws-cdk/aws-codepipeline": "^0.32.0", - "@aws-cdk/aws-codepipeline-actions": "^0.32.0", - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0", - "@aws-cdk/cx-api": "^0.32.0" + "@aws-cdk/aws-cloudformation": "^0.33.0", + "@aws-cdk/aws-codebuild": "^0.33.0", + "@aws-cdk/aws-codepipeline": "^0.33.0", + "@aws-cdk/aws-codepipeline-actions": "^0.33.0", + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0", + "@aws-cdk/cx-api": "^0.33.0" }, "engines": { "node": ">= 8.10.0" } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/applet-js/.gitignore b/packages/@aws-cdk/applet-js/.gitignore deleted file mode 100644 index 6cff5540e188a..0000000000000 --- a/packages/@aws-cdk/applet-js/.gitignore +++ /dev/null @@ -1,12 +0,0 @@ -*.js -*.js.map -*.d.ts -node_modules -dist - -.LAST_BUILD -.nyc_output -coverage -.nycrc -.LAST_PACKAGE -*.snk \ No newline at end of file diff --git a/packages/@aws-cdk/applet-js/.npmignore b/packages/@aws-cdk/applet-js/.npmignore deleted file mode 100644 index 096072c00c111..0000000000000 --- a/packages/@aws-cdk/applet-js/.npmignore +++ /dev/null @@ -1,13 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -*.snk - -*.tsbuildinfo diff --git a/packages/@aws-cdk/applet-js/LICENSE b/packages/@aws-cdk/applet-js/LICENSE deleted file mode 100644 index 46c185646b439..0000000000000 --- a/packages/@aws-cdk/applet-js/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/applet-js/NOTICE b/packages/@aws-cdk/applet-js/NOTICE deleted file mode 100644 index 8585168af8b7d..0000000000000 --- a/packages/@aws-cdk/applet-js/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/applet-js/README.md b/packages/@aws-cdk/applet-js/README.md deleted file mode 100644 index c71d87e54ea60..0000000000000 --- a/packages/@aws-cdk/applet-js/README.md +++ /dev/null @@ -1,5 +0,0 @@ -## AWS CDK applet host program for Javascript - -CDK applets have been deprecated in favor of [decdk](https://github.com/awslabs/aws-cdk/tree/master/packages/decdk). - -This module is part of the [AWS Cloud Development Kit](https://github.com/awslabs/aws-cdk) project. diff --git a/packages/@aws-cdk/applet-js/bin/cdk-applet-js b/packages/@aws-cdk/applet-js/bin/cdk-applet-js deleted file mode 100755 index 18ea4a8d3b4d7..0000000000000 --- a/packages/@aws-cdk/applet-js/bin/cdk-applet-js +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env node -require('./cdk-applet-js.js'); \ No newline at end of file diff --git a/packages/@aws-cdk/applet-js/bin/cdk-applet-js.ts b/packages/@aws-cdk/applet-js/bin/cdk-applet-js.ts deleted file mode 100644 index f94028c403f17..0000000000000 --- a/packages/@aws-cdk/applet-js/bin/cdk-applet-js.ts +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env node -// tslint:disable-next-line:no-console -console.error('applets are no longer supported. see: https://github.com/awslabs/aws-cdk/tree/master/packages/decdk'); diff --git a/packages/@aws-cdk/applet-js/package-lock.json b/packages/@aws-cdk/applet-js/package-lock.json deleted file mode 100644 index 58080183eba9c..0000000000000 --- a/packages/@aws-cdk/applet-js/package-lock.json +++ /dev/null @@ -1,97 +0,0 @@ -{ - "name": "@aws-cdk/applet-js", - "version": "0.32.0", - "lockfileVersion": 1, - "requires": true, - "dependencies": { - "@babel/runtime": { - "version": "7.4.5", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.4.5.tgz", - "integrity": "sha512-TuI4qpWZP6lGOGIuGWtp9sPluqYICmbk8T/1vpSysqJxRPkudh/ofFWyqdcMsDf2s7KvDL4/YHgKyvcS3g9CJQ==", - "requires": { - "regenerator-runtime": "^0.13.2" - } - }, - "@types/fs-extra": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-5.1.0.tgz", - "integrity": "sha512-AInn5+UBFIK9FK5xc9yP5e3TQSPNNgjHByqYcj9g5elVBnDQcQL7PlO1CIRy2gWlbwK7UPYqi7vRvFA44dCmYQ==", - "dev": true, - "requires": { - "@types/node": "*" - } - }, - "@types/node": { - "version": "12.0.2", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.0.2.tgz", - "integrity": "sha512-5tabW/i+9mhrfEOUcLDu2xBPsHJ+X5Orqy9FKpale3SjDA17j5AEpYq5vfy3oAeAHGcvANRCO3NV3d2D6q3NiA==", - "dev": true - }, - "@types/yaml": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@types/yaml/-/yaml-1.0.2.tgz", - "integrity": "sha512-rS1VJFjyGKNHk8H97COnPIK+oeLnc0J9G0ES63o/Ky+WlJCeaFGiGCTGhV/GEVKua7ZWIV1JIDopYUwrfvTo7A==", - "dev": true - }, - "buffer-from": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", - "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==" - }, - "fs-extra": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz", - "integrity": "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==", - "requires": { - "graceful-fs": "^4.1.2", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - } - }, - "graceful-fs": { - "version": "4.1.15", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.15.tgz", - "integrity": "sha512-6uHUhOPEBgQ24HM+r6b/QwWfZq+yiFcipKFrOFiBEnWdy5sdzYoi+pJeQaPI5qOLRFqWmAXUPQNsielzdLoecA==" - }, - "jsonfile": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", - "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=", - "requires": { - "graceful-fs": "^4.1.6" - } - }, - "regenerator-runtime": { - "version": "0.13.2", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.2.tgz", - "integrity": "sha512-S/TQAZJO+D3m9xeN1WTI8dLKBBiRgXBlTJvbWjCThHWZj9EvHK70Ff50/tYj2J/fvBY6JtFVwRuazHN2E7M9BA==" - }, - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==" - }, - "source-map-support": { - "version": "0.5.12", - "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.12.tgz", - "integrity": "sha512-4h2Pbvyy15EE02G+JOZpUCmqWJuqrs+sEkzewTm++BPi7Hvn/HwcqLAcNxYAyI0x13CpPPn+kMjl+hplXMHITQ==", - "requires": { - "buffer-from": "^1.0.0", - "source-map": "^0.6.0" - } - }, - "universalify": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", - "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==" - }, - "yaml": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.6.0.tgz", - "integrity": "sha512-iZfse3lwrJRoSlfs/9KQ9iIXxs9++RvBFVzAqbbBiFT+giYtyanevreF9r61ZTbGMgWQBxAua3FzJiniiJXWWw==", - "requires": { - "@babel/runtime": "^7.4.5" - } - } - } -} diff --git a/packages/@aws-cdk/applet-js/package.json b/packages/@aws-cdk/applet-js/package.json deleted file mode 100644 index 7f5abe38296f8..0000000000000 --- a/packages/@aws-cdk/applet-js/package.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "name": "@aws-cdk/applet-js", - "version": "0.32.0", - "deprecated": "Applets have been deprecated in favor of 'decdk'", - "description": "Javascript CDK applet host program", - "main": "bin/cdk-applet-js.js", - "types": "bin/cdk-applet-js.d.ts", - "bin": { - "cdk-applet-js": "bin/cdk-applet-js" - }, - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "pkglint": "pkglint -f", - "package": "cdk-package", - "build+test+package": "npm run build+test && npm run package", - "build+test": "npm run build && npm test" - }, - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@types/fs-extra": "^5.0.5", - "cdk-build-tools": "^0.32.0", - "pkglint": "^0.32.0" - }, - "repository": { - "url": "https://github.com/awslabs/aws-cdk.git", - "type": "git", - "directory": "packages/@aws-cdk/applet-js" - }, - "keywords": [ - "aws", - "cdk" - ], - "homepage": "https://github.com/awslabs/aws-cdk", - "engines": { - "node": ">= 8.10.0" - } -} diff --git a/packages/@aws-cdk/applet-js/tsconfig.json b/packages/@aws-cdk/applet-js/tsconfig.json deleted file mode 100644 index b25f239ae2fab..0000000000000 --- a/packages/@aws-cdk/applet-js/tsconfig.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "compilerOptions": { - "target":"ES2018", - "module": "commonjs", - "lib": ["es2016", "es2017.object", "es2017.string"], - "strict": true, - "noImplicitAny": true, - "strictNullChecks": true, - "noImplicitThis": true, - "alwaysStrict": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "noImplicitReturns": true, - "noFallthroughCasesInSwitch": true, - "inlineSourceMap": true, - "inlineSources": true, - "experimentalDecorators": true, - "strictPropertyInitialization":false - } -} - diff --git a/packages/@aws-cdk/assert/package-lock.json b/packages/@aws-cdk/assert/package-lock.json index e06f20caeab7e..c6d6fa69e6e06 100644 --- a/packages/@aws-cdk/assert/package-lock.json +++ b/packages/@aws-cdk/assert/package-lock.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/assert", - "version": "0.32.0", + "version": "0.33.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/@aws-cdk/assert/package.json b/packages/@aws-cdk/assert/package.json index e04a96ec66bdb..7f5c58f6f32ce 100644 --- a/packages/@aws-cdk/assert/package.json +++ b/packages/@aws-cdk/assert/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/assert", - "version": "0.32.0", + "version": "0.33.0", "description": "An assertion library for use with CDK Apps", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -27,13 +27,13 @@ "license": "Apache-2.0", "devDependencies": { "@types/jest": "^24.0.11", - "cdk-build-tools": "^0.32.0", - "pkglint": "^0.32.0" + "cdk-build-tools": "^0.33.0", + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/cdk": "^0.32.0", - "@aws-cdk/cloudformation-diff": "^0.32.0", - "@aws-cdk/cx-api": "^0.32.0", + "@aws-cdk/cdk": "^0.33.0", + "@aws-cdk/cloudformation-diff": "^0.33.0", + "@aws-cdk/cx-api": "^0.33.0", "jest": "^24.7.1", "source-map-support": "^0.5.12" }, diff --git a/packages/@aws-cdk/assets-docker/package-lock.json b/packages/@aws-cdk/assets-docker/package-lock.json index 7ef4418d5b00c..968d13b706727 100644 --- a/packages/@aws-cdk/assets-docker/package-lock.json +++ b/packages/@aws-cdk/assets-docker/package-lock.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/assets-docker", - "version": "0.32.0", + "version": "0.33.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/@aws-cdk/assets-docker/package.json b/packages/@aws-cdk/assets-docker/package.json index c823816368f30..4f69a94a0258c 100644 --- a/packages/@aws-cdk/assets-docker/package.json +++ b/packages/@aws-cdk/assets-docker/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/assets-docker", - "version": "0.32.0", + "version": "0.33.0", "description": "Docker image assets", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -57,34 +57,34 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", + "@aws-cdk/assert": "^0.33.0", "@types/proxyquire": "^1.3.28", - "aws-cdk": "^0.32.0", - "cdk-build-tools": "^0.32.0", - "cdk-integ-tools": "^0.32.0", - "pkglint": "^0.32.0", + "aws-cdk": "^0.33.0", + "cdk-build-tools": "^0.33.0", + "cdk-integ-tools": "^0.33.0", + "pkglint": "^0.33.0", "proxyquire": "^2.1.0" }, "dependencies": { - "@aws-cdk/assets": "^0.32.0", - "@aws-cdk/aws-cloudformation": "^0.32.0", - "@aws-cdk/aws-ecr": "^0.32.0", - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/aws-lambda": "^0.32.0", - "@aws-cdk/aws-s3": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0", - "@aws-cdk/cx-api": "^0.32.0" + "@aws-cdk/assets": "^0.33.0", + "@aws-cdk/aws-cloudformation": "^0.33.0", + "@aws-cdk/aws-ecr": "^0.33.0", + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/aws-lambda": "^0.33.0", + "@aws-cdk/aws-s3": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0", + "@aws-cdk/cx-api": "^0.33.0" }, "homepage": "https://github.com/awslabs/aws-cdk", "peerDependencies": { - "@aws-cdk/assets": "^0.32.0", - "@aws-cdk/aws-cloudformation": "^0.32.0", - "@aws-cdk/aws-ecr": "^0.32.0", - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/aws-lambda": "^0.32.0", - "@aws-cdk/aws-s3": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0", - "@aws-cdk/cx-api": "^0.32.0" + "@aws-cdk/assets": "^0.33.0", + "@aws-cdk/aws-cloudformation": "^0.33.0", + "@aws-cdk/aws-ecr": "^0.33.0", + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/aws-lambda": "^0.33.0", + "@aws-cdk/aws-s3": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0", + "@aws-cdk/cx-api": "^0.33.0" }, "nyc": { "statements": 70 @@ -92,4 +92,4 @@ "engines": { "node": ">= 8.10.0" } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/assets/package-lock.json b/packages/@aws-cdk/assets/package-lock.json index 712c7814efb5c..bd826ac10ae37 100644 --- a/packages/@aws-cdk/assets/package-lock.json +++ b/packages/@aws-cdk/assets/package-lock.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/assets", - "version": "0.32.0", + "version": "0.33.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/@aws-cdk/assets/package.json b/packages/@aws-cdk/assets/package.json index 5f1afbdc3ccbb..007a26f030a28 100644 --- a/packages/@aws-cdk/assets/package.json +++ b/packages/@aws-cdk/assets/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/assets", - "version": "0.32.0", + "version": "0.33.0", "description": "Integration of CDK apps with local assets", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -61,29 +61,29 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", + "@aws-cdk/assert": "^0.33.0", "@types/minimatch": "^3.0.3", "@types/sinon": "^7.0.11", - "aws-cdk": "^0.32.0", - "cdk-build-tools": "^0.32.0", - "cdk-integ-tools": "^0.32.0", - "pkglint": "^0.32.0", + "aws-cdk": "^0.33.0", + "cdk-build-tools": "^0.33.0", + "cdk-integ-tools": "^0.33.0", + "pkglint": "^0.33.0", "sinon": "^7.3.2", "ts-mock-imports": "^1.2.3" }, "dependencies": { - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/aws-s3": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0", - "@aws-cdk/cx-api": "^0.32.0", + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/aws-s3": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0", + "@aws-cdk/cx-api": "^0.33.0", "minimatch": "^3.0.4" }, "homepage": "https://github.com/awslabs/aws-cdk", "peerDependencies": { - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/aws-s3": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0", - "@aws-cdk/cx-api": "^0.32.0" + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/aws-s3": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0", + "@aws-cdk/cx-api": "^0.33.0" }, "engines": { "node": ">= 8.10.0" @@ -91,4 +91,4 @@ "bundledDependencies": [ "minimatch" ] -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-amazonmq/package.json b/packages/@aws-cdk/aws-amazonmq/package.json index 63e18f4143396..e95577d42a916 100644 --- a/packages/@aws-cdk/aws-amazonmq/package.json +++ b/packages/@aws-cdk/aws-amazonmq/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-amazonmq", - "version": "0.32.0", + "version": "0.33.0", "description": "The CDK Construct Library for AWS::AmazonMQ", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -61,18 +61,18 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "cdk-build-tools": "^0.32.0", - "cfn2ts": "^0.32.0", - "pkglint": "^0.32.0" + "@aws-cdk/assert": "^0.33.0", + "cdk-build-tools": "^0.33.0", + "cfn2ts": "^0.33.0", + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "peerDependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "engines": { "node": ">= 8.10.0" } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/package.json b/packages/@aws-cdk/aws-apigateway/package.json index ac92879787765..102b1f11d5f21 100644 --- a/packages/@aws-cdk/aws-apigateway/package.json +++ b/packages/@aws-cdk/aws-apigateway/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-apigateway", - "version": "0.32.0", + "version": "0.33.0", "description": "The CDK Construct Library for AWS::ApiGateway", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -63,25 +63,25 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "@aws-cdk/aws-ec2": "^0.32.0", - "cdk-build-tools": "^0.32.0", - "cdk-integ-tools": "^0.32.0", - "cfn2ts": "^0.32.0", - "pkglint": "^0.32.0" + "@aws-cdk/assert": "^0.33.0", + "@aws-cdk/aws-ec2": "^0.33.0", + "cdk-build-tools": "^0.33.0", + "cdk-integ-tools": "^0.33.0", + "cfn2ts": "^0.33.0", + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/aws-elasticloadbalancingv2": "^0.32.0", - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/aws-lambda": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/aws-elasticloadbalancingv2": "^0.33.0", + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/aws-lambda": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0" }, "homepage": "https://github.com/awslabs/aws-cdk", "peerDependencies": { - "@aws-cdk/aws-elasticloadbalancingv2": "^0.32.0", - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/aws-lambda": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/aws-elasticloadbalancingv2": "^0.33.0", + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/aws-lambda": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0" }, "engines": { "node": ">= 8.10.0" @@ -91,4 +91,4 @@ "from-method:@aws-cdk/aws-apigateway.Resource" ] } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-applicationautoscaling/package-lock.json b/packages/@aws-cdk/aws-applicationautoscaling/package-lock.json index e8c07d2829ab5..4d8e0c2b56a69 100644 --- a/packages/@aws-cdk/aws-applicationautoscaling/package-lock.json +++ b/packages/@aws-cdk/aws-applicationautoscaling/package-lock.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-applicationautoscaling", - "version": "0.32.0", + "version": "0.33.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/@aws-cdk/aws-applicationautoscaling/package.json b/packages/@aws-cdk/aws-applicationautoscaling/package.json index 12ec5091ae707..d59a9fc44680e 100644 --- a/packages/@aws-cdk/aws-applicationautoscaling/package.json +++ b/packages/@aws-cdk/aws-applicationautoscaling/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-applicationautoscaling", - "version": "0.32.0", + "version": "0.33.0", "description": "The CDK Construct Library for AWS::ApplicationAutoScaling", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -60,26 +60,26 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "cdk-build-tools": "^0.32.0", - "cfn2ts": "^0.32.0", + "@aws-cdk/assert": "^0.33.0", + "cdk-build-tools": "^0.33.0", + "cfn2ts": "^0.33.0", "fast-check": "^1.14.0", - "pkglint": "^0.32.0" + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/aws-autoscaling-common": "^0.32.0", - "@aws-cdk/aws-cloudwatch": "^0.32.0", - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/aws-autoscaling-common": "^0.33.0", + "@aws-cdk/aws-cloudwatch": "^0.33.0", + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0" }, "homepage": "https://github.com/awslabs/aws-cdk", "peerDependencies": { - "@aws-cdk/aws-autoscaling-common": "^0.32.0", - "@aws-cdk/aws-cloudwatch": "^0.32.0", - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/aws-autoscaling-common": "^0.33.0", + "@aws-cdk/aws-cloudwatch": "^0.33.0", + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0" }, "engines": { "node": ">= 8.10.0" } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-appmesh/package.json b/packages/@aws-cdk/aws-appmesh/package.json index 1c4fd439d07b6..07aa184af2806 100644 --- a/packages/@aws-cdk/aws-appmesh/package.json +++ b/packages/@aws-cdk/aws-appmesh/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-appmesh", - "version": "0.32.0", + "version": "0.33.0", "description": "The CDK Construct Library for AWS::AppMesh", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -62,18 +62,18 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "cdk-build-tools": "^0.32.0", - "cfn2ts": "^0.32.0", - "pkglint": "^0.32.0" + "@aws-cdk/assert": "^0.33.0", + "cdk-build-tools": "^0.33.0", + "cfn2ts": "^0.33.0", + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "peerDependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "engines": { "node": ">= 8.10.0" } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-appstream/package.json b/packages/@aws-cdk/aws-appstream/package.json index d9f65cf05f084..a16a73919dbdb 100644 --- a/packages/@aws-cdk/aws-appstream/package.json +++ b/packages/@aws-cdk/aws-appstream/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-appstream", - "version": "0.32.0", + "version": "0.33.0", "description": "The CDK Construct Library for AWS::AppStream", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -61,18 +61,18 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "cdk-build-tools": "^0.32.0", - "cfn2ts": "^0.32.0", - "pkglint": "^0.32.0" + "@aws-cdk/assert": "^0.33.0", + "cdk-build-tools": "^0.33.0", + "cfn2ts": "^0.33.0", + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "peerDependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "engines": { "node": ">= 8.10.0" } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-appsync/package.json b/packages/@aws-cdk/aws-appsync/package.json index e513faee43262..6bb75db31e122 100644 --- a/packages/@aws-cdk/aws-appsync/package.json +++ b/packages/@aws-cdk/aws-appsync/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-appsync", - "version": "0.32.0", + "version": "0.33.0", "description": "The CDK Construct Library for AWS::AppSync", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -60,19 +60,19 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "cdk-build-tools": "^0.32.0", - "cfn2ts": "^0.32.0", - "pkglint": "^0.32.0" + "@aws-cdk/assert": "^0.33.0", + "cdk-build-tools": "^0.33.0", + "cfn2ts": "^0.33.0", + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "homepage": "https://github.com/awslabs/aws-cdk", "peerDependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "engines": { "node": ">= 8.10.0" } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-athena/package.json b/packages/@aws-cdk/aws-athena/package.json index 2fbd0a300c987..e0bf36884599e 100644 --- a/packages/@aws-cdk/aws-athena/package.json +++ b/packages/@aws-cdk/aws-athena/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-athena", - "version": "0.32.0", + "version": "0.33.0", "description": "The CDK Construct Library for AWS::Athena", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -60,19 +60,19 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "cdk-build-tools": "^0.32.0", - "cfn2ts": "^0.32.0", - "pkglint": "^0.32.0" + "@aws-cdk/assert": "^0.33.0", + "cdk-build-tools": "^0.33.0", + "cfn2ts": "^0.33.0", + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "homepage": "https://github.com/awslabs/aws-cdk", "peerDependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "engines": { "node": ">= 8.10.0" } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-autoscaling-api/.gitignore b/packages/@aws-cdk/aws-autoscaling-api/.gitignore deleted file mode 100644 index 237f3df0d0a80..0000000000000 --- a/packages/@aws-cdk/aws-autoscaling-api/.gitignore +++ /dev/null @@ -1,20 +0,0 @@ -lambda/bundle.zip - -*.js -tsconfig.json -tslint.json -*.js.map -*.d.ts -*.generated.ts -dist -lib/generated/resources.ts -.jsii -lib/*.zip - -.LAST_BUILD -.nyc_output -coverage -.nycrc -.LAST_PACKAGE - -*.snk \ No newline at end of file diff --git a/packages/@aws-cdk/aws-autoscaling-api/.npmignore b/packages/@aws-cdk/aws-autoscaling-api/.npmignore deleted file mode 100644 index 05161d5cab5dc..0000000000000 --- a/packages/@aws-cdk/aws-autoscaling-api/.npmignore +++ /dev/null @@ -1,20 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -lambda/src -lambda/test -lambda/*.sh -*.snk - -*.tsbuildinfo diff --git a/packages/@aws-cdk/aws-autoscaling-api/LICENSE b/packages/@aws-cdk/aws-autoscaling-api/LICENSE deleted file mode 100644 index 46c185646b439..0000000000000 --- a/packages/@aws-cdk/aws-autoscaling-api/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-autoscaling-api/NOTICE b/packages/@aws-cdk/aws-autoscaling-api/NOTICE deleted file mode 100644 index 8585168af8b7d..0000000000000 --- a/packages/@aws-cdk/aws-autoscaling-api/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-autoscaling-api/README.md b/packages/@aws-cdk/aws-autoscaling-api/README.md deleted file mode 100644 index 7e28218bda636..0000000000000 --- a/packages/@aws-cdk/aws-autoscaling-api/README.md +++ /dev/null @@ -1,3 +0,0 @@ -## AWS AutoScaling API Library - -This package has been deprecated. diff --git a/packages/@aws-cdk/aws-autoscaling-api/package-lock.json b/packages/@aws-cdk/aws-autoscaling-api/package-lock.json deleted file mode 100644 index a9d4d14487a80..0000000000000 --- a/packages/@aws-cdk/aws-autoscaling-api/package-lock.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "name": "@aws-cdk/aws-autoscaling-api", - "version": "0.28.0", - "lockfileVersion": 1 -} diff --git a/packages/@aws-cdk/aws-autoscaling-api/package.json b/packages/@aws-cdk/aws-autoscaling-api/package.json deleted file mode 100644 index 6a6faa72da57e..0000000000000 --- a/packages/@aws-cdk/aws-autoscaling-api/package.json +++ /dev/null @@ -1,71 +0,0 @@ -{ - "name": "@aws-cdk/aws-autoscaling-api", - "version": "0.32.0", - "description": "API package for @aws-cdk/aws-autoscaling", - "deprecated": true, - "jsii": { - "outdir": "dist", - "targets": { - "java": { - "package": "software.amazon.awscdk.services.autoscaling.api", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "autoscaling-api" - } - }, - "dotnet": { - "namespace": "Amazon.CDK.AWS.AutoScaling.Api", - "packageId": "Amazon.CDK.AWS.AutoScaling.Api", - "signAssembly": true, - "assemblyOriginatorKeyFile": "../../key.snk" - }, - "python": { - "distName": "aws-cdk.aws-autoscaling-api", - "module": "aws_cdk.aws_autoscaling_api" - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/awslabs/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-autoscaling-api" - }, - "scripts": { - "build": "echo OK", - "watch": "echo OK", - "lint": "echo OK", - "test": "echo OK", - "integ": "echo OK", - "pkglint": "echo OK", - "package": "echo OK", - "awslint": "echo OK", - "build+test+package": "echo OK", - "build+test": "echo OK" - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "s3" - ], - "nyc": { - "exclude": [ - "coverage/**", - "test/**", - "examples/**", - "lib/*.generated.js", - "build-tools/**", - "lambda/**" - ] - }, - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "homepage": "https://github.com/awslabs/aws-cdk", - "engines": { - "node": ">= 8.10.0" - } -} diff --git a/packages/@aws-cdk/aws-autoscaling-common/package-lock.json b/packages/@aws-cdk/aws-autoscaling-common/package-lock.json index 1b0cdffe2da08..a375b34c565eb 100644 --- a/packages/@aws-cdk/aws-autoscaling-common/package-lock.json +++ b/packages/@aws-cdk/aws-autoscaling-common/package-lock.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-autoscaling-common", - "version": "0.32.0", + "version": "0.33.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/@aws-cdk/aws-autoscaling-common/package.json b/packages/@aws-cdk/aws-autoscaling-common/package.json index 378303ea2bc82..0b6d48089c365 100644 --- a/packages/@aws-cdk/aws-autoscaling-common/package.json +++ b/packages/@aws-cdk/aws-autoscaling-common/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-autoscaling-common", - "version": "0.32.0", + "version": "0.33.0", "description": "Common implementation package for @aws-cdk/aws-autoscaling and @aws-cdk/aws-applicationautoscaling", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -56,22 +56,22 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "cdk-build-tools": "^0.32.0", - "cdk-integ-tools": "^0.32.0", + "@aws-cdk/assert": "^0.33.0", + "cdk-build-tools": "^0.33.0", + "cdk-integ-tools": "^0.33.0", "fast-check": "^1.14.0", - "pkglint": "^0.32.0" + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0" }, "homepage": "https://github.com/awslabs/aws-cdk", "peerDependencies": { - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0" }, "engines": { "node": ">= 8.10.0" } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-autoscaling-hooktargets/package-lock.json b/packages/@aws-cdk/aws-autoscaling-hooktargets/package-lock.json index eb944abb01643..3fa956322daca 100644 --- a/packages/@aws-cdk/aws-autoscaling-hooktargets/package-lock.json +++ b/packages/@aws-cdk/aws-autoscaling-hooktargets/package-lock.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-autoscaling-hooktargets", - "version": "0.32.0", + "version": "0.33.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/@aws-cdk/aws-autoscaling-hooktargets/package.json b/packages/@aws-cdk/aws-autoscaling-hooktargets/package.json index 848233e3092a2..7ddf920972251 100644 --- a/packages/@aws-cdk/aws-autoscaling-hooktargets/package.json +++ b/packages/@aws-cdk/aws-autoscaling-hooktargets/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-autoscaling-hooktargets", - "version": "0.32.0", + "version": "0.33.0", "description": "Lifecycle hook for AWS AutoScaling", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -68,32 +68,32 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "@aws-cdk/aws-ec2": "^0.32.0", - "cdk-build-tools": "^0.32.0", - "cdk-integ-tools": "^0.32.0", - "cfn2ts": "^0.32.0", - "pkglint": "^0.32.0", - "jest": "^24.7.1" + "@aws-cdk/assert": "^0.33.0", + "@aws-cdk/aws-ec2": "^0.33.0", + "cdk-build-tools": "^0.33.0", + "cdk-integ-tools": "^0.33.0", + "cfn2ts": "^0.33.0", + "jest": "^24.7.1", + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/aws-autoscaling": "^0.32.0", - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/aws-sns": "^0.32.0", - "@aws-cdk/aws-sqs": "^0.32.0", - "@aws-cdk/aws-lambda": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/aws-autoscaling": "^0.33.0", + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/aws-lambda": "^0.33.0", + "@aws-cdk/aws-sns": "^0.33.0", + "@aws-cdk/aws-sqs": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0" }, "homepage": "https://github.com/awslabs/aws-cdk", "peerDependencies": { - "@aws-cdk/aws-autoscaling": "^0.32.0", - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/aws-sns": "^0.32.0", - "@aws-cdk/aws-sqs": "^0.32.0", - "@aws-cdk/aws-lambda": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/aws-autoscaling": "^0.33.0", + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/aws-lambda": "^0.33.0", + "@aws-cdk/aws-sns": "^0.33.0", + "@aws-cdk/aws-sqs": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0" }, "engines": { "node": ">= 8.10.0" } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-autoscaling/package.json b/packages/@aws-cdk/aws-autoscaling/package.json index 204c68d12da77..954fcce32fd25 100644 --- a/packages/@aws-cdk/aws-autoscaling/package.json +++ b/packages/@aws-cdk/aws-autoscaling/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-autoscaling", - "version": "0.32.0", + "version": "0.33.0", "description": "The CDK Construct Library for AWS::AutoScaling", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -60,32 +60,32 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "cdk-build-tools": "^0.32.0", - "cdk-integ-tools": "^0.32.0", - "cfn2ts": "^0.32.0", - "pkglint": "^0.32.0" + "@aws-cdk/assert": "^0.33.0", + "cdk-build-tools": "^0.33.0", + "cdk-integ-tools": "^0.33.0", + "cfn2ts": "^0.33.0", + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/aws-autoscaling-common": "^0.32.0", - "@aws-cdk/aws-cloudwatch": "^0.32.0", - "@aws-cdk/aws-ec2": "^0.32.0", - "@aws-cdk/aws-elasticloadbalancing": "^0.32.0", - "@aws-cdk/aws-elasticloadbalancingv2": "^0.32.0", - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/aws-sns": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/aws-autoscaling-common": "^0.33.0", + "@aws-cdk/aws-cloudwatch": "^0.33.0", + "@aws-cdk/aws-ec2": "^0.33.0", + "@aws-cdk/aws-elasticloadbalancing": "^0.33.0", + "@aws-cdk/aws-elasticloadbalancingv2": "^0.33.0", + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/aws-sns": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0" }, "homepage": "https://github.com/awslabs/aws-cdk", "peerDependencies": { - "@aws-cdk/aws-autoscaling-common": "^0.32.0", - "@aws-cdk/aws-cloudwatch": "^0.32.0", - "@aws-cdk/aws-ec2": "^0.32.0", - "@aws-cdk/aws-elasticloadbalancing": "^0.32.0", - "@aws-cdk/aws-elasticloadbalancingv2": "^0.32.0", - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/aws-sns": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/aws-autoscaling-common": "^0.33.0", + "@aws-cdk/aws-cloudwatch": "^0.33.0", + "@aws-cdk/aws-ec2": "^0.33.0", + "@aws-cdk/aws-elasticloadbalancing": "^0.33.0", + "@aws-cdk/aws-elasticloadbalancingv2": "^0.33.0", + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/aws-sns": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0" }, "engines": { "node": ">= 8.10.0" @@ -97,4 +97,4 @@ "export:@aws-cdk/aws-autoscaling.IAutoScalingGroup" ] } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-autoscalingplans/package.json b/packages/@aws-cdk/aws-autoscalingplans/package.json index 01304fbf6419a..0c4fd5a270135 100644 --- a/packages/@aws-cdk/aws-autoscalingplans/package.json +++ b/packages/@aws-cdk/aws-autoscalingplans/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-autoscalingplans", - "version": "0.32.0", + "version": "0.33.0", "description": "The CDK Construct Library for AWS::AutoScalingPlans", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -60,19 +60,19 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "cdk-build-tools": "^0.32.0", - "cfn2ts": "^0.32.0", - "pkglint": "^0.32.0" + "@aws-cdk/assert": "^0.33.0", + "cdk-build-tools": "^0.33.0", + "cfn2ts": "^0.33.0", + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "homepage": "https://github.com/awslabs/aws-cdk", "peerDependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "engines": { "node": ">= 8.10.0" } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-batch/package.json b/packages/@aws-cdk/aws-batch/package.json index cbd195a947a57..ffcfcf97a3d7b 100644 --- a/packages/@aws-cdk/aws-batch/package.json +++ b/packages/@aws-cdk/aws-batch/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-batch", - "version": "0.32.0", + "version": "0.33.0", "description": "The CDK Construct Library for AWS::Batch", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -60,19 +60,19 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "cdk-build-tools": "^0.32.0", - "cfn2ts": "^0.32.0", - "pkglint": "^0.32.0" + "@aws-cdk/assert": "^0.33.0", + "cdk-build-tools": "^0.33.0", + "cfn2ts": "^0.33.0", + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "homepage": "https://github.com/awslabs/aws-cdk", "peerDependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "engines": { "node": ">= 8.10.0" } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-budgets/package.json b/packages/@aws-cdk/aws-budgets/package.json index 5dc3f25bf6d01..3dba60d4ac72c 100644 --- a/packages/@aws-cdk/aws-budgets/package.json +++ b/packages/@aws-cdk/aws-budgets/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-budgets", - "version": "0.32.0", + "version": "0.33.0", "description": "The CDK Construct Library for AWS::Budgets", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -60,19 +60,19 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "cdk-build-tools": "^0.32.0", - "cfn2ts": "^0.32.0", - "pkglint": "^0.32.0" + "@aws-cdk/assert": "^0.33.0", + "cdk-build-tools": "^0.33.0", + "cfn2ts": "^0.33.0", + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "homepage": "https://github.com/awslabs/aws-cdk", "peerDependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "engines": { "node": ">= 8.10.0" } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-certificatemanager/README.md b/packages/@aws-cdk/aws-certificatemanager/README.md index 0122b59e2b76b..44e68a715bc57 100644 --- a/packages/@aws-cdk/aws-certificatemanager/README.md +++ b/packages/@aws-cdk/aws-certificatemanager/README.md @@ -65,7 +65,7 @@ Import a certificate manually, if you know the ARN: ```ts const certificate = Certificate.import(this, 'Certificate', { - certificteArn: "arn:aws:..." + certificateArn: "arn:aws:..." }); ``` diff --git a/packages/@aws-cdk/aws-certificatemanager/lambda-packages/dns_validated_certificate_handler/package-lock.json b/packages/@aws-cdk/aws-certificatemanager/lambda-packages/dns_validated_certificate_handler/package-lock.json index 6824405d1fad1..580451416b29b 100644 --- a/packages/@aws-cdk/aws-certificatemanager/lambda-packages/dns_validated_certificate_handler/package-lock.json +++ b/packages/@aws-cdk/aws-certificatemanager/lambda-packages/dns_validated_certificate_handler/package-lock.json @@ -1,6 +1,6 @@ { "name": "dns_validated_certificate_handler", - "version": "0.31.0", + "version": "0.33.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/@aws-cdk/aws-certificatemanager/lambda-packages/dns_validated_certificate_handler/package.json b/packages/@aws-cdk/aws-certificatemanager/lambda-packages/dns_validated_certificate_handler/package.json index 39e46a89d6de2..c8e1dcfc62c60 100644 --- a/packages/@aws-cdk/aws-certificatemanager/lambda-packages/dns_validated_certificate_handler/package.json +++ b/packages/@aws-cdk/aws-certificatemanager/lambda-packages/dns_validated_certificate_handler/package.json @@ -1,7 +1,7 @@ { "name": "dns_validated_certificate_handler", "private": true, - "version": "0.32.0", + "version": "0.33.0", "description": "This module is part of the [AWS Cloud Development Kit](https://github.com/awslabs/aws-cdk) project.", "main": "lib/index.js", "directories": { diff --git a/packages/@aws-cdk/aws-certificatemanager/package.json b/packages/@aws-cdk/aws-certificatemanager/package.json index 7a9bda3e2c88a..373c811000286 100644 --- a/packages/@aws-cdk/aws-certificatemanager/package.json +++ b/packages/@aws-cdk/aws-certificatemanager/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-certificatemanager", - "version": "0.32.0", + "version": "0.33.0", "description": "The CDK Construct Library for AWS::CertificateManager", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -60,27 +60,27 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "cdk-build-tools": "^0.32.0", - "cfn2ts": "^0.32.0", - "pkglint": "^0.32.0" + "@aws-cdk/assert": "^0.33.0", + "cdk-build-tools": "^0.33.0", + "cfn2ts": "^0.33.0", + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/aws-cloudformation": "^0.32.0", - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/aws-lambda": "^0.32.0", - "@aws-cdk/aws-route53": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/aws-cloudformation": "^0.33.0", + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/aws-lambda": "^0.33.0", + "@aws-cdk/aws-route53": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0" }, "homepage": "https://github.com/awslabs/aws-cdk", "peerDependencies": { - "@aws-cdk/aws-cloudformation": "^0.32.0", - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/aws-lambda": "^0.32.0", - "@aws-cdk/aws-route53": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/aws-cloudformation": "^0.33.0", + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/aws-lambda": "^0.33.0", + "@aws-cdk/aws-route53": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0" }, "engines": { "node": ">= 8.10.0" } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cloud9/package.json b/packages/@aws-cdk/aws-cloud9/package.json index f8b5056edc650..760464306e9fc 100644 --- a/packages/@aws-cdk/aws-cloud9/package.json +++ b/packages/@aws-cdk/aws-cloud9/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-cloud9", - "version": "0.32.0", + "version": "0.33.0", "description": "The CDK Construct Library for AWS::Cloud9", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -60,19 +60,19 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "cdk-build-tools": "^0.32.0", - "cfn2ts": "^0.32.0", - "pkglint": "^0.32.0" + "@aws-cdk/assert": "^0.33.0", + "cdk-build-tools": "^0.33.0", + "cfn2ts": "^0.33.0", + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "homepage": "https://github.com/awslabs/aws-cdk", "peerDependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "engines": { "node": ">= 8.10.0" } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cloudformation/README.md b/packages/@aws-cdk/aws-cloudformation/README.md index 6f6367e28b110..d685b021926f2 100644 --- a/packages/@aws-cdk/aws-cloudformation/README.md +++ b/packages/@aws-cdk/aws-cloudformation/README.md @@ -77,7 +77,7 @@ call can be extracted and used in other constructs/resources (creating a real CloudFormation dependency using `Fn::GetAtt` under the hood). The physical id of the custom resource can be specified or derived from the data -return by the API call. +returned by the API call. The `AwsCustomResource` uses the AWS SDK for JavaScript. Services, actions and parameters can be found in the [API documentation](https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/index.html). diff --git a/packages/@aws-cdk/aws-cloudformation/lib/aws-custom-resource.ts b/packages/@aws-cdk/aws-cloudformation/lib/aws-custom-resource.ts index 7a0b7b657a8a8..7243d6a1b1686 100644 --- a/packages/@aws-cdk/aws-cloudformation/lib/aws-custom-resource.ts +++ b/packages/@aws-cdk/aws-cloudformation/lib/aws-custom-resource.ts @@ -123,7 +123,7 @@ export class AwsCustomResource extends cdk.Construct { const provider = new lambda.SingletonFunction(this, 'Provider', { code: lambda.Code.asset(path.join(__dirname, 'aws-custom-resource-provider')), - runtime: lambda.Runtime.NodeJS810, + runtime: lambda.Runtime.NodeJS10x, handler: 'index.handler', uuid: '679f53fa-c002-430c-b0da-5b7982bd2287', lambdaPurpose: 'AWS' diff --git a/packages/@aws-cdk/aws-cloudformation/package-lock.json b/packages/@aws-cdk/aws-cloudformation/package-lock.json index a0c9d0fd3c078..abcce0bbf76e0 100644 --- a/packages/@aws-cdk/aws-cloudformation/package-lock.json +++ b/packages/@aws-cdk/aws-cloudformation/package-lock.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-cloudformation", - "version": "0.32.0", + "version": "0.33.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/@aws-cdk/aws-cloudformation/package.json b/packages/@aws-cdk/aws-cloudformation/package.json index b118926a0cc03..8317909c24ba8 100644 --- a/packages/@aws-cdk/aws-cloudformation/package.json +++ b/packages/@aws-cdk/aws-cloudformation/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-cloudformation", - "version": "0.32.0", + "version": "0.33.0", "description": "CDK Constructs for AWS CloudFormation", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -60,24 +60,24 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "@aws-cdk/aws-events": "^0.32.0", + "@aws-cdk/assert": "^0.33.0", + "@aws-cdk/aws-events": "^0.33.0", "@types/aws-lambda": "^8.10.23", "@types/nock": "^9.3.1", "@types/sinon": "^7.0.10", "aws-sdk-mock": "^4.3.1", - "cdk-build-tools": "^0.32.0", - "cdk-integ-tools": "^0.32.0", - "cfn2ts": "^0.32.0", + "cdk-build-tools": "^0.33.0", + "cdk-integ-tools": "^0.33.0", + "cfn2ts": "^0.33.0", "nock": "^10.0.6", - "pkglint": "^0.32.0", + "pkglint": "^0.33.0", "sinon": "^7.3.1" }, "dependencies": { - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/aws-lambda": "^0.32.0", - "@aws-cdk/aws-sns": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0", + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/aws-lambda": "^0.33.0", + "@aws-cdk/aws-sns": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0", "aws-sdk": "^2.409.0" }, "bundledDependencies": [ @@ -85,10 +85,10 @@ ], "homepage": "https://github.com/awslabs/aws-cdk", "peerDependencies": { - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/aws-lambda": "^0.32.0", - "@aws-cdk/aws-sns": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/aws-lambda": "^0.33.0", + "@aws-cdk/aws-sns": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0" }, "engines": { "node": ">= 8.10.0" @@ -100,4 +100,4 @@ "construct-ctor-props-optional:@aws-cdk/aws-cloudformation.AwsCustomResource" ] } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cloudformation/test/integ.aws-custom-resource.expected.json b/packages/@aws-cdk/aws-cloudformation/test/integ.aws-custom-resource.expected.json index 2ed3d93227ae6..82205b9a038bb 100644 --- a/packages/@aws-cdk/aws-cloudformation/test/integ.aws-custom-resource.expected.json +++ b/packages/@aws-cdk/aws-cloudformation/test/integ.aws-custom-resource.expected.json @@ -160,7 +160,7 @@ "Arn" ] }, - "Runtime": "nodejs8.10" + "Runtime": "nodejs10.x" }, "DependsOn": [ "AWS679f53fac002430cb0da5b7982bd2287ServiceRoleDefaultPolicyD28E1A5E", diff --git a/packages/@aws-cdk/aws-cloudfront/package-lock.json b/packages/@aws-cdk/aws-cloudfront/package-lock.json index 63c46f19b625f..cb2ebcab05037 100644 --- a/packages/@aws-cdk/aws-cloudfront/package-lock.json +++ b/packages/@aws-cdk/aws-cloudfront/package-lock.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-cloudfront", - "version": "0.32.0", + "version": "0.33.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/@aws-cdk/aws-cloudfront/package.json b/packages/@aws-cdk/aws-cloudfront/package.json index 734c7825a2616..c3f1556fc140a 100644 --- a/packages/@aws-cdk/aws-cloudfront/package.json +++ b/packages/@aws-cdk/aws-cloudfront/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-cloudfront", - "version": "0.32.0", + "version": "0.33.0", "description": "CDK Constructs for AWS CloudFront", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -60,29 +60,29 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", + "@aws-cdk/assert": "^0.33.0", "aws-sdk": "^2.438.0", - "cdk-build-tools": "^0.32.0", - "cdk-integ-tools": "^0.32.0", - "cfn2ts": "^0.32.0", - "pkglint": "^0.32.0" + "cdk-build-tools": "^0.33.0", + "cdk-integ-tools": "^0.33.0", + "cfn2ts": "^0.33.0", + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/aws-certificatemanager": "^0.32.0", - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/aws-kms": "^0.32.0", - "@aws-cdk/aws-s3": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/aws-certificatemanager": "^0.33.0", + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/aws-kms": "^0.33.0", + "@aws-cdk/aws-s3": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0" }, "homepage": "https://github.com/awslabs/aws-cdk", "peerDependencies": { - "@aws-cdk/aws-certificatemanager": "^0.32.0", - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/aws-kms": "^0.32.0", - "@aws-cdk/aws-s3": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/aws-certificatemanager": "^0.33.0", + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/aws-kms": "^0.33.0", + "@aws-cdk/aws-s3": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0" }, "engines": { "node": ">= 8.10.0" } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cloudtrail/package-lock.json b/packages/@aws-cdk/aws-cloudtrail/package-lock.json index 98ca4f85cd32d..989dcf73406bb 100644 --- a/packages/@aws-cdk/aws-cloudtrail/package-lock.json +++ b/packages/@aws-cdk/aws-cloudtrail/package-lock.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-cloudtrail", - "version": "0.32.0", + "version": "0.33.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/@aws-cdk/aws-cloudtrail/package.json b/packages/@aws-cdk/aws-cloudtrail/package.json index fd57f29d6775e..dc1548278485e 100644 --- a/packages/@aws-cdk/aws-cloudtrail/package.json +++ b/packages/@aws-cdk/aws-cloudtrail/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-cloudtrail", - "version": "0.32.0", + "version": "0.33.0", "description": "CDK Constructs for AWS CloudTrail", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -60,32 +60,32 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", + "@aws-cdk/assert": "^0.33.0", "aws-sdk": "^2.438.0", - "cdk-build-tools": "^0.32.0", - "cdk-integ-tools": "^0.32.0", - "cfn2ts": "^0.32.0", + "cdk-build-tools": "^0.33.0", + "cdk-integ-tools": "^0.33.0", + "cfn2ts": "^0.33.0", "colors": "^1.3.3", - "pkglint": "^0.32.0" + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/aws-events": "^0.32.0", - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/aws-kms": "^0.32.0", - "@aws-cdk/aws-logs": "^0.32.0", - "@aws-cdk/aws-s3": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/aws-events": "^0.33.0", + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/aws-kms": "^0.33.0", + "@aws-cdk/aws-logs": "^0.33.0", + "@aws-cdk/aws-s3": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0" }, "homepage": "https://github.com/awslabs/aws-cdk", "peerDependencies": { - "@aws-cdk/aws-events": "^0.32.0", - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/aws-kms": "^0.32.0", - "@aws-cdk/aws-logs": "^0.32.0", - "@aws-cdk/aws-s3": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/aws-events": "^0.33.0", + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/aws-kms": "^0.33.0", + "@aws-cdk/aws-logs": "^0.33.0", + "@aws-cdk/aws-s3": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0" }, "engines": { "node": ">= 8.10.0" } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cloudwatch/package.json b/packages/@aws-cdk/aws-cloudwatch/package.json index a5acfaf773e4c..e3ac228ba73d6 100644 --- a/packages/@aws-cdk/aws-cloudwatch/package.json +++ b/packages/@aws-cdk/aws-cloudwatch/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-cloudwatch", - "version": "0.32.0", + "version": "0.33.0", "description": "CDK Constructs for AWS CloudWatch", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -60,22 +60,22 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "cdk-build-tools": "^0.32.0", - "cdk-integ-tools": "^0.32.0", - "cfn2ts": "^0.32.0", - "pkglint": "^0.32.0" + "@aws-cdk/assert": "^0.33.0", + "cdk-build-tools": "^0.33.0", + "cdk-integ-tools": "^0.33.0", + "cfn2ts": "^0.33.0", + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0" }, "homepage": "https://github.com/awslabs/aws-cdk", "peerDependencies": { - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0" }, "engines": { "node": ">= 8.10.0" } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-codebuild/lib/project.ts b/packages/@aws-cdk/aws-codebuild/lib/project.ts index b7535f8af7bb2..7355ce328becc 100644 --- a/packages/@aws-cdk/aws-codebuild/lib/project.ts +++ b/packages/@aws-cdk/aws-codebuild/lib/project.ts @@ -494,6 +494,7 @@ export interface CommonProjectProps { */ readonly allowAllOutbound?: boolean; } + export interface ProjectProps extends CommonProjectProps { /** * The source of the build. @@ -711,6 +712,10 @@ export class Project extends ProjectBase { this.projectName = resource.projectName; this.addToRolePolicy(this.createLoggingPermission()); + + if (props.encryptionKey) { + props.encryptionKey.grantEncryptDecrypt(this); + } } public get securityGroups(): ec2.ISecurityGroup[] { diff --git a/packages/@aws-cdk/aws-codebuild/package-lock.json b/packages/@aws-cdk/aws-codebuild/package-lock.json index d70ea2aa249e6..64934cde32b2e 100644 --- a/packages/@aws-cdk/aws-codebuild/package-lock.json +++ b/packages/@aws-cdk/aws-codebuild/package-lock.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-codebuild", - "version": "0.32.0", + "version": "0.33.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/@aws-cdk/aws-codebuild/package.json b/packages/@aws-cdk/aws-codebuild/package.json index ea844b36048f3..4836f17ebfa33 100644 --- a/packages/@aws-cdk/aws-codebuild/package.json +++ b/packages/@aws-cdk/aws-codebuild/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-codebuild", - "version": "0.32.0", + "version": "0.33.0", "description": "CDK Constructs for AWS CodeBuild", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -64,41 +64,41 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "@aws-cdk/aws-sns": "^0.32.0", - "@aws-cdk/aws-sqs": "^0.32.0", + "@aws-cdk/assert": "^0.33.0", + "@aws-cdk/aws-sns": "^0.33.0", + "@aws-cdk/aws-sqs": "^0.33.0", "aws-sdk": "^2.438.0", - "cdk-build-tools": "^0.32.0", - "cdk-integ-tools": "^0.32.0", - "cfn2ts": "^0.32.0", - "pkglint": "^0.32.0" + "cdk-build-tools": "^0.33.0", + "cdk-integ-tools": "^0.33.0", + "cfn2ts": "^0.33.0", + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/assets": "^0.32.0", - "@aws-cdk/assets-docker": "^0.32.0", - "@aws-cdk/aws-cloudwatch": "^0.32.0", - "@aws-cdk/aws-codecommit": "^0.32.0", - "@aws-cdk/aws-ec2": "^0.32.0", - "@aws-cdk/aws-ecr": "^0.32.0", - "@aws-cdk/aws-events": "^0.32.0", - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/aws-kms": "^0.32.0", - "@aws-cdk/aws-s3": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/assets": "^0.33.0", + "@aws-cdk/assets-docker": "^0.33.0", + "@aws-cdk/aws-cloudwatch": "^0.33.0", + "@aws-cdk/aws-codecommit": "^0.33.0", + "@aws-cdk/aws-ec2": "^0.33.0", + "@aws-cdk/aws-ecr": "^0.33.0", + "@aws-cdk/aws-events": "^0.33.0", + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/aws-kms": "^0.33.0", + "@aws-cdk/aws-s3": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0" }, "homepage": "https://github.com/awslabs/aws-cdk", "peerDependencies": { - "@aws-cdk/assets": "^0.32.0", - "@aws-cdk/assets-docker": "^0.32.0", - "@aws-cdk/aws-cloudwatch": "^0.32.0", - "@aws-cdk/aws-codecommit": "^0.32.0", - "@aws-cdk/aws-ec2": "^0.32.0", - "@aws-cdk/aws-ecr": "^0.32.0", - "@aws-cdk/aws-events": "^0.32.0", - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/aws-kms": "^0.32.0", - "@aws-cdk/aws-s3": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/assets": "^0.33.0", + "@aws-cdk/assets-docker": "^0.33.0", + "@aws-cdk/aws-cloudwatch": "^0.33.0", + "@aws-cdk/aws-codecommit": "^0.33.0", + "@aws-cdk/aws-ec2": "^0.33.0", + "@aws-cdk/aws-ecr": "^0.33.0", + "@aws-cdk/aws-events": "^0.33.0", + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/aws-kms": "^0.33.0", + "@aws-cdk/aws-s3": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0" }, "engines": { "node": ">= 8.10.0" @@ -108,4 +108,4 @@ "construct-ctor-props-optional:@aws-cdk/aws-codebuild.Project" ] } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-codebuild/test/test.codebuild.ts b/packages/@aws-cdk/aws-codebuild/test/test.codebuild.ts index bb4149c8ad9f4..8683696cf804b 100644 --- a/packages/@aws-cdk/aws-codebuild/test/test.codebuild.ts +++ b/packages/@aws-cdk/aws-codebuild/test/test.codebuild.ts @@ -1,6 +1,7 @@ import { expect, haveResource, haveResourceLike } from '@aws-cdk/assert'; import codecommit = require('@aws-cdk/aws-codecommit'); import ec2 = require('@aws-cdk/aws-ec2'); +import kms = require('@aws-cdk/aws-kms'); import s3 = require('@aws-cdk/aws-s3'); import cdk = require('@aws-cdk/cdk'); import { Test } from 'nodeunit'; @@ -714,7 +715,47 @@ export = { }) , /Configure 'allowAllOutbound' directly on the supplied SecurityGroup/); test.done(); - } + }, + + 'with a KMS Key adds decrypt permissions to the CodeBuild Role'(test: Test) { + const stack = new cdk.Stack(); + + const key = new kms.Key(stack, 'MyKey'); + + new codebuild.PipelineProject(stack, 'MyProject', { + encryptionKey: key, + }); + + expect(stack).to(haveResourceLike('AWS::IAM::Policy', { + "PolicyDocument": { + "Statement": [ + {}, // CloudWatch logs + { + "Action": [ + "kms:Decrypt", + "kms:Encrypt", + "kms:ReEncrypt*", + "kms:GenerateDataKey*", + ], + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "MyKey6AB29FA6", + "Arn", + ], + }, + }, + ], + }, + "Roles": [ + { + "Ref": "MyProjectRole9BBE5233", + }, + ], + })); + + test.done(); + }, }, 'using timeout and path in S3 artifacts sets it correctly'(test: Test) { diff --git a/packages/@aws-cdk/aws-codecommit/package-lock.json b/packages/@aws-cdk/aws-codecommit/package-lock.json index 915f066b2a580..4ac4731431d12 100644 --- a/packages/@aws-cdk/aws-codecommit/package-lock.json +++ b/packages/@aws-cdk/aws-codecommit/package-lock.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-codecommit", - "version": "0.32.0", + "version": "0.33.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/@aws-cdk/aws-codecommit/package.json b/packages/@aws-cdk/aws-codecommit/package.json index 9db310ed191e7..66028ba7dc9c7 100644 --- a/packages/@aws-cdk/aws-codecommit/package.json +++ b/packages/@aws-cdk/aws-codecommit/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-codecommit", - "version": "0.32.0", + "version": "0.33.0", "description": "CDK Constructs for AWS CodeCommit", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -65,26 +65,26 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "@aws-cdk/aws-sns": "^0.32.0", + "@aws-cdk/assert": "^0.33.0", + "@aws-cdk/aws-sns": "^0.33.0", "aws-sdk": "^2.438.0", - "cdk-build-tools": "^0.32.0", - "cdk-integ-tools": "^0.32.0", - "cfn2ts": "^0.32.0", - "pkglint": "^0.32.0" + "cdk-build-tools": "^0.33.0", + "cdk-integ-tools": "^0.33.0", + "cfn2ts": "^0.33.0", + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/aws-events": "^0.32.0", - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/aws-events": "^0.33.0", + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0" }, "homepage": "https://github.com/awslabs/aws-cdk", "peerDependencies": { - "@aws-cdk/aws-events": "^0.32.0", - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/aws-events": "^0.33.0", + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0" }, "engines": { "node": ">= 8.10.0" } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-codedeploy-api/.gitignore b/packages/@aws-cdk/aws-codedeploy-api/.gitignore deleted file mode 100644 index 5433c34b70acc..0000000000000 --- a/packages/@aws-cdk/aws-codedeploy-api/.gitignore +++ /dev/null @@ -1,16 +0,0 @@ -*.js -*.js.map -*.d.ts -tsconfig.json -tslint.json -node_modules -*.generated.ts -dist -.jsii - -.LAST_BUILD -.nyc_output -coverage -.nycrc -.LAST_PACKAGE -*.snk \ No newline at end of file diff --git a/packages/@aws-cdk/aws-codedeploy-api/.npmignore b/packages/@aws-cdk/aws-codedeploy-api/.npmignore deleted file mode 100644 index f5a63a96df103..0000000000000 --- a/packages/@aws-cdk/aws-codedeploy-api/.npmignore +++ /dev/null @@ -1,18 +0,0 @@ -# Don't include original .ts files when doing `npm pack` -*.ts -!*.d.ts -coverage -.nyc_output -*.tgz - -dist -.LAST_PACKAGE -.LAST_BUILD -!*.js - -# Include .jsii -!.jsii - -*.snk - -*.tsbuildinfo diff --git a/packages/@aws-cdk/aws-codedeploy-api/LICENSE b/packages/@aws-cdk/aws-codedeploy-api/LICENSE deleted file mode 100644 index 46c185646b439..0000000000000 --- a/packages/@aws-cdk/aws-codedeploy-api/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2018-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/packages/@aws-cdk/aws-codedeploy-api/NOTICE b/packages/@aws-cdk/aws-codedeploy-api/NOTICE deleted file mode 100644 index 8585168af8b7d..0000000000000 --- a/packages/@aws-cdk/aws-codedeploy-api/NOTICE +++ /dev/null @@ -1,2 +0,0 @@ -AWS Cloud Development Kit (AWS CDK) -Copyright 2018-2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. diff --git a/packages/@aws-cdk/aws-codedeploy-api/README.md b/packages/@aws-cdk/aws-codedeploy-api/README.md deleted file mode 100644 index bb1edb95bb0ff..0000000000000 --- a/packages/@aws-cdk/aws-codedeploy-api/README.md +++ /dev/null @@ -1,5 +0,0 @@ -## AWS CodeDeploy Load Balancing API - -This package has been deprecated, -and will be removed in a future release of the Cloud Development Kit. -Please remove if from your dependencies. diff --git a/packages/@aws-cdk/aws-codedeploy-api/lib/index.ts b/packages/@aws-cdk/aws-codedeploy-api/lib/index.ts deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/packages/@aws-cdk/aws-codedeploy-api/package.json b/packages/@aws-cdk/aws-codedeploy-api/package.json deleted file mode 100644 index 1efd777bda72f..0000000000000 --- a/packages/@aws-cdk/aws-codedeploy-api/package.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "name": "@aws-cdk/aws-codedeploy-api", - "version": "0.32.0", - "description": "Load Balancer API for AWS CodeDeploy", - "deprecated": "This package is now obsololete, please remove it from your dependencies", - "main": "lib/index.js", - "types": "lib/index.d.ts", - "jsii": { - "outdir": "dist", - "targets": { - "java": { - "package": "software.amazon.awscdk.services.codedeploy.api", - "maven": { - "groupId": "software.amazon.awscdk", - "artifactId": "codedeploy-api" - } - }, - "dotnet": { - "namespace": "Amazon.CDK.AWS.CodeDeploy.Api", - "packageId": "Amazon.CDK.AWS.CodeDeploy.Api", - "signAssembly": true, - "assemblyOriginatorKeyFile": "../../key.snk" - }, - "python": { - "distName": "aws-cdk.aws-codedeploy-api", - "module": "aws_cdk.aws_codedeploy_api" - } - } - }, - "repository": { - "type": "git", - "url": "https://github.com/awslabs/aws-cdk.git", - "directory": "packages/@aws-cdk/aws-codedeploy-api" - }, - "scripts": { - "build": "cdk-build", - "watch": "cdk-watch", - "lint": "cdk-lint", - "test": "cdk-test", - "integ": "cdk-integ", - "pkglint": "pkglint -f", - "package": "cdk-package", - "awslint": "cdk-awslint", - "build+test+package": "npm run build+test && npm run package", - "build+test": "npm run build && npm test" - }, - "keywords": [ - "aws", - "cdk", - "constructs", - "codedeploy" - ], - "author": { - "name": "Amazon Web Services", - "url": "https://aws.amazon.com", - "organization": true - }, - "license": "Apache-2.0", - "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "cdk-build-tools": "^0.32.0", - "cfn2ts": "^0.32.0", - "pkglint": "^0.32.0" - }, - "dependencies": { - "@aws-cdk/cdk": "^0.32.0" - }, - "homepage": "https://github.com/awslabs/aws-cdk", - "engines": { - "node": ">= 8.10.0" - }, - "peerDependencies": { - "@aws-cdk/cdk": "^0.32.0" - } -} diff --git a/packages/@aws-cdk/aws-codedeploy/package.json b/packages/@aws-cdk/aws-codedeploy/package.json index 9914fe8504d1b..b8452d3840167 100644 --- a/packages/@aws-cdk/aws-codedeploy/package.json +++ b/packages/@aws-cdk/aws-codedeploy/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-codedeploy", - "version": "0.32.0", + "version": "0.33.0", "description": "The CDK Construct Library for AWS::CodeDeploy", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -63,33 +63,33 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "@aws-cdk/aws-ec2": "^0.32.0", - "cdk-build-tools": "^0.32.0", - "cdk-integ-tools": "^0.32.0", - "cfn2ts": "^0.32.0", - "pkglint": "^0.32.0" + "@aws-cdk/assert": "^0.33.0", + "@aws-cdk/aws-ec2": "^0.33.0", + "cdk-build-tools": "^0.33.0", + "cdk-integ-tools": "^0.33.0", + "cfn2ts": "^0.33.0", + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/aws-autoscaling": "^0.32.0", - "@aws-cdk/aws-cloudwatch": "^0.32.0", - "@aws-cdk/aws-elasticloadbalancing": "^0.32.0", - "@aws-cdk/aws-elasticloadbalancingv2": "^0.32.0", - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/aws-lambda": "^0.32.0", - "@aws-cdk/aws-s3": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/aws-autoscaling": "^0.33.0", + "@aws-cdk/aws-cloudwatch": "^0.33.0", + "@aws-cdk/aws-elasticloadbalancing": "^0.33.0", + "@aws-cdk/aws-elasticloadbalancingv2": "^0.33.0", + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/aws-lambda": "^0.33.0", + "@aws-cdk/aws-s3": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0" }, "homepage": "https://github.com/awslabs/aws-cdk", "peerDependencies": { - "@aws-cdk/aws-autoscaling": "^0.32.0", - "@aws-cdk/aws-cloudwatch": "^0.32.0", - "@aws-cdk/aws-elasticloadbalancing": "^0.32.0", - "@aws-cdk/aws-elasticloadbalancingv2": "^0.32.0", - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/aws-lambda": "^0.32.0", - "@aws-cdk/aws-s3": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/aws-autoscaling": "^0.33.0", + "@aws-cdk/aws-cloudwatch": "^0.33.0", + "@aws-cdk/aws-elasticloadbalancing": "^0.33.0", + "@aws-cdk/aws-elasticloadbalancingv2": "^0.33.0", + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/aws-lambda": "^0.33.0", + "@aws-cdk/aws-s3": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0" }, "engines": { "node": ">= 8.10.0" @@ -100,4 +100,4 @@ "resource-interface-extends-resource:@aws-cdk/aws-codedeploy.IServerDeploymentConfig" ] } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-codepipeline-actions/package-lock.json b/packages/@aws-cdk/aws-codepipeline-actions/package-lock.json index 1f581382c7d21..2f2c949d93bc5 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/package-lock.json +++ b/packages/@aws-cdk/aws-codepipeline-actions/package-lock.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-codepipeline-actions", - "version": "0.32.0", + "version": "0.33.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/@aws-cdk/aws-codepipeline-actions/package.json b/packages/@aws-cdk/aws-codepipeline-actions/package.json index a235b2301dbe0..9eb5090cf8860 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/package.json +++ b/packages/@aws-cdk/aws-codepipeline-actions/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-codepipeline-actions", - "version": "0.32.0", + "version": "0.33.0", "description": "Concrete Actions for AWS Code Pipeline", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -62,50 +62,50 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "@aws-cdk/aws-cloudtrail": "^0.32.0", + "@aws-cdk/assert": "^0.33.0", + "@aws-cdk/aws-cloudtrail": "^0.33.0", "@types/lodash": "^4.14.123", - "cdk-build-tools": "^0.32.0", - "cdk-integ-tools": "^0.32.0", + "cdk-build-tools": "^0.33.0", + "cdk-integ-tools": "^0.33.0", "lodash": "^4.17.11", - "pkglint": "^0.32.0" + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/aws-cloudformation": "^0.32.0", - "@aws-cdk/aws-codebuild": "^0.32.0", - "@aws-cdk/aws-codecommit": "^0.32.0", - "@aws-cdk/aws-codedeploy": "^0.32.0", - "@aws-cdk/aws-codepipeline": "^0.32.0", - "@aws-cdk/aws-ec2": "^0.32.0", - "@aws-cdk/aws-ecr": "^0.32.0", - "@aws-cdk/aws-ecs": "^0.32.0", - "@aws-cdk/aws-events": "^0.32.0", - "@aws-cdk/aws-events-targets": "^0.32.0", - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/aws-lambda": "^0.32.0", - "@aws-cdk/aws-s3": "^0.32.0", - "@aws-cdk/aws-sns": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/aws-cloudformation": "^0.33.0", + "@aws-cdk/aws-codebuild": "^0.33.0", + "@aws-cdk/aws-codecommit": "^0.33.0", + "@aws-cdk/aws-codedeploy": "^0.33.0", + "@aws-cdk/aws-codepipeline": "^0.33.0", + "@aws-cdk/aws-ec2": "^0.33.0", + "@aws-cdk/aws-ecr": "^0.33.0", + "@aws-cdk/aws-ecs": "^0.33.0", + "@aws-cdk/aws-events": "^0.33.0", + "@aws-cdk/aws-events-targets": "^0.33.0", + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/aws-lambda": "^0.33.0", + "@aws-cdk/aws-s3": "^0.33.0", + "@aws-cdk/aws-sns": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0" }, "homepage": "https://github.com/awslabs/aws-cdk", "peerDependencies": { - "@aws-cdk/aws-cloudformation": "^0.32.0", - "@aws-cdk/aws-codebuild": "^0.32.0", - "@aws-cdk/aws-codecommit": "^0.32.0", - "@aws-cdk/aws-codedeploy": "^0.32.0", - "@aws-cdk/aws-codepipeline": "^0.32.0", - "@aws-cdk/aws-ec2": "^0.32.0", - "@aws-cdk/aws-ecr": "^0.32.0", - "@aws-cdk/aws-ecs": "^0.32.0", - "@aws-cdk/aws-events": "^0.32.0", - "@aws-cdk/aws-events-targets": "^0.32.0", - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/aws-lambda": "^0.32.0", - "@aws-cdk/aws-s3": "^0.32.0", - "@aws-cdk/aws-sns": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/aws-cloudformation": "^0.33.0", + "@aws-cdk/aws-codebuild": "^0.33.0", + "@aws-cdk/aws-codecommit": "^0.33.0", + "@aws-cdk/aws-codedeploy": "^0.33.0", + "@aws-cdk/aws-codepipeline": "^0.33.0", + "@aws-cdk/aws-ec2": "^0.33.0", + "@aws-cdk/aws-ecr": "^0.33.0", + "@aws-cdk/aws-ecs": "^0.33.0", + "@aws-cdk/aws-events": "^0.33.0", + "@aws-cdk/aws-events-targets": "^0.33.0", + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/aws-lambda": "^0.33.0", + "@aws-cdk/aws-s3": "^0.33.0", + "@aws-cdk/aws-sns": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0" }, "engines": { "node": ">= 8.10.0" } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-codepipeline/package.json b/packages/@aws-cdk/aws-codepipeline/package.json index 4cb49a2247b30..be261e17c6d6b 100644 --- a/packages/@aws-cdk/aws-codepipeline/package.json +++ b/packages/@aws-cdk/aws-codepipeline/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-codepipeline", - "version": "0.32.0", + "version": "0.33.0", "description": "Better interface to AWS Code Pipeline", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -67,26 +67,26 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "cdk-build-tools": "^0.32.0", - "cdk-integ-tools": "^0.32.0", - "cfn2ts": "^0.32.0", - "pkglint": "^0.32.0" + "@aws-cdk/assert": "^0.33.0", + "cdk-build-tools": "^0.33.0", + "cdk-integ-tools": "^0.33.0", + "cfn2ts": "^0.33.0", + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/aws-events": "^0.32.0", - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/aws-kms": "^0.32.0", - "@aws-cdk/aws-s3": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/aws-events": "^0.33.0", + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/aws-kms": "^0.33.0", + "@aws-cdk/aws-s3": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0" }, "homepage": "https://github.com/awslabs/aws-cdk", "peerDependencies": { - "@aws-cdk/aws-events": "^0.32.0", - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/aws-kms": "^0.32.0", - "@aws-cdk/aws-s3": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/aws-events": "^0.33.0", + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/aws-kms": "^0.33.0", + "@aws-cdk/aws-s3": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0" }, "engines": { "node": ">= 8.10.0" @@ -100,4 +100,4 @@ "resource-attribute:@aws-cdk/aws-codepipeline.IPipeline.pipelineVersion" ] } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cognito/package.json b/packages/@aws-cdk/aws-cognito/package.json index 6703d52887eac..3318d3f0fe88b 100644 --- a/packages/@aws-cdk/aws-cognito/package.json +++ b/packages/@aws-cdk/aws-cognito/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-cognito", - "version": "0.32.0", + "version": "0.33.0", "description": "The CDK Construct Library for AWS::Cognito", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -60,21 +60,21 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "cdk-build-tools": "^0.32.0", - "cfn2ts": "^0.32.0", - "pkglint": "^0.32.0" + "@aws-cdk/assert": "^0.33.0", + "cdk-build-tools": "^0.33.0", + "cfn2ts": "^0.33.0", + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/aws-lambda": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/aws-lambda": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0" }, "homepage": "https://github.com/awslabs/aws-cdk", "peerDependencies": { - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/aws-lambda": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/aws-lambda": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0" }, "engines": { "node": ">= 8.10.0" @@ -85,4 +85,4 @@ "from-arn:UserPool.fromUserPoolArn" ] } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-config/package.json b/packages/@aws-cdk/aws-config/package.json index a4c1221c784a5..3e635995c7560 100644 --- a/packages/@aws-cdk/aws-config/package.json +++ b/packages/@aws-cdk/aws-config/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-config", - "version": "0.32.0", + "version": "0.33.0", "description": "The CDK Construct Library for AWS::Config", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -60,29 +60,29 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "@aws-cdk/aws-events-targets": "^0.32.0", - "cdk-build-tools": "^0.32.0", - "cdk-integ-tools": "^0.32.0", - "cfn2ts": "^0.32.0", - "pkglint": "^0.32.0" + "@aws-cdk/assert": "^0.33.0", + "@aws-cdk/aws-events-targets": "^0.33.0", + "cdk-build-tools": "^0.33.0", + "cdk-integ-tools": "^0.33.0", + "cfn2ts": "^0.33.0", + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/aws-events": "^0.32.0", - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/aws-lambda": "^0.32.0", - "@aws-cdk/aws-sns": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/aws-events": "^0.33.0", + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/aws-lambda": "^0.33.0", + "@aws-cdk/aws-sns": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0" }, "homepage": "https://github.com/awslabs/aws-cdk", "peerDependencies": { - "@aws-cdk/aws-events": "^0.32.0", - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/aws-lambda": "^0.32.0", - "@aws-cdk/aws-sns": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/aws-events": "^0.33.0", + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/aws-lambda": "^0.33.0", + "@aws-cdk/aws-sns": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0" }, "engines": { "node": ">= 8.10.0" } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-datapipeline/package.json b/packages/@aws-cdk/aws-datapipeline/package.json index d110c0106baa5..69a806e679348 100644 --- a/packages/@aws-cdk/aws-datapipeline/package.json +++ b/packages/@aws-cdk/aws-datapipeline/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-datapipeline", - "version": "0.32.0", + "version": "0.33.0", "description": "The CDK Construct Library for AWS::DataPipeline", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -60,19 +60,19 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "cdk-build-tools": "^0.32.0", - "cfn2ts": "^0.32.0", - "pkglint": "^0.32.0" + "@aws-cdk/assert": "^0.33.0", + "cdk-build-tools": "^0.33.0", + "cfn2ts": "^0.33.0", + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "homepage": "https://github.com/awslabs/aws-cdk", "peerDependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "engines": { "node": ">= 8.10.0" } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-dax/package.json b/packages/@aws-cdk/aws-dax/package.json index ca4cd0c8faf22..9aaf524e32684 100644 --- a/packages/@aws-cdk/aws-dax/package.json +++ b/packages/@aws-cdk/aws-dax/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-dax", - "version": "0.32.0", + "version": "0.33.0", "description": "The CDK Construct Library for AWS::DAX", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -60,19 +60,19 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "cdk-build-tools": "^0.32.0", - "cfn2ts": "^0.32.0", - "pkglint": "^0.32.0" + "@aws-cdk/assert": "^0.33.0", + "cdk-build-tools": "^0.33.0", + "cfn2ts": "^0.33.0", + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "homepage": "https://github.com/awslabs/aws-cdk", "peerDependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "engines": { "node": ">= 8.10.0" } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-directoryservice/package.json b/packages/@aws-cdk/aws-directoryservice/package.json index 68dd6b308af16..bc84eccf634c1 100644 --- a/packages/@aws-cdk/aws-directoryservice/package.json +++ b/packages/@aws-cdk/aws-directoryservice/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-directoryservice", - "version": "0.32.0", + "version": "0.33.0", "description": "The CDK Construct Library for AWS::DirectoryService", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -60,19 +60,19 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "cdk-build-tools": "^0.32.0", - "cfn2ts": "^0.32.0", - "pkglint": "^0.32.0" + "@aws-cdk/assert": "^0.33.0", + "cdk-build-tools": "^0.33.0", + "cfn2ts": "^0.33.0", + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "homepage": "https://github.com/awslabs/aws-cdk", "peerDependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "engines": { "node": ">= 8.10.0" } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-dlm/package.json b/packages/@aws-cdk/aws-dlm/package.json index cc4f4547acbb3..96c5ddaddb114 100644 --- a/packages/@aws-cdk/aws-dlm/package.json +++ b/packages/@aws-cdk/aws-dlm/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-dlm", - "version": "0.32.0", + "version": "0.33.0", "description": "The CDK Construct Library for AWS::DLM", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -61,18 +61,18 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "cdk-build-tools": "^0.32.0", - "cfn2ts": "^0.32.0", - "pkglint": "^0.32.0" + "@aws-cdk/assert": "^0.33.0", + "cdk-build-tools": "^0.33.0", + "cfn2ts": "^0.33.0", + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "peerDependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "engines": { "node": ">= 8.10.0" } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-dms/package.json b/packages/@aws-cdk/aws-dms/package.json index 67e0e62c4fde9..c079f110ad6af 100644 --- a/packages/@aws-cdk/aws-dms/package.json +++ b/packages/@aws-cdk/aws-dms/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-dms", - "version": "0.32.0", + "version": "0.33.0", "description": "The CDK Construct Library for AWS::DMS", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -60,19 +60,19 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "cdk-build-tools": "^0.32.0", - "cfn2ts": "^0.32.0", - "pkglint": "^0.32.0" + "@aws-cdk/assert": "^0.33.0", + "cdk-build-tools": "^0.33.0", + "cfn2ts": "^0.33.0", + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "homepage": "https://github.com/awslabs/aws-cdk", "peerDependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "engines": { "node": ">= 8.10.0" } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-docdb/package.json b/packages/@aws-cdk/aws-docdb/package.json index 14479909344ef..759e64ff5a018 100644 --- a/packages/@aws-cdk/aws-docdb/package.json +++ b/packages/@aws-cdk/aws-docdb/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-docdb", - "version": "0.32.0", + "version": "0.33.0", "description": "The CDK Construct Library for AWS::DocDB", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -62,18 +62,18 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "cdk-build-tools": "^0.32.0", - "cfn2ts": "^0.32.0", - "pkglint": "^0.32.0" + "@aws-cdk/assert": "^0.33.0", + "cdk-build-tools": "^0.33.0", + "cfn2ts": "^0.33.0", + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "peerDependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "engines": { "node": ">= 8.10.0" } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-dynamodb-global/lambda-packages/aws-global-table-coordinator/package-lock.json b/packages/@aws-cdk/aws-dynamodb-global/lambda-packages/aws-global-table-coordinator/package-lock.json index ca0ca5c7743fa..f9cbf49d89136 100644 --- a/packages/@aws-cdk/aws-dynamodb-global/lambda-packages/aws-global-table-coordinator/package-lock.json +++ b/packages/@aws-cdk/aws-dynamodb-global/lambda-packages/aws-global-table-coordinator/package-lock.json @@ -1,6 +1,6 @@ { "name": "aws-global-lambda-coordinator", - "version": "0.31.0", + "version": "0.33.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/@aws-cdk/aws-dynamodb-global/lambda-packages/aws-global-table-coordinator/package.json b/packages/@aws-cdk/aws-dynamodb-global/lambda-packages/aws-global-table-coordinator/package.json index 6b10739ab2e59..2c9980418153c 100644 --- a/packages/@aws-cdk/aws-dynamodb-global/lambda-packages/aws-global-table-coordinator/package.json +++ b/packages/@aws-cdk/aws-dynamodb-global/lambda-packages/aws-global-table-coordinator/package.json @@ -1,7 +1,7 @@ { "name": "aws-global-lambda-coordinator", "private": true, - "version": "0.32.0", + "version": "0.33.0", "description": "This module is part of the [AWS Cloud Development Kit](https://github.com/awslabs/aws-cdk) project.", "main": "lib/handler.js", "directories": { diff --git a/packages/@aws-cdk/aws-dynamodb-global/package.json b/packages/@aws-cdk/aws-dynamodb-global/package.json index c32f5749ef056..027d039b6bc17 100644 --- a/packages/@aws-cdk/aws-dynamodb-global/package.json +++ b/packages/@aws-cdk/aws-dynamodb-global/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-dynamodb-global", - "version": "0.32.0", + "version": "0.33.0", "description": "Build a global dynamodb table", "license": "Apache-2.0", "homepage": "https://github.com/awslabs/aws-cdk", @@ -44,25 +44,25 @@ "global" ], "dependencies": { - "@aws-cdk/aws-cloudformation": "^0.32.0", - "@aws-cdk/aws-dynamodb": "^0.32.0", - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/aws-lambda": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/aws-cloudformation": "^0.33.0", + "@aws-cdk/aws-dynamodb": "^0.33.0", + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/aws-lambda": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0" }, "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "cdk-build-tools": "^0.32.0", - "cdk-integ-tools": "^0.32.0", - "cfn2ts": "^0.32.0", - "pkglint": "^0.32.0" + "@aws-cdk/assert": "^0.33.0", + "cdk-build-tools": "^0.33.0", + "cdk-integ-tools": "^0.33.0", + "cfn2ts": "^0.33.0", + "pkglint": "^0.33.0" }, "peerDependencies": { - "@aws-cdk/aws-cloudformation": "^0.32.0", - "@aws-cdk/aws-dynamodb": "^0.32.0", - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/aws-lambda": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/aws-cloudformation": "^0.33.0", + "@aws-cdk/aws-dynamodb": "^0.33.0", + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/aws-lambda": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0" }, "scripts": { "build": "cdk-build", @@ -82,4 +82,4 @@ }, "main": "lib/index.js", "types": "lib/index.d.ts" -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-dynamodb/package.json b/packages/@aws-cdk/aws-dynamodb/package.json index 69e129d42b763..4a0d21bf6533e 100644 --- a/packages/@aws-cdk/aws-dynamodb/package.json +++ b/packages/@aws-cdk/aws-dynamodb/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-dynamodb", - "version": "0.32.0", + "version": "0.33.0", "description": "CDK Constructs for AWS DynamoDB", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -60,24 +60,24 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "cdk-build-tools": "^0.32.0", - "cdk-integ-tools": "^0.32.0", - "cfn2ts": "^0.32.0", - "pkglint": "^0.32.0" + "@aws-cdk/assert": "^0.33.0", + "cdk-build-tools": "^0.33.0", + "cdk-integ-tools": "^0.33.0", + "cfn2ts": "^0.33.0", + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/aws-applicationautoscaling": "^0.32.0", - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/aws-applicationautoscaling": "^0.33.0", + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0" }, "homepage": "https://github.com/awslabs/aws-cdk", "peerDependencies": { - "@aws-cdk/aws-applicationautoscaling": "^0.32.0", - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/aws-applicationautoscaling": "^0.33.0", + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0" }, "engines": { "node": ">= 8.10.0" } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ec2/lib/vpc.ts b/packages/@aws-cdk/aws-ec2/lib/vpc.ts index 32cabbf516343..4d070293caff2 100644 --- a/packages/@aws-cdk/aws-ec2/lib/vpc.ts +++ b/packages/@aws-cdk/aws-ec2/lib/vpc.ts @@ -1302,23 +1302,25 @@ function describeSelection(placement: SubnetSelection): string { class CompositeDependable implements IDependable { private readonly dependables = new Array(); + constructor() { + const self = this; + cdk.DependableTrait.implement(this, { + get dependencyRoots() { + const ret = []; + for (const dep of self.dependables) { + ret.push(...cdk.DependableTrait.get(dep).dependencyRoots); + } + return ret; + } + }); + } + /** * Add a construct to the dependency roots */ public add(dep: IDependable) { this.dependables.push(dep); } - - /** - * Retrieve the current set of dependency roots - */ - public get dependencyRoots(): IConstruct[] { - const ret = []; - for (const dep of this.dependables) { - ret.push(...dep.dependencyRoots); - } - return ret; - } } /** diff --git a/packages/@aws-cdk/aws-ec2/package.json b/packages/@aws-cdk/aws-ec2/package.json index e5eb5b907975f..a8d3bc5b2621e 100644 --- a/packages/@aws-cdk/aws-ec2/package.json +++ b/packages/@aws-cdk/aws-ec2/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-ec2", - "version": "0.32.0", + "version": "0.33.0", "description": "CDK Constructs for AWS EC2", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -60,24 +60,24 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "cdk-build-tools": "^0.32.0", - "cdk-integ-tools": "^0.32.0", - "cfn2ts": "^0.32.0", - "pkglint": "^0.32.0" + "@aws-cdk/assert": "^0.33.0", + "cdk-build-tools": "^0.33.0", + "cdk-integ-tools": "^0.33.0", + "cfn2ts": "^0.33.0", + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/aws-cloudwatch": "^0.32.0", - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0", - "@aws-cdk/cx-api": "^0.32.0" + "@aws-cdk/aws-cloudwatch": "^0.33.0", + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0", + "@aws-cdk/cx-api": "^0.33.0" }, "homepage": "https://github.com/awslabs/aws-cdk", "peerDependencies": { - "@aws-cdk/aws-cloudwatch": "^0.32.0", - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0", - "@aws-cdk/cx-api": "^0.32.0" + "@aws-cdk/aws-cloudwatch": "^0.33.0", + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0", + "@aws-cdk/cx-api": "^0.33.0" }, "engines": { "node": ">= 8.10.0" @@ -87,4 +87,4 @@ "resource-attribute:@aws-cdk/aws-ec2.ISecurityGroup.securityGroupVpcId" ] } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ecr/package.json b/packages/@aws-cdk/aws-ecr/package.json index 3f54fc7ca3a5f..e0370479b0234 100644 --- a/packages/@aws-cdk/aws-ecr/package.json +++ b/packages/@aws-cdk/aws-ecr/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-ecr", - "version": "0.32.0", + "version": "0.33.0", "description": "The CDK Construct Library for AWS::ECR", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -64,22 +64,22 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "cdk-build-tools": "^0.32.0", - "cdk-integ-tools": "^0.32.0", - "cfn2ts": "^0.32.0", - "pkglint": "^0.32.0" + "@aws-cdk/assert": "^0.33.0", + "cdk-build-tools": "^0.33.0", + "cdk-integ-tools": "^0.33.0", + "cfn2ts": "^0.33.0", + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/aws-events": "^0.32.0", - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/aws-events": "^0.33.0", + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0" }, "homepage": "https://github.com/awslabs/aws-cdk", "peerDependencies": { - "@aws-cdk/aws-events": "^0.32.0", - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/aws-events": "^0.33.0", + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0" }, "engines": { "node": ">= 8.10.0" @@ -90,4 +90,4 @@ "construct-base-is-private:@aws-cdk/aws-ecr.RepositoryBase" ] } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ecs-patterns/lib/ecs/scheduled-ecs-task.ts b/packages/@aws-cdk/aws-ecs-patterns/lib/ecs/scheduled-ecs-task.ts index cce306f82589f..6f28112031fab 100644 --- a/packages/@aws-cdk/aws-ecs-patterns/lib/ecs/scheduled-ecs-task.ts +++ b/packages/@aws-cdk/aws-ecs-patterns/lib/ecs/scheduled-ecs-task.ts @@ -98,7 +98,7 @@ export class ScheduledEc2Task extends cdk.Construct { }); // Use Ec2TaskEventRuleTarget as the target of the EventRule - const eventRuleTarget = new eventsTargets.EcsEc2Task( { + const eventRuleTarget = new eventsTargets.EcsTask( { cluster: props.cluster, taskDefinition, taskCount: props.desiredTaskCount diff --git a/packages/@aws-cdk/aws-ecs-patterns/package-lock.json b/packages/@aws-cdk/aws-ecs-patterns/package-lock.json index 79013c038f62c..b121426930f03 100644 --- a/packages/@aws-cdk/aws-ecs-patterns/package-lock.json +++ b/packages/@aws-cdk/aws-ecs-patterns/package-lock.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-ecs-patterns", - "version": "0.32.0", + "version": "0.33.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/@aws-cdk/aws-ecs-patterns/package.json b/packages/@aws-cdk/aws-ecs-patterns/package.json index 353bec5f84515..3fa2fdc02ef65 100644 --- a/packages/@aws-cdk/aws-ecs-patterns/package.json +++ b/packages/@aws-cdk/aws-ecs-patterns/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-ecs-patterns", - "version": "0.32.0", + "version": "0.33.0", "description": "CDK Constructs for AWS ECS", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -58,43 +58,43 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "cdk-build-tools": "^0.32.0", - "cdk-integ-tools": "^0.32.0", - "cfn2ts": "^0.32.0", + "@aws-cdk/assert": "^0.33.0", + "cdk-build-tools": "^0.33.0", + "cdk-integ-tools": "^0.33.0", + "cfn2ts": "^0.33.0", "jest": "^24.7.1", - "pkglint": "^0.32.0" + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/aws-applicationautoscaling": "^0.32.0", - "@aws-cdk/aws-certificatemanager": "^0.32.0", - "@aws-cdk/aws-ec2": "^0.32.0", - "@aws-cdk/aws-ecs": "^0.32.0", - "@aws-cdk/aws-elasticloadbalancingv2": "^0.32.0", - "@aws-cdk/aws-events": "^0.32.0", - "@aws-cdk/aws-events-targets": "^0.32.0", - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/aws-route53": "^0.32.0", - "@aws-cdk/aws-route53-targets": "^0.32.0", - "@aws-cdk/aws-sqs": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/aws-applicationautoscaling": "^0.33.0", + "@aws-cdk/aws-certificatemanager": "^0.33.0", + "@aws-cdk/aws-ec2": "^0.33.0", + "@aws-cdk/aws-ecs": "^0.33.0", + "@aws-cdk/aws-elasticloadbalancingv2": "^0.33.0", + "@aws-cdk/aws-events": "^0.33.0", + "@aws-cdk/aws-events-targets": "^0.33.0", + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/aws-route53": "^0.33.0", + "@aws-cdk/aws-route53-targets": "^0.33.0", + "@aws-cdk/aws-sqs": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0" }, "homepage": "https://github.com/awslabs/aws-cdk", "peerDependencies": { - "@aws-cdk/aws-applicationautoscaling": "^0.32.0", - "@aws-cdk/aws-certificatemanager": "^0.32.0", - "@aws-cdk/aws-ec2": "^0.32.0", - "@aws-cdk/aws-ecs": "^0.32.0", - "@aws-cdk/aws-elasticloadbalancingv2": "^0.32.0", - "@aws-cdk/aws-events": "^0.32.0", - "@aws-cdk/aws-events-targets": "^0.32.0", - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/aws-route53": "^0.32.0", - "@aws-cdk/aws-route53-targets": "^0.32.0", - "@aws-cdk/aws-sqs": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/aws-applicationautoscaling": "^0.33.0", + "@aws-cdk/aws-certificatemanager": "^0.33.0", + "@aws-cdk/aws-ec2": "^0.33.0", + "@aws-cdk/aws-ecs": "^0.33.0", + "@aws-cdk/aws-elasticloadbalancingv2": "^0.33.0", + "@aws-cdk/aws-events": "^0.33.0", + "@aws-cdk/aws-events-targets": "^0.33.0", + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/aws-route53": "^0.33.0", + "@aws-cdk/aws-route53-targets": "^0.33.0", + "@aws-cdk/aws-sqs": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0" }, "engines": { "node": ">= 8.10.0" } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ecs/README.md b/packages/@aws-cdk/aws-ecs/README.md index 881765847dce0..15bf2cb0fa3f8 100644 --- a/packages/@aws-cdk/aws-ecs/README.md +++ b/packages/@aws-cdk/aws-ecs/README.md @@ -287,7 +287,7 @@ you can configure on your instances. ## Integration with CloudWatch Events To start an Amazon ECS task on an Amazon EC2-backed Cluster, instantiate an -`@aws-cdk/aws-events-targets.EcsEc2Task` instead of an `Ec2Service`: +`@aws-cdk/aws-events-targets.EcsTask` instead of an `Ec2Service`: ```ts import targets = require('@aws-cdk/aws-events-targets'); diff --git a/packages/@aws-cdk/aws-ecs/package-lock.json b/packages/@aws-cdk/aws-ecs/package-lock.json index 277c71f2436b8..ec602b6c1e2d6 100644 --- a/packages/@aws-cdk/aws-ecs/package-lock.json +++ b/packages/@aws-cdk/aws-ecs/package-lock.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-ecs", - "version": "0.32.0", + "version": "0.33.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/@aws-cdk/aws-ecs/package.json b/packages/@aws-cdk/aws-ecs/package.json index cc140fdb8ae46..37b4757544e74 100644 --- a/packages/@aws-cdk/aws-ecs/package.json +++ b/packages/@aws-cdk/aws-ecs/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-ecs", - "version": "0.32.0", + "version": "0.33.0", "description": "The CDK Construct Library for AWS::ECS", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -60,64 +60,64 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", + "@aws-cdk/assert": "^0.33.0", "@types/proxyquire": "^1.3.28", - "cdk-build-tools": "^0.32.0", - "cdk-integ-tools": "^0.32.0", - "cfn2ts": "^0.32.0", - "pkglint": "^0.32.0", + "cdk-build-tools": "^0.33.0", + "cdk-integ-tools": "^0.33.0", + "cfn2ts": "^0.33.0", + "pkglint": "^0.33.0", "proxyquire": "^2.1.0" }, "dependencies": { - "@aws-cdk/assets-docker": "^0.32.0", - "@aws-cdk/aws-applicationautoscaling": "^0.32.0", - "@aws-cdk/aws-autoscaling": "^0.32.0", - "@aws-cdk/aws-autoscaling-hooktargets": "^0.32.0", - "@aws-cdk/aws-certificatemanager": "^0.32.0", - "@aws-cdk/aws-cloudformation": "^0.32.0", - "@aws-cdk/aws-cloudwatch": "^0.32.0", - "@aws-cdk/aws-ec2": "^0.32.0", - "@aws-cdk/aws-ecr": "^0.32.0", - "@aws-cdk/aws-elasticloadbalancing": "^0.32.0", - "@aws-cdk/aws-elasticloadbalancingv2": "^0.32.0", - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/aws-lambda": "^0.32.0", - "@aws-cdk/aws-logs": "^0.32.0", - "@aws-cdk/aws-route53": "^0.32.0", - "@aws-cdk/aws-route53-targets": "^0.32.0", - "@aws-cdk/aws-secretsmanager": "^0.32.0", - "@aws-cdk/aws-servicediscovery": "^0.32.0", - "@aws-cdk/aws-sns": "^0.32.0", - "@aws-cdk/aws-sqs": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0", - "@aws-cdk/cx-api": "^0.32.0" + "@aws-cdk/assets-docker": "^0.33.0", + "@aws-cdk/aws-applicationautoscaling": "^0.33.0", + "@aws-cdk/aws-autoscaling": "^0.33.0", + "@aws-cdk/aws-autoscaling-hooktargets": "^0.33.0", + "@aws-cdk/aws-certificatemanager": "^0.33.0", + "@aws-cdk/aws-cloudformation": "^0.33.0", + "@aws-cdk/aws-cloudwatch": "^0.33.0", + "@aws-cdk/aws-ec2": "^0.33.0", + "@aws-cdk/aws-ecr": "^0.33.0", + "@aws-cdk/aws-elasticloadbalancing": "^0.33.0", + "@aws-cdk/aws-elasticloadbalancingv2": "^0.33.0", + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/aws-lambda": "^0.33.0", + "@aws-cdk/aws-logs": "^0.33.0", + "@aws-cdk/aws-route53": "^0.33.0", + "@aws-cdk/aws-route53-targets": "^0.33.0", + "@aws-cdk/aws-secretsmanager": "^0.33.0", + "@aws-cdk/aws-servicediscovery": "^0.33.0", + "@aws-cdk/aws-sns": "^0.33.0", + "@aws-cdk/aws-sqs": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0", + "@aws-cdk/cx-api": "^0.33.0" }, "homepage": "https://github.com/awslabs/aws-cdk", "peerDependencies": { - "@aws-cdk/assets-docker": "^0.32.0", - "@aws-cdk/aws-applicationautoscaling": "^0.32.0", - "@aws-cdk/aws-autoscaling": "^0.32.0", - "@aws-cdk/aws-autoscaling-hooktargets": "^0.32.0", - "@aws-cdk/aws-certificatemanager": "^0.32.0", - "@aws-cdk/aws-cloudformation": "^0.32.0", - "@aws-cdk/aws-cloudwatch": "^0.32.0", - "@aws-cdk/aws-ec2": "^0.32.0", - "@aws-cdk/aws-ecr": "^0.32.0", - "@aws-cdk/aws-elasticloadbalancing": "^0.32.0", - "@aws-cdk/aws-elasticloadbalancingv2": "^0.32.0", - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/aws-lambda": "^0.32.0", - "@aws-cdk/aws-logs": "^0.32.0", - "@aws-cdk/aws-route53": "^0.32.0", - "@aws-cdk/aws-route53-targets": "^0.32.0", - "@aws-cdk/aws-secretsmanager": "^0.32.0", - "@aws-cdk/aws-servicediscovery": "^0.32.0", - "@aws-cdk/aws-sns": "^0.32.0", - "@aws-cdk/aws-sqs": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0", - "@aws-cdk/cx-api": "^0.32.0" + "@aws-cdk/assets-docker": "^0.33.0", + "@aws-cdk/aws-applicationautoscaling": "^0.33.0", + "@aws-cdk/aws-autoscaling": "^0.33.0", + "@aws-cdk/aws-autoscaling-hooktargets": "^0.33.0", + "@aws-cdk/aws-certificatemanager": "^0.33.0", + "@aws-cdk/aws-cloudformation": "^0.33.0", + "@aws-cdk/aws-cloudwatch": "^0.33.0", + "@aws-cdk/aws-ec2": "^0.33.0", + "@aws-cdk/aws-ecr": "^0.33.0", + "@aws-cdk/aws-elasticloadbalancing": "^0.33.0", + "@aws-cdk/aws-elasticloadbalancingv2": "^0.33.0", + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/aws-lambda": "^0.33.0", + "@aws-cdk/aws-logs": "^0.33.0", + "@aws-cdk/aws-route53": "^0.33.0", + "@aws-cdk/aws-route53-targets": "^0.33.0", + "@aws-cdk/aws-secretsmanager": "^0.33.0", + "@aws-cdk/aws-servicediscovery": "^0.33.0", + "@aws-cdk/aws-sns": "^0.33.0", + "@aws-cdk/aws-sqs": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0", + "@aws-cdk/cx-api": "^0.33.0" }, "engines": { "node": ">= 8.10.0" } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-efs/package.json b/packages/@aws-cdk/aws-efs/package.json index 5ab323f3e139a..a35ce4e3c7c5d 100644 --- a/packages/@aws-cdk/aws-efs/package.json +++ b/packages/@aws-cdk/aws-efs/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-efs", - "version": "0.32.0", + "version": "0.33.0", "description": "The CDK Construct Library for AWS::EFS", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -60,19 +60,19 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "cdk-build-tools": "^0.32.0", - "cfn2ts": "^0.32.0", - "pkglint": "^0.32.0" + "@aws-cdk/assert": "^0.33.0", + "cdk-build-tools": "^0.33.0", + "cfn2ts": "^0.33.0", + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "homepage": "https://github.com/awslabs/aws-cdk", "peerDependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "engines": { "node": ">= 8.10.0" } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-eks/package.json b/packages/@aws-cdk/aws-eks/package.json index 2ee6d6adcec63..b137aac5e2181 100644 --- a/packages/@aws-cdk/aws-eks/package.json +++ b/packages/@aws-cdk/aws-eks/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-eks", - "version": "0.32.0", + "version": "0.33.0", "description": "The CDK Construct Library for AWS::EKS", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -60,26 +60,26 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "cdk-build-tools": "^0.32.0", - "cdk-integ-tools": "^0.32.0", - "cfn2ts": "^0.32.0", - "pkglint": "^0.32.0" + "@aws-cdk/assert": "^0.33.0", + "cdk-build-tools": "^0.33.0", + "cdk-integ-tools": "^0.33.0", + "cfn2ts": "^0.33.0", + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/aws-autoscaling": "^0.32.0", - "@aws-cdk/aws-ec2": "^0.32.0", - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/aws-autoscaling": "^0.33.0", + "@aws-cdk/aws-ec2": "^0.33.0", + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0" }, "homepage": "https://github.com/awslabs/aws-cdk", "peerDependencies": { - "@aws-cdk/aws-autoscaling": "^0.32.0", - "@aws-cdk/aws-ec2": "^0.32.0", - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/aws-autoscaling": "^0.33.0", + "@aws-cdk/aws-ec2": "^0.33.0", + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0" }, "engines": { "node": ">= 8.10.0" } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-elasticache/package.json b/packages/@aws-cdk/aws-elasticache/package.json index 23d6decc613c3..62b540c5035f3 100644 --- a/packages/@aws-cdk/aws-elasticache/package.json +++ b/packages/@aws-cdk/aws-elasticache/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-elasticache", - "version": "0.32.0", + "version": "0.33.0", "description": "The CDK Construct Library for AWS::ElastiCache", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -60,19 +60,19 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "cdk-build-tools": "^0.32.0", - "cfn2ts": "^0.32.0", - "pkglint": "^0.32.0" + "@aws-cdk/assert": "^0.33.0", + "cdk-build-tools": "^0.33.0", + "cfn2ts": "^0.33.0", + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "homepage": "https://github.com/awslabs/aws-cdk", "peerDependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "engines": { "node": ">= 8.10.0" } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-elasticbeanstalk/package.json b/packages/@aws-cdk/aws-elasticbeanstalk/package.json index 8c76304df0c12..01045050e0da0 100644 --- a/packages/@aws-cdk/aws-elasticbeanstalk/package.json +++ b/packages/@aws-cdk/aws-elasticbeanstalk/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-elasticbeanstalk", - "version": "0.32.0", + "version": "0.33.0", "description": "The CDK Construct Library for AWS::ElasticBeanstalk", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -60,19 +60,19 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "cdk-build-tools": "^0.32.0", - "cfn2ts": "^0.32.0", - "pkglint": "^0.32.0" + "@aws-cdk/assert": "^0.33.0", + "cdk-build-tools": "^0.33.0", + "cfn2ts": "^0.33.0", + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "homepage": "https://github.com/awslabs/aws-cdk", "peerDependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "engines": { "node": ">= 8.10.0" } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-elasticloadbalancing/package.json b/packages/@aws-cdk/aws-elasticloadbalancing/package.json index f6bcd7b342fff..4453baf431caa 100644 --- a/packages/@aws-cdk/aws-elasticloadbalancing/package.json +++ b/packages/@aws-cdk/aws-elasticloadbalancing/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-elasticloadbalancing", - "version": "0.32.0", + "version": "0.33.0", "description": "CDK Constructs for AWS ElasticLoadBalancing", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -60,22 +60,22 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "cdk-build-tools": "^0.32.0", - "cdk-integ-tools": "^0.32.0", - "cfn2ts": "^0.32.0", - "pkglint": "^0.32.0" + "@aws-cdk/assert": "^0.33.0", + "cdk-build-tools": "^0.33.0", + "cdk-integ-tools": "^0.33.0", + "cfn2ts": "^0.33.0", + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/aws-ec2": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/aws-ec2": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0" }, "homepage": "https://github.com/awslabs/aws-cdk", "peerDependencies": { - "@aws-cdk/aws-ec2": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/aws-ec2": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0" }, "engines": { "node": ">= 8.10.0" } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-elasticloadbalancingv2/package.json b/packages/@aws-cdk/aws-elasticloadbalancingv2/package.json index 7df25c1041801..62ee495cd1855 100644 --- a/packages/@aws-cdk/aws-elasticloadbalancingv2/package.json +++ b/packages/@aws-cdk/aws-elasticloadbalancingv2/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-elasticloadbalancingv2", - "version": "0.32.0", + "version": "0.33.0", "description": "The CDK Construct Library for AWS::ElasticLoadBalancingV2", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -60,28 +60,28 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "cdk-build-tools": "^0.32.0", - "cdk-integ-tools": "^0.32.0", - "cfn2ts": "^0.32.0", - "pkglint": "^0.32.0" + "@aws-cdk/assert": "^0.33.0", + "cdk-build-tools": "^0.33.0", + "cdk-integ-tools": "^0.33.0", + "cfn2ts": "^0.33.0", + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/aws-certificatemanager": "^0.32.0", - "@aws-cdk/aws-cloudwatch": "^0.32.0", - "@aws-cdk/aws-ec2": "^0.32.0", - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/aws-s3": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/aws-certificatemanager": "^0.33.0", + "@aws-cdk/aws-cloudwatch": "^0.33.0", + "@aws-cdk/aws-ec2": "^0.33.0", + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/aws-s3": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0" }, "homepage": "https://github.com/awslabs/aws-cdk", "peerDependencies": { - "@aws-cdk/aws-certificatemanager": "^0.32.0", - "@aws-cdk/aws-cloudwatch": "^0.32.0", - "@aws-cdk/aws-ec2": "^0.32.0", - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/aws-s3": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/aws-certificatemanager": "^0.33.0", + "@aws-cdk/aws-cloudwatch": "^0.33.0", + "@aws-cdk/aws-ec2": "^0.33.0", + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/aws-s3": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0" }, "engines": { "node": ">= 8.10.0" @@ -93,4 +93,4 @@ "construct-ctor:@aws-cdk/aws-elasticloadbalancingv2.TargetGroupBase." ] } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-elasticsearch/package.json b/packages/@aws-cdk/aws-elasticsearch/package.json index 698e1dc5bac24..60c0b3aedf1bb 100644 --- a/packages/@aws-cdk/aws-elasticsearch/package.json +++ b/packages/@aws-cdk/aws-elasticsearch/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-elasticsearch", - "version": "0.32.0", + "version": "0.33.0", "description": "The CDK Construct Library for AWS::Elasticsearch", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -60,19 +60,19 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "cdk-build-tools": "^0.32.0", - "cfn2ts": "^0.32.0", - "pkglint": "^0.32.0" + "@aws-cdk/assert": "^0.33.0", + "cdk-build-tools": "^0.33.0", + "cfn2ts": "^0.33.0", + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "homepage": "https://github.com/awslabs/aws-cdk", "peerDependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "engines": { "node": ">= 8.10.0" } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-emr/package.json b/packages/@aws-cdk/aws-emr/package.json index 921b0101120e3..5e30d014d35dd 100644 --- a/packages/@aws-cdk/aws-emr/package.json +++ b/packages/@aws-cdk/aws-emr/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-emr", - "version": "0.32.0", + "version": "0.33.0", "description": "The CDK Construct Library for AWS::EMR", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -60,19 +60,19 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "cdk-build-tools": "^0.32.0", - "cfn2ts": "^0.32.0", - "pkglint": "^0.32.0" + "@aws-cdk/assert": "^0.33.0", + "cdk-build-tools": "^0.33.0", + "cfn2ts": "^0.33.0", + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "homepage": "https://github.com/awslabs/aws-cdk", "peerDependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "engines": { "node": ">= 8.10.0" } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-events-targets/lib/ecs-ec2-task.ts b/packages/@aws-cdk/aws-events-targets/lib/ecs-ec2-task.ts deleted file mode 100644 index 2fd38253fb8dd..0000000000000 --- a/packages/@aws-cdk/aws-events-targets/lib/ecs-ec2-task.ts +++ /dev/null @@ -1,125 +0,0 @@ -import ec2 = require('@aws-cdk/aws-ec2'); -import ecs = require('@aws-cdk/aws-ecs'); -import events = require ('@aws-cdk/aws-events'); -import iam = require('@aws-cdk/aws-iam'); -import { Construct, Token } from '@aws-cdk/cdk'; -import { ContainerOverride } from './ecs-task-properties'; -import { singletonEventRole } from './util'; - -/** - * Properties to define an EC2 Event Task - */ -export interface EcsEc2TaskProps { - /** - * Cluster where service will be deployed - */ - readonly cluster: ecs.ICluster; - - /** - * Task Definition of the task that should be started - */ - readonly taskDefinition: ecs.TaskDefinition; - - /** - * How many tasks should be started when this event is triggered - * - * @default 1 - */ - readonly taskCount?: number; - - /** - * Container setting overrides - * - * Key is the name of the container to override, value is the - * values you want to override. - */ - readonly containerOverrides?: ContainerOverride[]; - - /** - * In what subnets to place the task's ENIs - * - * (Only applicable in case the TaskDefinition is configured for AwsVpc networking) - * - * @default Private subnets - */ - readonly subnetSelection?: ec2.SubnetSelection; - - /** - * Existing security group to use for the task's ENIs - * - * (Only applicable in case the TaskDefinition is configured for AwsVpc networking) - * - * @default A new security group is created - */ - readonly securityGroup?: ec2.ISecurityGroup; -} - -/** - * Start a service on an EC2 cluster - */ -export class EcsEc2Task implements events.IRuleTarget { - private readonly cluster: ecs.ICluster; - private readonly taskDefinition: ecs.TaskDefinition; - private readonly taskCount: number; - - constructor(private readonly props: EcsEc2TaskProps) { - if (!props.taskDefinition.isEc2Compatible) { - throw new Error('Supplied TaskDefinition is not configured for compatibility with EC2'); - } - - this.cluster = props.cluster; - this.taskDefinition = props.taskDefinition; - this.taskCount = props.taskCount !== undefined ? props.taskCount : 1; - } - - /** - * Allows using containers as target of CloudWatch events - */ - public bind(rule: events.IRule): events.RuleTargetProperties { - const policyStatements = [new iam.PolicyStatement() - .addAction('ecs:RunTask') - .addResource(this.taskDefinition.taskDefinitionArn) - .addCondition('ArnEquals', { "ecs:cluster": this.cluster.clusterArn }) - ]; - - // If it so happens that a Task Execution Role was created for the TaskDefinition, - // then the CloudWatch Events Role must have permissions to pass it (otherwise it doesn't). - // - // It never needs permissions to the Task Role. - if (this.taskDefinition.executionRole !== undefined) { - policyStatements.push(new iam.PolicyStatement() - .addAction('iam:PassRole') - .addResource(this.taskDefinition.executionRole.roleArn)); - } - - return { - id: this.taskDefinition.node.id + ' on ' + this.cluster.node.id, - arn: this.cluster.clusterArn, - role: singletonEventRole(this.taskDefinition, policyStatements), - ecsParameters: { - taskCount: this.taskCount, - taskDefinitionArn: this.taskDefinition.taskDefinitionArn - }, - input: events.RuleTargetInput.fromObject({ - containerOverrides: this.props.containerOverrides, - networkConfiguration: this.renderNetworkConfiguration(rule as events.Rule), - }) - }; - } - - private renderNetworkConfiguration(scope: Construct) { - if (this.props.taskDefinition.networkMode !== ecs.NetworkMode.AwsVpc) { - return undefined; - } - - const subnetSelection = this.props.subnetSelection || { subnetType: ec2.SubnetType.Private }; - const securityGroup = this.props.securityGroup || new ec2.SecurityGroup(scope, 'SecurityGroup', { vpc: this.props.cluster.vpc }); - - return { - awsvpcConfiguration: { - subnets: this.props.cluster.vpc.selectSubnets(subnetSelection).subnetIds, - securityGroups: new Token(() => [securityGroup.securityGroupId]), - } - }; - } -} diff --git a/packages/@aws-cdk/aws-events-targets/lib/ecs-task-properties.ts b/packages/@aws-cdk/aws-events-targets/lib/ecs-task-properties.ts index 11deb4cd8d8c5..4c37724b00dc4 100644 --- a/packages/@aws-cdk/aws-events-targets/lib/ecs-task-properties.ts +++ b/packages/@aws-cdk/aws-events-targets/lib/ecs-task-properties.ts @@ -55,4 +55,4 @@ export interface TaskEnvironmentVariable { * Exactly one of `value` and `valuePath` must be specified. */ readonly value: string; -} \ No newline at end of file +} diff --git a/packages/@aws-cdk/aws-events-targets/lib/ecs-task.ts b/packages/@aws-cdk/aws-events-targets/lib/ecs-task.ts new file mode 100644 index 0000000000000..9cbd4f7230138 --- /dev/null +++ b/packages/@aws-cdk/aws-events-targets/lib/ecs-task.ts @@ -0,0 +1,170 @@ +import cloudformation = require('@aws-cdk/aws-cloudformation'); +import ec2 = require('@aws-cdk/aws-ec2'); +import ecs = require('@aws-cdk/aws-ecs'); +import events = require ('@aws-cdk/aws-events'); +import iam = require('@aws-cdk/aws-iam'); +import { ContainerOverride } from './ecs-task-properties'; +import { singletonEventRole } from './util'; + +/** + * Properties to define an ECS Event Task + */ +export interface EcsTaskProps { + /** + * Cluster where service will be deployed + */ + readonly cluster: ecs.ICluster; + + /** + * Task Definition of the task that should be started + */ + readonly taskDefinition: ecs.TaskDefinition; + + /** + * How many tasks should be started when this event is triggered + * + * @default 1 + */ + readonly taskCount?: number; + + /** + * Container setting overrides + * + * Key is the name of the container to override, value is the + * values you want to override. + */ + readonly containerOverrides?: ContainerOverride[]; + + /** + * In what subnets to place the task's ENIs + * + * (Only applicable in case the TaskDefinition is configured for AwsVpc networking) + * + * @default Private subnets + */ + readonly subnetSelection?: ec2.SubnetSelection; + + /** + * Existing security group to use for the task's ENIs + * + * (Only applicable in case the TaskDefinition is configured for AwsVpc networking) + * + * @default A new security group is created + */ + readonly securityGroup?: ec2.ISecurityGroup; +} + +/** + * Start a task on an ECS cluster + */ +export class EcsTask implements events.IRuleTarget { + public readonly securityGroup?: ec2.ISecurityGroup; + private readonly cluster: ecs.ICluster; + private readonly taskDefinition: ecs.TaskDefinition; + private readonly taskCount: number; + + constructor(private readonly props: EcsTaskProps) { + this.cluster = props.cluster; + this.taskDefinition = props.taskDefinition; + this.taskCount = props.taskCount !== undefined ? props.taskCount : 1; + + if (this.taskDefinition.networkMode === ecs.NetworkMode.AwsVpc) { + this.securityGroup = props.securityGroup || new ec2.SecurityGroup(this.taskDefinition, 'SecurityGroup', { vpc: this.props.cluster.vpc }); + } + } + + /** + * Allows using tasks as target of CloudWatch events + */ + public bind(rule: events.IRule): events.RuleTargetProperties { + const policyStatements = [new iam.PolicyStatement() + .addAction('ecs:RunTask') + .addResource(this.taskDefinition.taskDefinitionArn) + .addCondition('ArnEquals', { "ecs:cluster": this.cluster.clusterArn }) + ]; + + // If it so happens that a Task Execution Role was created for the TaskDefinition, + // then the CloudWatch Events Role must have permissions to pass it (otherwise it doesn't). + if (this.taskDefinition.executionRole !== undefined) { + policyStatements.push(new iam.PolicyStatement() + .addAction('iam:PassRole') + .addResource(this.taskDefinition.executionRole.roleArn)); + } + + // For Fargate task we need permission to pass the task role. + if (this.taskDefinition.isFargateCompatible) { + policyStatements.push(new iam.PolicyStatement() + .addAction('iam:PassRole') + .addResource(this.taskDefinition.taskRole.roleArn)); + } + + const id = this.taskDefinition.node.id + '-on-' + this.cluster.node.id; + const arn = this.cluster.clusterArn; + const role = singletonEventRole(this.taskDefinition, policyStatements); + const containerOverrides = this.props.containerOverrides && this.props.containerOverrides + .map(({ containerName, ...overrides }) => ({ name: containerName, ...overrides })); + const input = { containerOverrides }; + const taskCount = this.taskCount; + const taskDefinitionArn = this.taskDefinition.taskDefinitionArn; + + // Use a custom resource to "enhance" the target with network configuration + // when using awsvpc network mode. + if (this.taskDefinition.networkMode === ecs.NetworkMode.AwsVpc) { + const subnetSelection = this.props.subnetSelection || { subnetType: ec2.SubnetType.Private }; + const assignPublicIp = subnetSelection.subnetType === ec2.SubnetType.Private ? 'DISABLED' : 'ENABLED'; + + new cloudformation.AwsCustomResource(this.taskDefinition, 'PutTargets', { + // `onCreate´ defaults to `onUpdate` and we don't need an `onDelete` here + // because the rule/target will be owned by CF anyway. + onUpdate: { + service: 'CloudWatchEvents', + apiVersion: '2015-10-07', + action: 'putTargets', + parameters: { + Rule: this.taskDefinition.node.stack.parseArn(rule.ruleArn).resourceName, + Targets: [ + { + Arn: arn, + Id: id, + EcsParameters: { + TaskDefinitionArn: taskDefinitionArn, + LaunchType: this.taskDefinition.isEc2Compatible ? 'EC2' : 'FARGATE', + NetworkConfiguration: { + awsvpcConfiguration: { + Subnets: this.props.cluster.vpc.selectSubnets(subnetSelection).subnetIds, + AssignPublicIp: assignPublicIp, + SecurityGroups: this.securityGroup && [this.securityGroup.securityGroupId], + } + }, + TaskCount: taskCount, + }, + Input: JSON.stringify(input), + RoleArn: role.roleArn + } + ] + }, + physicalResourceId: id, + }, + policyStatements: [ // Cannot use automatic policy statements because we need iam:PassRole + new iam.PolicyStatement() + .addAction('events:PutTargets') + .addResource(rule.ruleArn), + new iam.PolicyStatement() + .addAction('iam:PassRole') + .addResource(role.roleArn) + ] + }); + } + + return { + id, + arn, + role, + ecsParameters: { + taskCount, + taskDefinitionArn + }, + input: events.RuleTargetInput.fromObject(input) + }; + } +} diff --git a/packages/@aws-cdk/aws-events-targets/lib/index.ts b/packages/@aws-cdk/aws-events-targets/lib/index.ts index cd31a43468f19..fc30dbbc2b6ee 100644 --- a/packages/@aws-cdk/aws-events-targets/lib/index.ts +++ b/packages/@aws-cdk/aws-events-targets/lib/index.ts @@ -3,5 +3,5 @@ export * from './sns'; export * from './codebuild'; export * from './lambda'; export * from './ecs-task-properties'; -export * from './ecs-ec2-task'; +export * from './ecs-task'; export * from './state-machine'; diff --git a/packages/@aws-cdk/aws-events-targets/package-lock.json b/packages/@aws-cdk/aws-events-targets/package-lock.json index 8e7b404a880a5..205f0771b6eee 100644 --- a/packages/@aws-cdk/aws-events-targets/package-lock.json +++ b/packages/@aws-cdk/aws-events-targets/package-lock.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-events-targets", - "version": "0.32.0", + "version": "0.33.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/@aws-cdk/aws-events-targets/package.json b/packages/@aws-cdk/aws-events-targets/package.json index bc6414589242b..2ca767af15089 100644 --- a/packages/@aws-cdk/aws-events-targets/package.json +++ b/packages/@aws-cdk/aws-events-targets/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-events-targets", - "version": "0.32.0", + "version": "0.33.0", "description": "Event targets for AWS CloudWatch Events", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -71,38 +71,40 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "@aws-cdk/aws-codecommit": "^0.32.0", - "@aws-cdk/aws-sqs": "^0.32.0", - "cdk-build-tools": "^0.32.0", - "cdk-integ-tools": "^0.32.0", + "@aws-cdk/assert": "^0.33.0", + "@aws-cdk/aws-codecommit": "^0.33.0", + "@aws-cdk/aws-sqs": "^0.33.0", + "cdk-build-tools": "^0.33.0", + "cdk-integ-tools": "^0.33.0", "jest": "^24.7.1", - "pkglint": "^0.32.0" + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/aws-codebuild": "^0.32.0", - "@aws-cdk/aws-codepipeline": "^0.32.0", - "@aws-cdk/aws-ec2": "^0.32.0", - "@aws-cdk/aws-ecs": "^0.32.0", - "@aws-cdk/aws-events": "^0.32.0", - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/aws-lambda": "^0.32.0", - "@aws-cdk/aws-sns": "^0.32.0", - "@aws-cdk/aws-stepfunctions": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/aws-cloudformation": "^0.33.0", + "@aws-cdk/aws-codebuild": "^0.33.0", + "@aws-cdk/aws-codepipeline": "^0.33.0", + "@aws-cdk/aws-ec2": "^0.33.0", + "@aws-cdk/aws-ecs": "^0.33.0", + "@aws-cdk/aws-events": "^0.33.0", + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/aws-lambda": "^0.33.0", + "@aws-cdk/aws-sns": "^0.33.0", + "@aws-cdk/aws-stepfunctions": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0" }, "homepage": "https://github.com/awslabs/aws-cdk", "peerDependencies": { - "@aws-cdk/aws-codebuild": "^0.32.0", - "@aws-cdk/aws-codepipeline": "^0.32.0", - "@aws-cdk/aws-ec2": "^0.32.0", - "@aws-cdk/aws-ecs": "^0.32.0", - "@aws-cdk/aws-events": "^0.32.0", - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/aws-lambda": "^0.32.0", - "@aws-cdk/aws-sns": "^0.32.0", - "@aws-cdk/aws-stepfunctions": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/aws-cloudformation": "^0.33.0", + "@aws-cdk/aws-codebuild": "^0.33.0", + "@aws-cdk/aws-codepipeline": "^0.33.0", + "@aws-cdk/aws-ec2": "^0.33.0", + "@aws-cdk/aws-ecs": "^0.33.0", + "@aws-cdk/aws-events": "^0.33.0", + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/aws-lambda": "^0.33.0", + "@aws-cdk/aws-sns": "^0.33.0", + "@aws-cdk/aws-stepfunctions": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0" }, "engines": { "node": ">= 8.10.0" diff --git a/packages/@aws-cdk/aws-events-targets/test/ecs/ec2-event-rule-target.test.ts b/packages/@aws-cdk/aws-events-targets/test/ecs/ec2-event-rule-target.test.ts deleted file mode 100644 index 3e9c62822ea55..0000000000000 --- a/packages/@aws-cdk/aws-events-targets/test/ecs/ec2-event-rule-target.test.ts +++ /dev/null @@ -1,57 +0,0 @@ -import '@aws-cdk/assert/jest'; -import ec2 = require('@aws-cdk/aws-ec2'); -import ecs = require('@aws-cdk/aws-ecs'); -import events = require('@aws-cdk/aws-events'); -import cdk = require('@aws-cdk/cdk'); -import targets = require('../../lib'); - -test("Can use EC2 taskdef as EventRule target", () => { - // GIVEN - const stack = new cdk.Stack(); - const vpc = new ec2.Vpc(stack, 'Vpc', { maxAZs: 1 }); - const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc }); - cluster.addCapacity('DefaultAutoScalingGroup', { - instanceType: new ec2.InstanceType('t2.micro') - }); - - const taskDefinition = new ecs.Ec2TaskDefinition(stack, 'TaskDef'); - taskDefinition.addContainer('TheContainer', { - image: ecs.ContainerImage.fromRegistry('henk'), - memoryLimitMiB: 256 - }); - - const rule = new events.Rule(stack, 'Rule', { - scheduleExpression: 'rate(1 minute)', - }); - - // WHEN - rule.addTarget(new targets.EcsEc2Task({ - cluster, - taskDefinition, - taskCount: 1, - containerOverrides: [{ - containerName: 'TheContainer', - command: ['echo', events.EventField.fromPath('$.detail.event')], - }] - })); - - // THEN - expect(stack).toHaveResourceLike('AWS::Events::Rule', { - Targets: [ - { - Arn: { "Fn::GetAtt": ["EcsCluster97242B84", "Arn"] }, - EcsParameters: { - TaskCount: 1, - TaskDefinitionArn: { Ref: "TaskDef54694570" } - }, - InputTransformer: { - InputPathsMap: { - f1: "$.detail.event" - }, - InputTemplate: "{\"containerOverrides\":[{\"containerName\":\"TheContainer\",\"command\":[\"echo\",]}]}" - }, - RoleArn: { "Fn::GetAtt": ["TaskDefEventsRoleFB3B67B8", "Arn"] } - } - ] - }); -}); diff --git a/packages/@aws-cdk/aws-events-targets/test/ecs/event-rule-target.test.ts b/packages/@aws-cdk/aws-events-targets/test/ecs/event-rule-target.test.ts new file mode 100644 index 0000000000000..01a2fb6c707a2 --- /dev/null +++ b/packages/@aws-cdk/aws-events-targets/test/ecs/event-rule-target.test.ts @@ -0,0 +1,165 @@ +import '@aws-cdk/assert/jest'; +import ec2 = require('@aws-cdk/aws-ec2'); +import ecs = require('@aws-cdk/aws-ecs'); +import events = require('@aws-cdk/aws-events'); +import cdk = require('@aws-cdk/cdk'); +import targets = require('../../lib'); + +test("Can use EC2 taskdef as EventRule target", () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'Vpc', { maxAZs: 1 }); + const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc }); + cluster.addCapacity('DefaultAutoScalingGroup', { + instanceType: new ec2.InstanceType('t2.micro') + }); + + const taskDefinition = new ecs.Ec2TaskDefinition(stack, 'TaskDef'); + taskDefinition.addContainer('TheContainer', { + image: ecs.ContainerImage.fromRegistry('henk'), + memoryLimitMiB: 256 + }); + + const rule = new events.Rule(stack, 'Rule', { + scheduleExpression: 'rate(1 minute)', + }); + + // WHEN + rule.addTarget(new targets.EcsTask({ + cluster, + taskDefinition, + taskCount: 1, + containerOverrides: [{ + containerName: 'TheContainer', + command: ['echo', events.EventField.fromPath('$.detail.event')], + }] + })); + + // THEN + expect(stack).toHaveResourceLike('AWS::Events::Rule', { + Targets: [ + { + Arn: { "Fn::GetAtt": ["EcsCluster97242B84", "Arn"] }, + EcsParameters: { + TaskCount: 1, + TaskDefinitionArn: { Ref: "TaskDef54694570" } + }, + InputTransformer: { + InputPathsMap: { + f1: "$.detail.event" + }, + InputTemplate: "{\"containerOverrides\":[{\"name\":\"TheContainer\",\"command\":[\"echo\",]}]}" + }, + RoleArn: { "Fn::GetAtt": ["TaskDefEventsRoleFB3B67B8", "Arn"] } + } + ] + }); +}); + +test("Can use Fargate taskdef as EventRule target", () => { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'Vpc', { maxAZs: 1 }); + const cluster = new ecs.Cluster(stack, 'EcsCluster', { vpc }); + + const taskDefinition = new ecs.FargateTaskDefinition(stack, 'TaskDef'); + taskDefinition.addContainer('TheContainer', { + image: ecs.ContainerImage.fromRegistry('henk'), + }); + + const rule = new events.Rule(stack, 'Rule', { + scheduleExpression: 'rate(1 minute)', + }); + + // WHEN + rule.addTarget(new targets.EcsTask({ + cluster, + taskDefinition, + taskCount: 1, + containerOverrides: [{ + containerName: 'TheContainer', + command: ['echo', events.EventField.fromPath('$.detail.event')], + }] + })); + + // THEN + expect(stack).toHaveResourceLike('Custom::AWS', { + Update: { + service: "CloudWatchEvents", + apiVersion: "2015-10-07", + action: "putTargets", + parameters: { + Rule: { + "Fn::Select": [ + 1, + { + "Fn::Split": [ + "/", + { + "Fn::Select": [ + 5, + { + "Fn::Split": [ + ":", + { + "Fn::GetAtt": [ + "Rule4C995B7F", + "Arn" + ] + } + ] + } + ] + } + ] + } + ] + }, + Targets: [ + { + Arn: { + "Fn::GetAtt": [ + "EcsCluster97242B84", + "Arn" + ] + }, + Id: "TaskDef-on-EcsCluster", + EcsParameters: { + TaskDefinitionArn: { + Ref: "TaskDef54694570" + }, + LaunchType: "FARGATE", + NetworkConfiguration: { + awsvpcConfiguration: { + Subnets: [ + { + Ref: "VpcPrivateSubnet1Subnet536B997A" + } + ], + AssignPublicIp: "DISABLED", + SecurityGroups: [ + { + "Fn::GetAtt": [ + "TaskDefSecurityGroupD50E7CF0", + "GroupId" + ] + } + ] + } + }, + TaskCount: 1 + }, + Input: "{\"containerOverrides\":[{\"name\":\"TheContainer\",\"command\":[\"echo\",\"$.detail.event\"]}]}", + RoleArn: { + "Fn::GetAtt": [ + "TaskDefEventsRoleFB3B67B8", + "Arn" + ] + } + } + ] + }, + physicalResourceId: "TaskDef-on-EcsCluster" + } + }); +}); diff --git a/packages/@aws-cdk/aws-events-targets/test/ecs/integ.event-task.lit.expected.json b/packages/@aws-cdk/aws-events-targets/test/ecs/integ.event-ec2-task.lit.expected.json similarity index 99% rename from packages/@aws-cdk/aws-events-targets/test/ecs/integ.event-task.lit.expected.json rename to packages/@aws-cdk/aws-events-targets/test/ecs/integ.event-ec2-task.lit.expected.json index 6ee0890f74067..c9f77ff04f967 100644 --- a/packages/@aws-cdk/aws-events-targets/test/ecs/integ.event-task.lit.expected.json +++ b/packages/@aws-cdk/aws-events-targets/test/ecs/integ.event-ec2-task.lit.expected.json @@ -1053,7 +1053,7 @@ } }, "Id": "TaskDef-on-EcsCluster", - "Input": "{\"containerOverrides\":[{\"containerName\":\"TheContainer\",\"environment\":[{\"name\":\"I_WAS_TRIGGERED\",\"value\":\"From CloudWatch Events\"}]}]}", + "Input": "{\"containerOverrides\":[{\"name\":\"TheContainer\",\"environment\":[{\"name\":\"I_WAS_TRIGGERED\",\"value\":\"From CloudWatch Events\"}]}]}", "RoleArn": { "Fn::GetAtt": [ "TaskDefEventsRoleFB3B67B8", @@ -1153,4 +1153,4 @@ "Description": "Artifact hash for asset \"aws-ecs-integ-ecs/AdoptEcrRepositorydbc60defc59544bcaa5c28c95d68f62c/Code\"" } } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-events-targets/test/ecs/integ.event-task.lit.ts b/packages/@aws-cdk/aws-events-targets/test/ecs/integ.event-ec2-task.lit.ts similarity index 94% rename from packages/@aws-cdk/aws-events-targets/test/ecs/integ.event-task.lit.ts rename to packages/@aws-cdk/aws-events-targets/test/ecs/integ.event-ec2-task.lit.ts index a759421d8c047..ab9499e8abbdc 100644 --- a/packages/@aws-cdk/aws-events-targets/test/ecs/integ.event-task.lit.ts +++ b/packages/@aws-cdk/aws-events-targets/test/ecs/integ.event-ec2-task.lit.ts @@ -35,8 +35,8 @@ class EventStack extends cdk.Stack { scheduleExpression: 'rate(1 minute)', }); - // Use EcsEc2Task as the target of the Rule - rule.addTarget(new targets.EcsEc2Task({ + // Use EcsTask as the target of the Rule + rule.addTarget(new targets.EcsTask({ cluster, taskDefinition, taskCount: 1, diff --git a/packages/@aws-cdk/aws-events-targets/test/ecs/integ.event-fargate-task.expected.json b/packages/@aws-cdk/aws-events-targets/test/ecs/integ.event-fargate-task.expected.json new file mode 100644 index 0000000000000..efe8c37519fa8 --- /dev/null +++ b/packages/@aws-cdk/aws-events-targets/test/ecs/integ.event-fargate-task.expected.json @@ -0,0 +1,1111 @@ +{ + "Resources": { + "Vpc8378EB38": { + "Type": "AWS::EC2::VPC", + "Properties": { + "CidrBlock": "10.0.0.0/16", + "EnableDnsHostnames": true, + "EnableDnsSupport": true, + "InstanceTenancy": "default", + "Tags": [ + { + "Key": "Name", + "Value": "aws-ecs-integ-fargate/Vpc" + } + ] + } + }, + "VpcPublicSubnet1Subnet5C2D37C4": { + "Type": "AWS::EC2::Subnet", + "Properties": { + "CidrBlock": "10.0.0.0/17", + "VpcId": { + "Ref": "Vpc8378EB38" + }, + "AvailabilityZone": "test-region-1a", + "MapPublicIpOnLaunch": true, + "Tags": [ + { + "Key": "Name", + "Value": "aws-ecs-integ-fargate/Vpc/PublicSubnet1" + }, + { + "Key": "aws-cdk:subnet-name", + "Value": "Public" + }, + { + "Key": "aws-cdk:subnet-type", + "Value": "Public" + } + ] + } + }, + "VpcPublicSubnet1RouteTable6C95E38E": { + "Type": "AWS::EC2::RouteTable", + "Properties": { + "VpcId": { + "Ref": "Vpc8378EB38" + }, + "Tags": [ + { + "Key": "Name", + "Value": "aws-ecs-integ-fargate/Vpc/PublicSubnet1" + } + ] + } + }, + "VpcPublicSubnet1RouteTableAssociation97140677": { + "Type": "AWS::EC2::SubnetRouteTableAssociation", + "Properties": { + "RouteTableId": { + "Ref": "VpcPublicSubnet1RouteTable6C95E38E" + }, + "SubnetId": { + "Ref": "VpcPublicSubnet1Subnet5C2D37C4" + } + } + }, + "VpcPublicSubnet1DefaultRoute3DA9E72A": { + "Type": "AWS::EC2::Route", + "Properties": { + "RouteTableId": { + "Ref": "VpcPublicSubnet1RouteTable6C95E38E" + }, + "DestinationCidrBlock": "0.0.0.0/0", + "GatewayId": { + "Ref": "VpcIGWD7BA715C" + } + }, + "DependsOn": [ + "VpcVPCGWBF912B6E" + ] + }, + "VpcPublicSubnet1EIPD7E02669": { + "Type": "AWS::EC2::EIP", + "Properties": { + "Domain": "vpc" + } + }, + "VpcPublicSubnet1NATGateway4D7517AA": { + "Type": "AWS::EC2::NatGateway", + "Properties": { + "AllocationId": { + "Fn::GetAtt": [ + "VpcPublicSubnet1EIPD7E02669", + "AllocationId" + ] + }, + "SubnetId": { + "Ref": "VpcPublicSubnet1Subnet5C2D37C4" + }, + "Tags": [ + { + "Key": "Name", + "Value": "aws-ecs-integ-fargate/Vpc/PublicSubnet1" + } + ] + } + }, + "VpcPrivateSubnet1Subnet536B997A": { + "Type": "AWS::EC2::Subnet", + "Properties": { + "CidrBlock": "10.0.128.0/17", + "VpcId": { + "Ref": "Vpc8378EB38" + }, + "AvailabilityZone": "test-region-1a", + "MapPublicIpOnLaunch": false, + "Tags": [ + { + "Key": "Name", + "Value": "aws-ecs-integ-fargate/Vpc/PrivateSubnet1" + }, + { + "Key": "aws-cdk:subnet-name", + "Value": "Private" + }, + { + "Key": "aws-cdk:subnet-type", + "Value": "Private" + } + ] + } + }, + "VpcPrivateSubnet1RouteTableB2C5B500": { + "Type": "AWS::EC2::RouteTable", + "Properties": { + "VpcId": { + "Ref": "Vpc8378EB38" + }, + "Tags": [ + { + "Key": "Name", + "Value": "aws-ecs-integ-fargate/Vpc/PrivateSubnet1" + } + ] + } + }, + "VpcPrivateSubnet1RouteTableAssociation70C59FA6": { + "Type": "AWS::EC2::SubnetRouteTableAssociation", + "Properties": { + "RouteTableId": { + "Ref": "VpcPrivateSubnet1RouteTableB2C5B500" + }, + "SubnetId": { + "Ref": "VpcPrivateSubnet1Subnet536B997A" + } + } + }, + "VpcPrivateSubnet1DefaultRouteBE02A9ED": { + "Type": "AWS::EC2::Route", + "Properties": { + "RouteTableId": { + "Ref": "VpcPrivateSubnet1RouteTableB2C5B500" + }, + "DestinationCidrBlock": "0.0.0.0/0", + "NatGatewayId": { + "Ref": "VpcPublicSubnet1NATGateway4D7517AA" + } + } + }, + "VpcIGWD7BA715C": { + "Type": "AWS::EC2::InternetGateway", + "Properties": { + "Tags": [ + { + "Key": "Name", + "Value": "aws-ecs-integ-fargate/Vpc" + } + ] + } + }, + "VpcVPCGWBF912B6E": { + "Type": "AWS::EC2::VPCGatewayAttachment", + "Properties": { + "VpcId": { + "Ref": "Vpc8378EB38" + }, + "InternetGatewayId": { + "Ref": "VpcIGWD7BA715C" + } + } + }, + "EcsCluster97242B84": { + "Type": "AWS::ECS::Cluster" + }, + "TaskDefTaskRole1EDB4A67": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": { + "Fn::Join": [ + "", + [ + "ecs-tasks.", + { + "Ref": "AWS::URLSuffix" + } + ] + ] + } + } + } + ], + "Version": "2012-10-17" + } + } + }, + "TaskDef54694570": { + "Type": "AWS::ECS::TaskDefinition", + "Properties": { + "ContainerDefinitions": [ + { + "Essential": true, + "Image": { + "Fn::Join": [ + "", + [ + { + "Fn::Select": [ + 4, + { + "Fn::Split": [ + ":", + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":ecr:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":repository/", + { + "Fn::GetAtt": [ + "EventImageAdoptRepositoryDFAAC242", + "RepositoryName" + ] + } + ] + ] + } + ] + } + ] + }, + ".dkr.ecr.", + { + "Fn::Select": [ + 3, + { + "Fn::Split": [ + ":", + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":ecr:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":repository/", + { + "Fn::GetAtt": [ + "EventImageAdoptRepositoryDFAAC242", + "RepositoryName" + ] + } + ] + ] + } + ] + } + ] + }, + ".amazonaws.com/", + { + "Fn::GetAtt": [ + "EventImageAdoptRepositoryDFAAC242", + "RepositoryName" + ] + }, + "@sha256:", + { + "Fn::Select": [ + 1, + { + "Fn::Split": [ + "@sha256:", + { + "Ref": "EventImageImageNameE972A8B1" + } + ] + } + ] + } + ] + ] + }, + "Links": [], + "LogConfiguration": { + "LogDriver": "awslogs", + "Options": { + "awslogs-group": { + "Ref": "TaskLoggingLogGroupC7E938D4" + }, + "awslogs-stream-prefix": "EventDemo", + "awslogs-region": { + "Ref": "AWS::Region" + } + } + }, + "MountPoints": [], + "Name": "TheContainer", + "PortMappings": [], + "Ulimits": [], + "VolumesFrom": [] + } + ], + "Cpu": "256", + "ExecutionRoleArn": { + "Fn::GetAtt": [ + "TaskDefExecutionRoleB4775C97", + "Arn" + ] + }, + "Family": "awsecsintegfargateTaskDef8878AF94", + "Memory": "512", + "NetworkMode": "awsvpc", + "RequiresCompatibilities": [ + "FARGATE" + ], + "TaskRoleArn": { + "Fn::GetAtt": [ + "TaskDefTaskRole1EDB4A67", + "Arn" + ] + }, + "Volumes": [] + } + }, + "TaskDefExecutionRoleB4775C97": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": { + "Fn::Join": [ + "", + [ + "ecs-tasks.", + { + "Ref": "AWS::URLSuffix" + } + ] + ] + } + } + } + ], + "Version": "2012-10-17" + } + } + }, + "TaskDefExecutionRoleDefaultPolicy0DBB737A": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "ecr:BatchCheckLayerAvailability", + "ecr:GetDownloadUrlForLayer", + "ecr:BatchGetImage" + ], + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":ecr:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":repository/", + { + "Fn::GetAtt": [ + "EventImageAdoptRepositoryDFAAC242", + "RepositoryName" + ] + } + ] + ] + } + }, + { + "Action": "ecr:GetAuthorizationToken", + "Effect": "Allow", + "Resource": "*" + }, + { + "Action": [ + "logs:CreateLogStream", + "logs:PutLogEvents" + ], + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "TaskLoggingLogGroupC7E938D4", + "Arn" + ] + } + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "TaskDefExecutionRoleDefaultPolicy0DBB737A", + "Roles": [ + { + "Ref": "TaskDefExecutionRoleB4775C97" + } + ] + } + }, + "TaskDefSecurityGroupD50E7CF0": { + "Type": "AWS::EC2::SecurityGroup", + "Properties": { + "GroupDescription": "aws-ecs-integ-fargate/TaskDef/SecurityGroup", + "SecurityGroupEgress": [ + { + "CidrIp": "0.0.0.0/0", + "Description": "Allow all outbound traffic by default", + "IpProtocol": "-1" + } + ], + "SecurityGroupIngress": [], + "VpcId": { + "Ref": "Vpc8378EB38" + } + } + }, + "TaskDefEventsRoleFB3B67B8": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": { + "Fn::Join": [ + "", + [ + "events.", + { + "Ref": "AWS::URLSuffix" + } + ] + ] + } + } + } + ], + "Version": "2012-10-17" + } + } + }, + "TaskDefEventsRoleDefaultPolicyA124E85B": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": "ecs:RunTask", + "Condition": { + "ArnEquals": { + "ecs:cluster": { + "Fn::GetAtt": [ + "EcsCluster97242B84", + "Arn" + ] + } + } + }, + "Effect": "Allow", + "Resource": { + "Ref": "TaskDef54694570" + } + }, + { + "Action": "iam:PassRole", + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "TaskDefExecutionRoleB4775C97", + "Arn" + ] + } + }, + { + "Action": "iam:PassRole", + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "TaskDefTaskRole1EDB4A67", + "Arn" + ] + } + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "TaskDefEventsRoleDefaultPolicyA124E85B", + "Roles": [ + { + "Ref": "TaskDefEventsRoleFB3B67B8" + } + ] + } + }, + "TaskDefPutTargetsF699575F": { + "Type": "Custom::AWS", + "Properties": { + "ServiceToken": { + "Fn::GetAtt": [ + "AWS679f53fac002430cb0da5b7982bd22872D164C4C", + "Arn" + ] + }, + "Create": { + "service": "CloudWatchEvents", + "apiVersion": "2015-10-07", + "action": "putTargets", + "parameters": { + "Rule": { + "Fn::Select": [ + 1, + { + "Fn::Split": [ + "/", + { + "Fn::Select": [ + 5, + { + "Fn::Split": [ + ":", + { + "Fn::GetAtt": [ + "Rule4C995B7F", + "Arn" + ] + } + ] + } + ] + } + ] + } + ] + }, + "Targets": [ + { + "Arn": { + "Fn::GetAtt": [ + "EcsCluster97242B84", + "Arn" + ] + }, + "Id": "TaskDef-on-EcsCluster", + "EcsParameters": { + "TaskDefinitionArn": { + "Ref": "TaskDef54694570" + }, + "LaunchType": "FARGATE", + "NetworkConfiguration": { + "awsvpcConfiguration": { + "Subnets": [ + { + "Ref": "VpcPrivateSubnet1Subnet536B997A" + } + ], + "AssignPublicIp": "DISABLED", + "SecurityGroups": [ + { + "Fn::GetAtt": [ + "TaskDefSecurityGroupD50E7CF0", + "GroupId" + ] + } + ] + } + }, + "TaskCount": 1 + }, + "Input": "{\"containerOverrides\":[{\"name\":\"TheContainer\",\"environment\":[{\"name\":\"I_WAS_TRIGGERED\",\"value\":\"From CloudWatch Events\"}]}]}", + "RoleArn": { + "Fn::GetAtt": [ + "TaskDefEventsRoleFB3B67B8", + "Arn" + ] + } + } + ] + }, + "physicalResourceId": "TaskDef-on-EcsCluster" + }, + "Update": { + "service": "CloudWatchEvents", + "apiVersion": "2015-10-07", + "action": "putTargets", + "parameters": { + "Rule": { + "Fn::Select": [ + 1, + { + "Fn::Split": [ + "/", + { + "Fn::Select": [ + 5, + { + "Fn::Split": [ + ":", + { + "Fn::GetAtt": [ + "Rule4C995B7F", + "Arn" + ] + } + ] + } + ] + } + ] + } + ] + }, + "Targets": [ + { + "Arn": { + "Fn::GetAtt": [ + "EcsCluster97242B84", + "Arn" + ] + }, + "Id": "TaskDef-on-EcsCluster", + "EcsParameters": { + "TaskDefinitionArn": { + "Ref": "TaskDef54694570" + }, + "LaunchType": "FARGATE", + "NetworkConfiguration": { + "awsvpcConfiguration": { + "Subnets": [ + { + "Ref": "VpcPrivateSubnet1Subnet536B997A" + } + ], + "AssignPublicIp": "DISABLED", + "SecurityGroups": [ + { + "Fn::GetAtt": [ + "TaskDefSecurityGroupD50E7CF0", + "GroupId" + ] + } + ] + } + }, + "TaskCount": 1 + }, + "Input": "{\"containerOverrides\":[{\"name\":\"TheContainer\",\"environment\":[{\"name\":\"I_WAS_TRIGGERED\",\"value\":\"From CloudWatch Events\"}]}]}", + "RoleArn": { + "Fn::GetAtt": [ + "TaskDefEventsRoleFB3B67B8", + "Arn" + ] + } + } + ] + }, + "physicalResourceId": "TaskDef-on-EcsCluster" + } + } + }, + "EventImageAdoptRepositoryDFAAC242": { + "Type": "Custom::ECRAdoptedRepository", + "Properties": { + "ServiceToken": { + "Fn::GetAtt": [ + "AdoptEcrRepositorydbc60defc59544bcaa5c28c95d68f62c52BE89E9", + "Arn" + ] + }, + "RepositoryName": { + "Fn::Select": [ + 0, + { + "Fn::Split": [ + "@sha256:", + { + "Ref": "EventImageImageNameE972A8B1" + } + ] + } + ] + } + }, + "DependsOn": [ + "AdoptEcrRepositorydbc60defc59544bcaa5c28c95d68f62cServiceRoleDefaultPolicy6BC8737C", + "AdoptEcrRepositorydbc60defc59544bcaa5c28c95d68f62cServiceRoleD788AA17" + ] + }, + "AdoptEcrRepositorydbc60defc59544bcaa5c28c95d68f62cServiceRoleD788AA17": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": { + "Fn::Join": [ + "", + [ + "lambda.", + { + "Ref": "AWS::URLSuffix" + } + ] + ] + } + } + } + ], + "Version": "2012-10-17" + }, + "ManagedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + } + }, + "AdoptEcrRepositorydbc60defc59544bcaa5c28c95d68f62cServiceRoleDefaultPolicy6BC8737C": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "ecr:GetRepositoryPolicy", + "ecr:SetRepositoryPolicy", + "ecr:DeleteRepository", + "ecr:ListImages", + "ecr:BatchDeleteImage" + ], + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":ecr:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":repository/", + { + "Fn::Select": [ + 0, + { + "Fn::Split": [ + "@sha256:", + { + "Ref": "EventImageImageNameE972A8B1" + } + ] + } + ] + } + ] + ] + } + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "AdoptEcrRepositorydbc60defc59544bcaa5c28c95d68f62cServiceRoleDefaultPolicy6BC8737C", + "Roles": [ + { + "Ref": "AdoptEcrRepositorydbc60defc59544bcaa5c28c95d68f62cServiceRoleD788AA17" + } + ] + } + }, + "AdoptEcrRepositorydbc60defc59544bcaa5c28c95d68f62c52BE89E9": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "S3Bucket": { + "Ref": "AdoptEcrRepositorydbc60defc59544bcaa5c28c95d68f62cCodeS3Bucket92AB06B6" + }, + "S3Key": { + "Fn::Join": [ + "", + [ + { + "Fn::Select": [ + 0, + { + "Fn::Split": [ + "||", + { + "Ref": "AdoptEcrRepositorydbc60defc59544bcaa5c28c95d68f62cCodeS3VersionKey393B7276" + } + ] + } + ] + }, + { + "Fn::Select": [ + 1, + { + "Fn::Split": [ + "||", + { + "Ref": "AdoptEcrRepositorydbc60defc59544bcaa5c28c95d68f62cCodeS3VersionKey393B7276" + } + ] + } + ] + } + ] + ] + } + }, + "Handler": "handler.handler", + "Role": { + "Fn::GetAtt": [ + "AdoptEcrRepositorydbc60defc59544bcaa5c28c95d68f62cServiceRoleD788AA17", + "Arn" + ] + }, + "Runtime": "nodejs8.10", + "Timeout": 300 + }, + "DependsOn": [ + "AdoptEcrRepositorydbc60defc59544bcaa5c28c95d68f62cServiceRoleDefaultPolicy6BC8737C", + "AdoptEcrRepositorydbc60defc59544bcaa5c28c95d68f62cServiceRoleD788AA17" + ] + }, + "TaskLoggingLogGroupC7E938D4": { + "Type": "AWS::Logs::LogGroup", + "DeletionPolicy": "Retain" + }, + "Rule4C995B7F": { + "Type": "AWS::Events::Rule", + "Properties": { + "ScheduleExpression": "rate(1 minute)", + "State": "ENABLED", + "Targets": [ + { + "Arn": { + "Fn::GetAtt": [ + "EcsCluster97242B84", + "Arn" + ] + }, + "EcsParameters": { + "TaskCount": 1, + "TaskDefinitionArn": { + "Ref": "TaskDef54694570" + } + }, + "Id": "TaskDef-on-EcsCluster", + "Input": "{\"containerOverrides\":[{\"name\":\"TheContainer\",\"environment\":[{\"name\":\"I_WAS_TRIGGERED\",\"value\":\"From CloudWatch Events\"}]}]}", + "RoleArn": { + "Fn::GetAtt": [ + "TaskDefEventsRoleFB3B67B8", + "Arn" + ] + } + } + ] + } + }, + "AWS679f53fac002430cb0da5b7982bd2287ServiceRoleC1EA0FF2": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": { + "Fn::Join": [ + "", + [ + "lambda.", + { + "Ref": "AWS::URLSuffix" + } + ] + ] + } + } + } + ], + "Version": "2012-10-17" + }, + "ManagedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + } + }, + "AWS679f53fac002430cb0da5b7982bd2287ServiceRoleDefaultPolicyD28E1A5E": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": "events:PutTargets", + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "Rule4C995B7F", + "Arn" + ] + } + }, + { + "Action": "iam:PassRole", + "Effect": "Allow", + "Resource": { + "Fn::GetAtt": [ + "TaskDefEventsRoleFB3B67B8", + "Arn" + ] + } + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "AWS679f53fac002430cb0da5b7982bd2287ServiceRoleDefaultPolicyD28E1A5E", + "Roles": [ + { + "Ref": "AWS679f53fac002430cb0da5b7982bd2287ServiceRoleC1EA0FF2" + } + ] + } + }, + "AWS679f53fac002430cb0da5b7982bd22872D164C4C": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "S3Bucket": { + "Ref": "AWS679f53fac002430cb0da5b7982bd2287CodeS3BucketF55839B6" + }, + "S3Key": { + "Fn::Join": [ + "", + [ + { + "Fn::Select": [ + 0, + { + "Fn::Split": [ + "||", + { + "Ref": "AWS679f53fac002430cb0da5b7982bd2287CodeS3VersionKey3C45B02F" + } + ] + } + ] + }, + { + "Fn::Select": [ + 1, + { + "Fn::Split": [ + "||", + { + "Ref": "AWS679f53fac002430cb0da5b7982bd2287CodeS3VersionKey3C45B02F" + } + ] + } + ] + } + ] + ] + } + }, + "Handler": "index.handler", + "Role": { + "Fn::GetAtt": [ + "AWS679f53fac002430cb0da5b7982bd2287ServiceRoleC1EA0FF2", + "Arn" + ] + }, + "Runtime": "nodejs10.x" + }, + "DependsOn": [ + "AWS679f53fac002430cb0da5b7982bd2287ServiceRoleDefaultPolicyD28E1A5E", + "AWS679f53fac002430cb0da5b7982bd2287ServiceRoleC1EA0FF2" + ] + } + }, + "Parameters": { + "EventImageImageNameE972A8B1": { + "Type": "String", + "Description": "ECR repository name and tag asset \"aws-ecs-integ-fargate/EventImage\"" + }, + "AdoptEcrRepositorydbc60defc59544bcaa5c28c95d68f62cCodeS3Bucket92AB06B6": { + "Type": "String", + "Description": "S3 bucket for asset \"aws-ecs-integ-fargate/AdoptEcrRepositorydbc60defc59544bcaa5c28c95d68f62c/Code\"" + }, + "AdoptEcrRepositorydbc60defc59544bcaa5c28c95d68f62cCodeS3VersionKey393B7276": { + "Type": "String", + "Description": "S3 key for asset version \"aws-ecs-integ-fargate/AdoptEcrRepositorydbc60defc59544bcaa5c28c95d68f62c/Code\"" + }, + "AdoptEcrRepositorydbc60defc59544bcaa5c28c95d68f62cCodeArtifactHash8BCBAA49": { + "Type": "String", + "Description": "Artifact hash for asset \"aws-ecs-integ-fargate/AdoptEcrRepositorydbc60defc59544bcaa5c28c95d68f62c/Code\"" + }, + "AWS679f53fac002430cb0da5b7982bd2287CodeS3BucketF55839B6": { + "Type": "String", + "Description": "S3 bucket for asset \"aws-ecs-integ-fargate/AWS679f53fac002430cb0da5b7982bd2287/Code\"" + }, + "AWS679f53fac002430cb0da5b7982bd2287CodeS3VersionKey3C45B02F": { + "Type": "String", + "Description": "S3 key for asset version \"aws-ecs-integ-fargate/AWS679f53fac002430cb0da5b7982bd2287/Code\"" + }, + "AWS679f53fac002430cb0da5b7982bd2287CodeArtifactHash49FACC2E": { + "Type": "String", + "Description": "Artifact hash for asset \"aws-ecs-integ-fargate/AWS679f53fac002430cb0da5b7982bd2287/Code\"" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-events-targets/test/ecs/integ.event-fargate-task.ts b/packages/@aws-cdk/aws-events-targets/test/ecs/integ.event-fargate-task.ts new file mode 100644 index 0000000000000..730e134e53e18 --- /dev/null +++ b/packages/@aws-cdk/aws-events-targets/test/ecs/integ.event-fargate-task.ts @@ -0,0 +1,51 @@ +import ec2 = require('@aws-cdk/aws-ec2'); +import ecs = require('@aws-cdk/aws-ecs'); +import events = require('@aws-cdk/aws-events'); +import cdk = require('@aws-cdk/cdk'); +import targets = require('../../lib'); + +import path = require('path'); + +const app = new cdk.App(); + +class EventStack extends cdk.Stack { + constructor(scope: cdk.App, id: string) { + super(scope, id); + + const vpc = new ec2.Vpc(this, 'Vpc', { maxAZs: 1 }); + + const cluster = new ecs.Cluster(this, 'EcsCluster', { vpc }); + + /// !show + // Create a Task Definition for the container to start + const taskDefinition = new ecs.FargateTaskDefinition(this, 'TaskDef'); + taskDefinition.addContainer('TheContainer', { + image: ecs.ContainerImage.fromAsset(this, 'EventImage', { + directory: path.resolve(__dirname, 'eventhandler-image') + }), + logging: new ecs.AwsLogDriver(this, 'TaskLogging', { streamPrefix: 'EventDemo' }) + }); + + // A rule that describes the event trigger (in this case a scheduled run) + const rule = new events.Rule(this, 'Rule', { + scheduleExpression: 'rate(1 minute)', + }); + + // Use EcsTask as the target of the Rule + rule.addTarget(new targets.EcsTask({ + cluster, + taskDefinition, + taskCount: 1, + containerOverrides: [{ + containerName: 'TheContainer', + environment: [ + { name: 'I_WAS_TRIGGERED', value: 'From CloudWatch Events' } + ] + }] + })); + /// !hide + } +} + +new EventStack(app, 'aws-ecs-integ-fargate'); +app.run(); diff --git a/packages/@aws-cdk/aws-events/package.json b/packages/@aws-cdk/aws-events/package.json index af77f6b21a823..e076836c545d7 100644 --- a/packages/@aws-cdk/aws-events/package.json +++ b/packages/@aws-cdk/aws-events/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-events", - "version": "0.32.0", + "version": "0.33.0", "description": "AWS CloudWatch Events Construct Library", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -61,19 +61,19 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "cdk-build-tools": "^0.32.0", - "cfn2ts": "^0.32.0", - "pkglint": "^0.32.0" + "@aws-cdk/assert": "^0.33.0", + "cdk-build-tools": "^0.33.0", + "cfn2ts": "^0.33.0", + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0" }, "homepage": "https://github.com/awslabs/aws-cdk", "peerDependencies": { - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0" }, "engines": { "node": ">= 8.10.0" @@ -83,4 +83,4 @@ "from-method:@aws-cdk/aws-events.Rule" ] } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-fsx/package.json b/packages/@aws-cdk/aws-fsx/package.json index 1f45d176d71d1..bdc52b8fdadba 100644 --- a/packages/@aws-cdk/aws-fsx/package.json +++ b/packages/@aws-cdk/aws-fsx/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-fsx", - "version": "0.32.0", + "version": "0.33.0", "description": "The CDK Construct Library for AWS::FSx", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -62,18 +62,18 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "cdk-build-tools": "^0.32.0", - "cfn2ts": "^0.32.0", - "pkglint": "^0.32.0" + "@aws-cdk/assert": "^0.33.0", + "cdk-build-tools": "^0.33.0", + "cfn2ts": "^0.33.0", + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "peerDependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "engines": { "node": ">= 8.10.0" } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-gamelift/package.json b/packages/@aws-cdk/aws-gamelift/package.json index cd6eba640fe54..fdc57c49370eb 100644 --- a/packages/@aws-cdk/aws-gamelift/package.json +++ b/packages/@aws-cdk/aws-gamelift/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-gamelift", - "version": "0.32.0", + "version": "0.33.0", "description": "The CDK Construct Library for AWS::GameLift", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -60,19 +60,19 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "cdk-build-tools": "^0.32.0", - "cfn2ts": "^0.32.0", - "pkglint": "^0.32.0" + "@aws-cdk/assert": "^0.33.0", + "cdk-build-tools": "^0.33.0", + "cfn2ts": "^0.33.0", + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "homepage": "https://github.com/awslabs/aws-cdk", "peerDependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "engines": { "node": ">= 8.10.0" } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-glue/package.json b/packages/@aws-cdk/aws-glue/package.json index ceb576f478a21..97dd37d9dc5b2 100644 --- a/packages/@aws-cdk/aws-glue/package.json +++ b/packages/@aws-cdk/aws-glue/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-glue", - "version": "0.32.0", + "version": "0.33.0", "description": "The CDK Construct Library for AWS::Glue", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -60,26 +60,26 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "cdk-build-tools": "^0.32.0", - "cdk-integ-tools": "^0.32.0", - "cfn2ts": "^0.32.0", - "pkglint": "^0.32.0" + "@aws-cdk/assert": "^0.33.0", + "cdk-build-tools": "^0.33.0", + "cdk-integ-tools": "^0.33.0", + "cfn2ts": "^0.33.0", + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/aws-kms": "^0.32.0", - "@aws-cdk/aws-s3": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/aws-kms": "^0.33.0", + "@aws-cdk/aws-s3": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0" }, "homepage": "https://github.com/awslabs/aws-cdk", "peerDependencies": { - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/aws-kms": "^0.32.0", - "@aws-cdk/aws-s3": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/aws-kms": "^0.33.0", + "@aws-cdk/aws-s3": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0" }, "engines": { "node": ">= 8.10.0" } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-greengrass/package.json b/packages/@aws-cdk/aws-greengrass/package.json index 09aa87945f4af..473503e230227 100644 --- a/packages/@aws-cdk/aws-greengrass/package.json +++ b/packages/@aws-cdk/aws-greengrass/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-greengrass", - "version": "0.32.0", + "version": "0.33.0", "description": "The CDK Construct Library for AWS::Greengrass", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -62,18 +62,18 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "cdk-build-tools": "^0.32.0", - "cfn2ts": "^0.32.0", - "pkglint": "^0.32.0" + "@aws-cdk/assert": "^0.33.0", + "cdk-build-tools": "^0.33.0", + "cfn2ts": "^0.33.0", + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "peerDependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "engines": { "node": ">= 8.10.0" } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-guardduty/package.json b/packages/@aws-cdk/aws-guardduty/package.json index 48ad4b0b47105..439875bc771c7 100644 --- a/packages/@aws-cdk/aws-guardduty/package.json +++ b/packages/@aws-cdk/aws-guardduty/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-guardduty", - "version": "0.32.0", + "version": "0.33.0", "description": "The CDK Construct Library for AWS::GuardDuty", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -60,19 +60,19 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "cdk-build-tools": "^0.32.0", - "cfn2ts": "^0.32.0", - "pkglint": "^0.32.0" + "@aws-cdk/assert": "^0.33.0", + "cdk-build-tools": "^0.33.0", + "cfn2ts": "^0.33.0", + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "homepage": "https://github.com/awslabs/aws-cdk", "peerDependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "engines": { "node": ">= 8.10.0" } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-iam/package.json b/packages/@aws-cdk/aws-iam/package.json index 109eecd2a8a81..a2c446a6f7ba2 100644 --- a/packages/@aws-cdk/aws-iam/package.json +++ b/packages/@aws-cdk/aws-iam/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-iam", - "version": "0.32.0", + "version": "0.33.0", "description": "CDK routines for easily assigning correct and minimal IAM permissions", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -62,22 +62,22 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "cdk-build-tools": "^0.32.0", - "cdk-integ-tools": "^0.32.0", - "cfn2ts": "^0.32.0", - "pkglint": "^0.32.0" + "@aws-cdk/assert": "^0.33.0", + "cdk-build-tools": "^0.33.0", + "cdk-integ-tools": "^0.33.0", + "cfn2ts": "^0.33.0", + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/cdk": "^0.32.0", - "@aws-cdk/region-info": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0", + "@aws-cdk/region-info": "^0.33.0" }, "peerDependencies": { - "@aws-cdk/cdk": "^0.32.0", - "@aws-cdk/region-info": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0", + "@aws-cdk/region-info": "^0.33.0" }, "homepage": "https://github.com/awslabs/aws-cdk", "engines": { "node": ">= 8.10.0" } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-iam/test/test.escape-hatch.ts b/packages/@aws-cdk/aws-iam/test/test.escape-hatch.ts new file mode 100644 index 0000000000000..942dd55127ed8 --- /dev/null +++ b/packages/@aws-cdk/aws-iam/test/test.escape-hatch.ts @@ -0,0 +1,98 @@ +// tests for the L1 escape hatches (overrides). those are in the IAM module +// because we want to verify them end-to-end, as a complement to the unit +// tests in the @aws-cdk/cdk module +import { expect } from '@aws-cdk/assert'; +import { Stack } from '@aws-cdk/cdk'; +import { Test } from 'nodeunit'; +import iam = require('../lib'); + +// tslint:disable:object-literal-key-quotes + +export = { + 'addPropertyOverride should allow overriding supported properties'(test: Test) { + const stack = new Stack(); + const user = new iam.User(stack, 'user', { + userName: 'MyUserName' + }); + + const cfn = user.node.findChild('Resource') as iam.CfnUser; + cfn.addPropertyOverride('UserName', 'OverriddenUserName'); + + expect(stack).toMatch({ + "Resources": { + "user2C2B57AE": { + "Type": "AWS::IAM::User", + "Properties": { + "UserName": "OverriddenUserName" + } + } + } + }); + test.done(); + }, + 'addPropertyOverrides should allow specifying arbitrary properties'(test: Test) { + // GIVEN + const stack = new Stack(); + const user = new iam.User(stack, 'user', { userName: 'MyUserName' }); + const cfn = user.node.findChild('Resource') as iam.CfnUser; + + // WHEN + cfn.addPropertyOverride('Hello.World', 'Boom'); + + // THEN + expect(stack).toMatch({ + "Resources": { + "user2C2B57AE": { + "Type": "AWS::IAM::User", + "Properties": { + "UserName": "MyUserName", + "Hello": { + "World": "Boom" + } + } + } + } + }); + + test.done(); + }, + 'addOverride should allow overriding properties'(test: Test) { + // GIVEN + const stack = new Stack(); + const user = new iam.User(stack, 'user', { userName: 'MyUserName' }); + const cfn = user.node.findChild('Resource') as iam.CfnUser; + cfn.options.updatePolicy = { useOnlineResharding: true }; + + // WHEN + cfn.addOverride('Properties.Hello.World', 'Bam'); + cfn.addOverride('Properties.UserName', 'HA!'); + cfn.addOverride('Joob.Jab', 'Jib'); + cfn.addOverride('Joob.Jab', 'Jib'); + cfn.addOverride('UpdatePolicy.UseOnlineResharding.Type', 'None'); + + // THEN + expect(stack).toMatch({ + "Resources": { + "user2C2B57AE": { + "Type": "AWS::IAM::User", + "Properties": { + "UserName": "HA!", + "Hello": { + "World": "Bam" + } + }, + "Joob": { + "Jab": "Jib" + }, + "UpdatePolicy": { + "UseOnlineResharding": { + "Type": "None" + } + } + } + } + }); + + test.done(); + } +}; \ No newline at end of file diff --git a/packages/@aws-cdk/aws-inspector/package.json b/packages/@aws-cdk/aws-inspector/package.json index ac4634b084303..5418bf836fd1f 100644 --- a/packages/@aws-cdk/aws-inspector/package.json +++ b/packages/@aws-cdk/aws-inspector/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-inspector", - "version": "0.32.0", + "version": "0.33.0", "description": "The CDK Construct Library for AWS::Inspector", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -60,19 +60,19 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "cdk-build-tools": "^0.32.0", - "cfn2ts": "^0.32.0", - "pkglint": "^0.32.0" + "@aws-cdk/assert": "^0.33.0", + "cdk-build-tools": "^0.33.0", + "cfn2ts": "^0.33.0", + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "homepage": "https://github.com/awslabs/aws-cdk", "peerDependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "engines": { "node": ">= 8.10.0" } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-iot/package.json b/packages/@aws-cdk/aws-iot/package.json index 08c97f04d70f1..803ca3c25af15 100644 --- a/packages/@aws-cdk/aws-iot/package.json +++ b/packages/@aws-cdk/aws-iot/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-iot", - "version": "0.32.0", + "version": "0.33.0", "description": "The CDK Construct Library for AWS::IoT", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -60,19 +60,19 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "cdk-build-tools": "^0.32.0", - "cfn2ts": "^0.32.0", - "pkglint": "^0.32.0" + "@aws-cdk/assert": "^0.33.0", + "cdk-build-tools": "^0.33.0", + "cfn2ts": "^0.33.0", + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "homepage": "https://github.com/awslabs/aws-cdk", "peerDependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "engines": { "node": ">= 8.10.0" } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-iot1click/package.json b/packages/@aws-cdk/aws-iot1click/package.json index a259e43eda75e..3f1caf916d913 100644 --- a/packages/@aws-cdk/aws-iot1click/package.json +++ b/packages/@aws-cdk/aws-iot1click/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-iot1click", - "version": "0.32.0", + "version": "0.33.0", "description": "The CDK Construct Library for AWS::IoT1Click", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -61,18 +61,18 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "cdk-build-tools": "^0.32.0", - "cfn2ts": "^0.32.0", - "pkglint": "^0.32.0" + "@aws-cdk/assert": "^0.33.0", + "cdk-build-tools": "^0.33.0", + "cfn2ts": "^0.33.0", + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "peerDependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "engines": { "node": ">= 8.10.0" } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-iotanalytics/package.json b/packages/@aws-cdk/aws-iotanalytics/package.json index 274b1e485c2ca..881dd9ea29192 100644 --- a/packages/@aws-cdk/aws-iotanalytics/package.json +++ b/packages/@aws-cdk/aws-iotanalytics/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-iotanalytics", - "version": "0.32.0", + "version": "0.33.0", "description": "The CDK Construct Library for AWS::IoTAnalytics", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -62,18 +62,18 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "cdk-build-tools": "^0.32.0", - "cfn2ts": "^0.32.0", - "pkglint": "^0.32.0" + "@aws-cdk/assert": "^0.33.0", + "cdk-build-tools": "^0.33.0", + "cfn2ts": "^0.33.0", + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "peerDependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "engines": { "node": ">= 8.10.0" } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-kinesis/package.json b/packages/@aws-cdk/aws-kinesis/package.json index 0c8fede868c44..ae395dc47d775 100644 --- a/packages/@aws-cdk/aws-kinesis/package.json +++ b/packages/@aws-cdk/aws-kinesis/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-kinesis", - "version": "0.32.0", + "version": "0.33.0", "description": "CDK Constructs for AWS Kinesis", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -59,25 +59,25 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "cdk-build-tools": "^0.32.0", - "cfn2ts": "^0.32.0", - "pkglint": "^0.32.0" + "@aws-cdk/assert": "^0.33.0", + "cdk-build-tools": "^0.33.0", + "cfn2ts": "^0.33.0", + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/aws-kms": "^0.32.0", - "@aws-cdk/aws-logs": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/aws-kms": "^0.33.0", + "@aws-cdk/aws-logs": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0" }, "homepage": "https://github.com/awslabs/aws-cdk", "peerDependencies": { - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/aws-kms": "^0.32.0", - "@aws-cdk/aws-logs": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/aws-kms": "^0.33.0", + "@aws-cdk/aws-logs": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0" }, "engines": { "node": ">= 8.10.0" } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-kinesisanalytics/package.json b/packages/@aws-cdk/aws-kinesisanalytics/package.json index 6642d54db51a7..53496095af73f 100644 --- a/packages/@aws-cdk/aws-kinesisanalytics/package.json +++ b/packages/@aws-cdk/aws-kinesisanalytics/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-kinesisanalytics", - "version": "0.32.0", + "version": "0.33.0", "description": "The CDK Construct Library for AWS::KinesisAnalytics", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -63,19 +63,19 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "cdk-build-tools": "^0.32.0", - "cfn2ts": "^0.32.0", - "pkglint": "^0.32.0" + "@aws-cdk/assert": "^0.33.0", + "cdk-build-tools": "^0.33.0", + "cfn2ts": "^0.33.0", + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "homepage": "https://github.com/awslabs/aws-cdk", "peerDependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "engines": { "node": ">= 8.10.0" } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-kinesisfirehose/package.json b/packages/@aws-cdk/aws-kinesisfirehose/package.json index 600816e08ba99..4bffefff26804 100644 --- a/packages/@aws-cdk/aws-kinesisfirehose/package.json +++ b/packages/@aws-cdk/aws-kinesisfirehose/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-kinesisfirehose", - "version": "0.32.0", + "version": "0.33.0", "description": "The CDK Construct Library for AWS::KinesisFirehose", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -60,19 +60,19 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "cdk-build-tools": "^0.32.0", - "cfn2ts": "^0.32.0", - "pkglint": "^0.32.0" + "@aws-cdk/assert": "^0.33.0", + "cdk-build-tools": "^0.33.0", + "cfn2ts": "^0.33.0", + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "homepage": "https://github.com/awslabs/aws-cdk", "peerDependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "engines": { "node": ">= 8.10.0" } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-kms/package.json b/packages/@aws-cdk/aws-kms/package.json index 39583d9596656..9017cfadc947a 100644 --- a/packages/@aws-cdk/aws-kms/package.json +++ b/packages/@aws-cdk/aws-kms/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-kms", - "version": "0.32.0", + "version": "0.33.0", "description": "CDK Constructs for AWS KMS", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -60,22 +60,22 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "cdk-build-tools": "^0.32.0", - "cdk-integ-tools": "^0.32.0", - "cfn2ts": "^0.32.0", - "pkglint": "^0.32.0" + "@aws-cdk/assert": "^0.33.0", + "cdk-build-tools": "^0.33.0", + "cdk-integ-tools": "^0.33.0", + "cfn2ts": "^0.33.0", + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0" }, "homepage": "https://github.com/awslabs/aws-cdk", "peerDependencies": { - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0" }, "engines": { "node": ">= 8.10.0" } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-lambda-event-sources/package.json b/packages/@aws-cdk/aws-lambda-event-sources/package.json index 708d14f182efa..99e9d4290bd74 100644 --- a/packages/@aws-cdk/aws-lambda-event-sources/package.json +++ b/packages/@aws-cdk/aws-lambda-event-sources/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-lambda-event-sources", - "version": "0.32.0", + "version": "0.33.0", "description": "Event sources for AWS Lambda", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -56,39 +56,39 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "cdk-build-tools": "^0.32.0", - "cdk-integ-tools": "^0.32.0", - "pkglint": "^0.32.0" + "@aws-cdk/assert": "^0.33.0", + "cdk-build-tools": "^0.33.0", + "cdk-integ-tools": "^0.33.0", + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/aws-apigateway": "^0.32.0", - "@aws-cdk/aws-dynamodb": "^0.32.0", - "@aws-cdk/aws-events": "^0.32.0", - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/aws-kinesis": "^0.32.0", - "@aws-cdk/aws-lambda": "^0.32.0", - "@aws-cdk/aws-s3": "^0.32.0", - "@aws-cdk/aws-s3-notifications": "^0.32.0", - "@aws-cdk/aws-sns": "^0.32.0", - "@aws-cdk/aws-sqs": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/aws-apigateway": "^0.33.0", + "@aws-cdk/aws-dynamodb": "^0.33.0", + "@aws-cdk/aws-events": "^0.33.0", + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/aws-kinesis": "^0.33.0", + "@aws-cdk/aws-lambda": "^0.33.0", + "@aws-cdk/aws-s3": "^0.33.0", + "@aws-cdk/aws-s3-notifications": "^0.33.0", + "@aws-cdk/aws-sns": "^0.33.0", + "@aws-cdk/aws-sqs": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0" }, "homepage": "https://github.com/awslabs/aws-cdk", "peerDependencies": { - "@aws-cdk/aws-apigateway": "^0.32.0", - "@aws-cdk/aws-dynamodb": "^0.32.0", - "@aws-cdk/aws-events": "^0.32.0", - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/aws-kinesis": "^0.32.0", - "@aws-cdk/aws-lambda": "^0.32.0", - "@aws-cdk/aws-s3": "^0.32.0", - "@aws-cdk/aws-s3-notifications": "^0.32.0", - "@aws-cdk/aws-sns": "^0.32.0", - "@aws-cdk/aws-sqs": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/aws-apigateway": "^0.33.0", + "@aws-cdk/aws-dynamodb": "^0.33.0", + "@aws-cdk/aws-events": "^0.33.0", + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/aws-kinesis": "^0.33.0", + "@aws-cdk/aws-lambda": "^0.33.0", + "@aws-cdk/aws-s3": "^0.33.0", + "@aws-cdk/aws-s3-notifications": "^0.33.0", + "@aws-cdk/aws-sns": "^0.33.0", + "@aws-cdk/aws-sqs": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0" }, "engines": { "node": ">= 8.10.0" } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-lambda/lib/function-base.ts b/packages/@aws-cdk/aws-lambda/lib/function-base.ts index c60a2fccb97e3..fdd779bd310f6 100644 --- a/packages/@aws-cdk/aws-lambda/lib/function-base.ts +++ b/packages/@aws-cdk/aws-lambda/lib/function-base.ts @@ -238,7 +238,6 @@ export abstract class FunctionBase extends Resource implements IFunction { action: 'lambda:InvokeFunction', }); }, - dependencyRoots: [], node: this.node, }, }); diff --git a/packages/@aws-cdk/aws-lambda/package-lock.json b/packages/@aws-cdk/aws-lambda/package-lock.json index 04a67fc7e77f9..1cb147ab6ced7 100644 --- a/packages/@aws-cdk/aws-lambda/package-lock.json +++ b/packages/@aws-cdk/aws-lambda/package-lock.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-lambda", - "version": "0.32.0", + "version": "0.33.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/@aws-cdk/aws-lambda/package.json b/packages/@aws-cdk/aws-lambda/package.json index 44484c7459c9f..cc01a46d59cb5 100644 --- a/packages/@aws-cdk/aws-lambda/package.json +++ b/packages/@aws-cdk/aws-lambda/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-lambda", - "version": "0.32.0", + "version": "0.33.0", "description": "CDK Constructs for AWS Lambda", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -64,47 +64,47 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", + "@aws-cdk/assert": "^0.33.0", "@types/aws-lambda": "^8.10.24", "@types/lodash": "^4.14.128", "@types/nock": "^9.3.1", "@types/sinon": "^7.0.11", "aws-sdk": "^2.438.0", "aws-sdk-mock": "^4.4.0", - "cdk-build-tools": "^0.32.0", - "cdk-integ-tools": "^0.32.0", - "cfn2ts": "^0.32.0", + "cdk-build-tools": "^0.33.0", + "cdk-integ-tools": "^0.33.0", + "cfn2ts": "^0.33.0", "lodash": "^4.17.11", "nock": "^10.0.6", - "pkglint": "^0.32.0", + "pkglint": "^0.33.0", "sinon": "^7.3.1" }, "dependencies": { - "@aws-cdk/assets": "^0.32.0", - "@aws-cdk/aws-cloudwatch": "^0.32.0", - "@aws-cdk/aws-ec2": "^0.32.0", - "@aws-cdk/aws-events": "^0.32.0", - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/aws-logs": "^0.32.0", - "@aws-cdk/aws-s3": "^0.32.0", - "@aws-cdk/aws-sqs": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0", - "@aws-cdk/cx-api": "^0.32.0" + "@aws-cdk/assets": "^0.33.0", + "@aws-cdk/aws-cloudwatch": "^0.33.0", + "@aws-cdk/aws-ec2": "^0.33.0", + "@aws-cdk/aws-events": "^0.33.0", + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/aws-logs": "^0.33.0", + "@aws-cdk/aws-s3": "^0.33.0", + "@aws-cdk/aws-sqs": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0", + "@aws-cdk/cx-api": "^0.33.0" }, "homepage": "https://github.com/awslabs/aws-cdk", "peerDependencies": { - "@aws-cdk/assets": "^0.32.0", - "@aws-cdk/aws-cloudwatch": "^0.32.0", - "@aws-cdk/aws-ec2": "^0.32.0", - "@aws-cdk/aws-events": "^0.32.0", - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/aws-logs": "^0.32.0", - "@aws-cdk/aws-s3": "^0.32.0", - "@aws-cdk/aws-sqs": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0", - "@aws-cdk/cx-api": "^0.32.0" + "@aws-cdk/assets": "^0.33.0", + "@aws-cdk/aws-cloudwatch": "^0.33.0", + "@aws-cdk/aws-ec2": "^0.33.0", + "@aws-cdk/aws-events": "^0.33.0", + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/aws-logs": "^0.33.0", + "@aws-cdk/aws-s3": "^0.33.0", + "@aws-cdk/aws-sqs": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0", + "@aws-cdk/cx-api": "^0.33.0" }, "engines": { "node": ">= 8.10.0" } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-logs-destinations/package-lock.json b/packages/@aws-cdk/aws-logs-destinations/package-lock.json index fa65e91075951..7dfa2a026e3d6 100644 --- a/packages/@aws-cdk/aws-logs-destinations/package-lock.json +++ b/packages/@aws-cdk/aws-logs-destinations/package-lock.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-logs-destinations", - "version": "0.32.0", + "version": "0.33.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/@aws-cdk/aws-logs-destinations/package.json b/packages/@aws-cdk/aws-logs-destinations/package.json index 2baa1c559cf6d..12d1ca01907e2 100644 --- a/packages/@aws-cdk/aws-logs-destinations/package.json +++ b/packages/@aws-cdk/aws-logs-destinations/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-logs-destinations", - "version": "0.32.0", + "version": "0.33.0", "description": "Log Destinations for AWS CloudWatch Logs", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -68,29 +68,29 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "cdk-build-tools": "^0.32.0", - "cdk-integ-tools": "^0.32.0", - "cfn2ts": "^0.32.0", - "pkglint": "^0.32.0", - "jest": "^24.7.1" + "@aws-cdk/assert": "^0.33.0", + "cdk-build-tools": "^0.33.0", + "cdk-integ-tools": "^0.33.0", + "cfn2ts": "^0.33.0", + "jest": "^24.7.1", + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/aws-kinesis": "^0.32.0", - "@aws-cdk/aws-lambda": "^0.32.0", - "@aws-cdk/aws-logs": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/aws-kinesis": "^0.33.0", + "@aws-cdk/aws-lambda": "^0.33.0", + "@aws-cdk/aws-logs": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0" }, "homepage": "https://github.com/awslabs/aws-cdk", "peerDependencies": { - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/aws-kinesis": "^0.32.0", - "@aws-cdk/aws-lambda": "^0.32.0", - "@aws-cdk/aws-logs": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/aws-kinesis": "^0.33.0", + "@aws-cdk/aws-lambda": "^0.33.0", + "@aws-cdk/aws-logs": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0" }, "engines": { "node": ">= 8.10.0" } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-logs/package.json b/packages/@aws-cdk/aws-logs/package.json index 7bcaddb51b1ab..6c99d96000a6b 100644 --- a/packages/@aws-cdk/aws-logs/package.json +++ b/packages/@aws-cdk/aws-logs/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-logs", - "version": "0.32.0", + "version": "0.33.0", "description": "The CDK Construct Library for AWS::Logs", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -60,22 +60,22 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "cdk-build-tools": "^0.32.0", - "cdk-integ-tools": "^0.32.0", - "cfn2ts": "^0.32.0", - "pkglint": "^0.32.0" + "@aws-cdk/assert": "^0.33.0", + "cdk-build-tools": "^0.33.0", + "cdk-integ-tools": "^0.33.0", + "cfn2ts": "^0.33.0", + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/aws-cloudwatch": "^0.32.0", - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/aws-cloudwatch": "^0.33.0", + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0" }, "homepage": "https://github.com/awslabs/aws-cdk", "peerDependencies": { - "@aws-cdk/aws-cloudwatch": "^0.32.0", - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/aws-cloudwatch": "^0.33.0", + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0" }, "engines": { "node": ">= 8.10.0" @@ -85,4 +85,4 @@ "props-no-arn-refs:@aws-cdk/aws-logs.CrossAccountDestinationProps.targetArn" ] } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-mediastore/package.json b/packages/@aws-cdk/aws-mediastore/package.json index 3936c8238590b..3f17673e2653c 100644 --- a/packages/@aws-cdk/aws-mediastore/package.json +++ b/packages/@aws-cdk/aws-mediastore/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-mediastore", - "version": "0.32.0", + "version": "0.33.0", "description": "The CDK Construct Library for AWS::MediaStore", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -63,18 +63,18 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "cdk-build-tools": "^0.32.0", - "cfn2ts": "^0.32.0", - "pkglint": "^0.32.0" + "@aws-cdk/assert": "^0.33.0", + "cdk-build-tools": "^0.33.0", + "cfn2ts": "^0.33.0", + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "peerDependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "engines": { "node": ">= 8.10.0" } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-neptune/package.json b/packages/@aws-cdk/aws-neptune/package.json index 216355ac9ad12..886b2a650b20f 100644 --- a/packages/@aws-cdk/aws-neptune/package.json +++ b/packages/@aws-cdk/aws-neptune/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-neptune", - "version": "0.32.0", + "version": "0.33.0", "description": "The CDK Construct Library for AWS::Neptune", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -61,18 +61,18 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "cdk-build-tools": "^0.32.0", - "cfn2ts": "^0.32.0", - "pkglint": "^0.32.0" + "@aws-cdk/assert": "^0.33.0", + "cdk-build-tools": "^0.33.0", + "cfn2ts": "^0.33.0", + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "peerDependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "engines": { "node": ">= 8.10.0" } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-opsworks/package.json b/packages/@aws-cdk/aws-opsworks/package.json index bdc597da8ff6b..04b94d867f3a3 100644 --- a/packages/@aws-cdk/aws-opsworks/package.json +++ b/packages/@aws-cdk/aws-opsworks/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-opsworks", - "version": "0.32.0", + "version": "0.33.0", "description": "The CDK Construct Library for AWS::OpsWorks", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -60,19 +60,19 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "cdk-build-tools": "^0.32.0", - "cfn2ts": "^0.32.0", - "pkglint": "^0.32.0" + "@aws-cdk/assert": "^0.33.0", + "cdk-build-tools": "^0.33.0", + "cfn2ts": "^0.33.0", + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "homepage": "https://github.com/awslabs/aws-cdk", "peerDependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "engines": { "node": ">= 8.10.0" } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-opsworkscm/package.json b/packages/@aws-cdk/aws-opsworkscm/package.json index 15bf8125a3d49..85581507e2bdd 100644 --- a/packages/@aws-cdk/aws-opsworkscm/package.json +++ b/packages/@aws-cdk/aws-opsworkscm/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-opsworkscm", - "version": "0.32.0", + "version": "0.33.0", "description": "The CDK Construct Library for AWS::OpsWorksCM", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -62,18 +62,18 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "cdk-build-tools": "^0.32.0", - "cfn2ts": "^0.32.0", - "pkglint": "^0.32.0" + "@aws-cdk/assert": "^0.33.0", + "cdk-build-tools": "^0.33.0", + "cfn2ts": "^0.33.0", + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "peerDependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "engines": { "node": ">= 8.10.0" } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-pinpointemail/package.json b/packages/@aws-cdk/aws-pinpointemail/package.json index 3383dd1aa9f35..1113efb286067 100644 --- a/packages/@aws-cdk/aws-pinpointemail/package.json +++ b/packages/@aws-cdk/aws-pinpointemail/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-pinpointemail", - "version": "0.32.0", + "version": "0.33.0", "description": "The CDK Construct Library for AWS::PinpointEmail", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -63,18 +63,18 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "cdk-build-tools": "^0.32.0", - "cfn2ts": "^0.32.0", - "pkglint": "^0.32.0" + "@aws-cdk/assert": "^0.33.0", + "cdk-build-tools": "^0.33.0", + "cfn2ts": "^0.33.0", + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "peerDependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "engines": { "node": ">= 8.10.0" } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-quickstarts/README.md b/packages/@aws-cdk/aws-quickstarts/README.md index a4c76aeba0064..d1408d75458c1 100644 --- a/packages/@aws-cdk/aws-quickstarts/README.md +++ b/packages/@aws-cdk/aws-quickstarts/README.md @@ -1,2 +1,5 @@ ## AWS Quickstarts for the CDK -This module is part of the [AWS Cloud Development Kit](https://github.com/awslabs/aws-cdk) project. \ No newline at end of file + +This module has been deprecated. Use `@aws-cdk/aws-cloudformation.CfnStack` instead. + +This module is part of the [AWS Cloud Development Kit](https://github.com/awslabs/aws-cdk) project. diff --git a/packages/@aws-cdk/aws-quickstarts/lib/database.ts b/packages/@aws-cdk/aws-quickstarts/lib/database.ts deleted file mode 100644 index b142f5c81b408..0000000000000 --- a/packages/@aws-cdk/aws-quickstarts/lib/database.ts +++ /dev/null @@ -1,54 +0,0 @@ -import ec2 = require('@aws-cdk/aws-ec2'); -import rds = require('@aws-cdk/aws-rds'); -import cdk = require('@aws-cdk/cdk'); - -export interface SqlServerProps { - readonly instanceClass?: string; - readonly engine?: string; - readonly engineVersion?: string; - readonly licenseModel?: string; - readonly masterUsername: string; - readonly masterPassword: string; - readonly allocatedStorage?: number; - readonly vpc: ec2.IVpc; -} - -/** - * An instance of Microsoft SQL server with associated security groups - */ -export class SqlServer extends cdk.Construct implements ec2.IConnectable { - private static readonly PORT = 1433; - public readonly connections: ec2.Connections; - - constructor(scope: cdk.Construct, id: string, props: SqlServerProps) { - super(scope, id); - - const securityGroup = new ec2.SecurityGroup(this, 'SecurityGroup', { - vpc: props.vpc, - description: 'Database security group', - }); - - const subnetGroup = new rds.CfnDBSubnetGroup(this, 'Subnet', { - subnetIds: props.vpc.privateSubnets.map(privateSubnet => privateSubnet.subnetId), - dbSubnetGroupDescription: 'Database subnet group', - }); - - const allocatedStorage = props.allocatedStorage !== undefined ? props.allocatedStorage : 200; - - new rds.CfnDBInstance(this, 'Resource', { - allocatedStorage: allocatedStorage.toString(), - dbInstanceClass: props.instanceClass || 'db.m4.large', - engine: props.engine || 'sqlserver-se', - engineVersion: props.engineVersion || '13.00.4422.0.v1', - licenseModel: props.licenseModel || 'license-included', - masterUsername: props.masterUsername, - masterUserPassword: props.masterPassword, - port: SqlServer.PORT.toString(), - dbSubnetGroupName: subnetGroup.ref, - vpcSecurityGroups: [ securityGroup.securityGroupId ] - }); - - const defaultPortRange = new ec2.TcpPort(SqlServer.PORT); - this.connections = new ec2.Connections({ securityGroups: [securityGroup], defaultPortRange }); - } -} diff --git a/packages/@aws-cdk/aws-quickstarts/lib/index.ts b/packages/@aws-cdk/aws-quickstarts/lib/index.ts index d6df983e2fb9e..bc1a13d260a6d 100644 --- a/packages/@aws-cdk/aws-quickstarts/lib/index.ts +++ b/packages/@aws-cdk/aws-quickstarts/lib/index.ts @@ -1,2 +1,2 @@ -export * from './database'; -export * from './rdgw'; +// tslint:disable-next-line:no-console +console.error(`ERROR: The @aws-cdk/aws-quickstarts module has been deprecated`); diff --git a/packages/@aws-cdk/aws-quickstarts/lib/rdgw.ts b/packages/@aws-cdk/aws-quickstarts/lib/rdgw.ts deleted file mode 100644 index 8cab04917e20e..0000000000000 --- a/packages/@aws-cdk/aws-quickstarts/lib/rdgw.ts +++ /dev/null @@ -1,56 +0,0 @@ -import { CfnStack } from '@aws-cdk/aws-cloudformation'; -import ec2 = require('@aws-cdk/aws-ec2'); -import cdk = require('@aws-cdk/cdk'); - -export interface RemoteDesktopGatewayProps { - readonly rdgwCIDR: string; - readonly vpc: ec2.IVpc; - readonly keyPairName: string; - - readonly adminPassword: string; - readonly adminUser?: string; - - readonly domainDNSName?: string; - readonly numberOfRDGWHosts?: number; - readonly qss3BucketName?: string; - readonly qss3KeyPrefix?: string; - readonly rdgwInstanceType?: string; -} - -/** - * Embed the Remote Desktop Gateway AWS QuickStart - */ -export class RemoteDesktopGateway extends cdk.Construct implements ec2.IConnectable { - private static readonly PORT = 3389; - public readonly connections: ec2.Connections; - - constructor(scope: cdk.Construct, id: string, props: RemoteDesktopGatewayProps) { - super(scope, id); - - const params: any = { - RDGWCIDR: props.rdgwCIDR, - VPCID: props.vpc.vpcId, - PublicSubnet1ID: props.vpc.publicSubnets[0].subnetId, - PublicSubnet2ID: props.vpc.publicSubnets[1].subnetId, - AdminPassword: props.adminPassword, - AdminUser: props.adminUser, - DomainDNSName: props.domainDNSName, - KeyPairName: props.keyPairName, - NumberOfRDGWHosts: props.numberOfRDGWHosts, - QSS3BucketName: props.qss3BucketName, - QSS3KeyPrefix: props.qss3KeyPrefix, - RDGWInstanceType: props.rdgwInstanceType, - }; - - const nestedStack = new CfnStack(this, 'Resource', { - templateUrl: 'https://s3.amazonaws.com/quickstart-reference/microsoft/rdgateway/latest/templates/rdgw-standalone.template', - parameters: params - }); - - const securityGroup = ec2.SecurityGroup.fromSecurityGroupId(this, 'SecurityGroup', - nestedStack.getAtt('Outputs.RemoteDesktopGatewaySGID').toString()); - - const defaultPortRange = new ec2.TcpPort(RemoteDesktopGateway.PORT); - this.connections = new ec2.Connections({ securityGroups: [securityGroup], defaultPortRange }); - } -} diff --git a/packages/@aws-cdk/aws-quickstarts/package.json b/packages/@aws-cdk/aws-quickstarts/package.json index 14ea699649ac3..11ef6c4963f7a 100644 --- a/packages/@aws-cdk/aws-quickstarts/package.json +++ b/packages/@aws-cdk/aws-quickstarts/package.json @@ -1,7 +1,8 @@ { "name": "@aws-cdk/aws-quickstarts", - "version": "0.32.0", + "version": "0.33.0", "description": "AWS Quickstarts for the CDK", + "deprecated": "This module has been deprecated. Use `@aws-cdk/aws-cloudformation.CfnStack` instead", "main": "lib/index.js", "types": "lib/index.d.ts", "jsii": { @@ -55,24 +56,10 @@ }, "license": "Apache-2.0", "devDependencies": { - "cdk-build-tools": "^0.32.0", - "pkglint": "^0.32.0" - }, - "dependencies": { - "@aws-cdk/aws-cloudformation": "^0.32.0", - "@aws-cdk/aws-ec2": "^0.32.0", - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/aws-rds": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0" + "cdk-build-tools": "^0.33.0", + "pkglint": "^0.33.0" }, "homepage": "https://github.com/awslabs/aws-cdk", - "peerDependencies": { - "@aws-cdk/aws-cloudformation": "^0.32.0", - "@aws-cdk/aws-ec2": "^0.32.0", - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/aws-rds": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0" - }, "engines": { "node": ">= 8.10.0" }, diff --git a/packages/@aws-cdk/aws-ram/package.json b/packages/@aws-cdk/aws-ram/package.json index d59c6eccd65fe..01ba6dd5278ab 100644 --- a/packages/@aws-cdk/aws-ram/package.json +++ b/packages/@aws-cdk/aws-ram/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-ram", - "version": "0.32.0", + "version": "0.33.0", "description": "The CDK Construct Library for AWS::RAM", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -62,18 +62,18 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "cdk-build-tools": "^0.32.0", - "cfn2ts": "^0.32.0", - "pkglint": "^0.32.0" + "@aws-cdk/assert": "^0.33.0", + "cdk-build-tools": "^0.33.0", + "cfn2ts": "^0.33.0", + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "peerDependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "engines": { "node": ">= 8.10.0" } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-rds/README.md b/packages/@aws-cdk/aws-rds/README.md index 958fe1e3f4988..9cff2ac89fdc0 100644 --- a/packages/@aws-cdk/aws-rds/README.md +++ b/packages/@aws-cdk/aws-rds/README.md @@ -1,27 +1,8 @@ ## AWS RDS Construct Library -The `aws-cdk-rds` package contains Constructs for setting up RDS instances. - -> Note: the functionality this package is currently limited, as the CDK team is -> focusing on other use cases first. If your use case is not listed below, you -> will have to use achieve it using CloudFormation resources. -> -> If you would like to help improve the state of this library, Pull Requests are -> welcome. - -Supported: - -* Clustered databases - -Not supported: - -* Instance databases -* Setting up from a snapshot - - ### Starting a Clustered Database -To set up a clustered database (like Aurora), create an instance of `DatabaseCluster`. You must +To set up a clustered database (like Aurora), define a `DatabaseCluster`. You must always launch a database in a VPC. Use the `vpcSubnets` attribute to control whether your instances will be launched privately or publicly: @@ -45,33 +26,84 @@ By default, the master password will be generated and stored in AWS Secrets Mana Your cluster will be empty by default. To add a default database upon construction, specify the `defaultDatabaseName` attribute. +### Starting an Instance Database +To set up a instance database, define a `DatabaseInstance`. You must +always launch a database in a VPC. Use the `vpcSubnets` attribute to control whether +your instances will be launched privately or publicly: + +```ts +const instance = new DatabaseInstance(stack, 'Instance', { + engine: rds.DatabaseInstanceEngine.OracleSE1, + instanceClass: new ec2.InstanceTypePair(ec2.InstanceClass.Burstable2, ec2.InstanceSize.Small), + masterUsername: 'syscdk', + vpc +}); +``` +By default, the master password will be generated and stored in AWS Secrets Manager. + +Use `DatabaseInstanceFromSnapshot` and `DatabaseInstanceReadReplica` to create an instance from snapshot or +a source database respectively: + +```ts +new DatabaseInstanceFromSnapshot(stack, 'Instance', { + snapshotIdentifier: 'my-snapshot', + engine: rds.DatabaseInstanceEngine.Postgres, + instanceClass: new ec2.InstanceTypePair(ec2.InstanceClass.Burstable2, ec2.InstanceSize.Large), + vpc +}); + +new DatabaseInstanceReadReplica(stack, 'ReadReplica', { + sourceDatabaseInstance: sourceInstance, + engine: rds.DatabaseInstanceEngine.Postgres, + instanceClass: new ec2.InstanceTypePair(ec2.InstanceClass.Burstable2, ec2.InstanceSize.Large), + vpc +}); +``` +Creating a "production" Oracle database instance with option and parameter groups: + +[example of setting up a production oracle instance](test/integ.instance.lit.ts) + + +### Instance events +To define Amazon CloudWatch event rules for database instances, use the `onEvent` +method: + +```ts +const rule = instance.onEvent('InstanceEvent', { target: new targets.LambdaFunction(fn) }); +``` + ### Connecting -To control who can access the cluster, use the `.connections` attribute. RDS database have +To control who can access the cluster or instance, use the `.connections` attribute. RDS databases have a default port, so you don't need to specify the port: ```ts cluster.connections.allowFromAnyIpv4('Open to the world'); ``` -The endpoints to access your database will be available as the `.clusterEndpoint` and `.readerEndpoint` +The endpoints to access your database cluster will be available as the `.clusterEndpoint` and `.readerEndpoint` attributes: ```ts const writeAddress = cluster.clusterEndpoint.socketAddress; // "HOSTNAME:PORT" ``` +For an instance database: +```ts +const address = instance.instanceEndpoint.socketAddress; // "HOSTNAME:PORT" +``` + ### Rotating master password When the master password is generated and stored in AWS Secrets Manager, it can be rotated automatically: -[example of setting up master password rotation](test/integ.cluster-rotation.lit.ts) +[example of setting up master password rotation for a cluster](test/integ.cluster-rotation.lit.ts) Rotation of the master password is also supported for an existing cluster: ```ts -new RotationSingleUser(stack, 'Rotation', { +new SecretRotation(stack, 'Rotation', { secret: importedSecret, - engine: DatabaseEngine.Oracle, - target: importedCluster, + application: SecretRotationApplication.OracleRotationSingleUser + target: importedCluster, // or importedInstance vpc: importedVpc, }) ``` @@ -87,3 +119,13 @@ The `importedSecret` must be a JSON string with the following format: "port": "" } ``` + +### Metrics +Database instances expose metrics (`cloudwatch.Metric`): +```ts +// The number of database connections in use (average over 5 minutes) +const dbConnections = instance.metricDatabaseConnections(); + +// The average amount of time taken per disk I/O operation (average over 1 minute) +const readLatency = instance.metric('ReadLatency', { statistic: 'Average', periodSec: 60 }); +``` diff --git a/packages/@aws-cdk/aws-rds/lib/cluster-parameter-group.ts b/packages/@aws-cdk/aws-rds/lib/cluster-parameter-group.ts deleted file mode 100644 index 1ca9c92b14d31..0000000000000 --- a/packages/@aws-cdk/aws-rds/lib/cluster-parameter-group.ts +++ /dev/null @@ -1,107 +0,0 @@ -import { Construct, IResource, Resource, Token } from '@aws-cdk/cdk'; -import { Parameters } from './props'; -import { CfnDBClusterParameterGroup } from './rds.generated'; - -/** - * A cluster parameter group - */ -export interface IClusterParameterGroup extends IResource { - /** - * Name of this parameter group - */ - readonly parameterGroupName: string; -} - -/** - * Properties to reference a cluster parameter group - */ -export interface ClusterParameterGroupImportProps { - readonly parameterGroupName: string; -} - -/** - * Properties for a cluster parameter group - */ -export interface ClusterParameterGroupProps { - /** - * Database family of this parameter group - */ - readonly family: string; - - /** - * Description for this parameter group - */ - readonly description: string; - - /** - * The parameters in this parameter group - * - * @default - No parameters. - */ - readonly parameters?: Parameters; -} - -/** - * Defina a cluster parameter group - * - * @resource AWS::RDS::DBClusterParameterGroup - */ -export class ClusterParameterGroup extends Resource implements IClusterParameterGroup { - /** - * Import a parameter group - */ - public static fromParameterGroupName(scope: Construct, id: string, parameterGroupName: string): IClusterParameterGroup { - class Import extends Resource implements IClusterParameterGroup { - public parameterGroupName = parameterGroupName; - } - return new Import(scope, id); - } - - public readonly parameterGroupName: string; - private readonly parameters: Parameters = {}; - - constructor(scope: Construct, id: string, props: ClusterParameterGroupProps) { - super(scope, id); - - const resource = new CfnDBClusterParameterGroup(this, 'Resource', { - description: props.description, - family: props.family, - parameters: new Token(() => this.parameters), - }); - - for (const [key, value] of Object.entries(props.parameters || {})) { - this.setParameter(key, value); - } - - this.parameterGroupName = resource.ref; - } - - /** - * Set a single parameter in this parameter group - */ - public setParameter(key: string, value: string | undefined) { - if (value === undefined && key in this.parameters) { - delete this.parameters[key]; - } - if (value !== undefined) { - this.parameters[key] = value; - } - } - - /** - * Remove a previously-set parameter from this parameter group - */ - public removeParameter(key: string) { - this.setParameter(key, undefined); - } - - /** - * Validate this construct - */ - protected validate(): string[] { - if (Object.keys(this.parameters).length === 0) { - return ['At least one parameter required, call setParameter().']; - } - return []; - } -} diff --git a/packages/@aws-cdk/aws-rds/lib/cluster-ref.ts b/packages/@aws-cdk/aws-rds/lib/cluster-ref.ts index 6688e4cf00b7f..9250b27ac9766 100644 --- a/packages/@aws-cdk/aws-rds/lib/cluster-ref.ts +++ b/packages/@aws-cdk/aws-rds/lib/cluster-ref.ts @@ -1,12 +1,12 @@ import ec2 = require('@aws-cdk/aws-ec2'); import secretsmanager = require('@aws-cdk/aws-secretsmanager'); -import cdk = require('@aws-cdk/cdk'); -import { Token } from '@aws-cdk/cdk'; +import { IResource } from '@aws-cdk/cdk'; +import { Endpoint } from './endpoint'; /** * Create a clustered database with a given number of instances. */ -export interface IDatabaseCluster extends cdk.IResource, ec2.IConnectable, secretsmanager.ISecretAttachmentTarget { +export interface IDatabaseCluster extends IResource, ec2.IConnectable, secretsmanager.ISecretAttachmentTarget { /** * Identifier of the cluster */ @@ -80,33 +80,3 @@ export interface DatabaseClusterAttributes { */ readonly instanceEndpointAddresses: string[]; } - -/** - * Connection endpoint of a database cluster or instance - * - * Consists of a combination of hostname and port. - */ -export class Endpoint { - /** - * The hostname of the endpoint - */ - public readonly hostname: string; - - /** - * The port of the endpoint - */ - public readonly port: number; - - /** - * The combination of "HOSTNAME:PORT" for this endpoint - */ - public readonly socketAddress: string; - - constructor(address: string, port: number) { - this.hostname = address; - this.port = port; - - const portDesc = Token.isToken(port) ? '{IndirectPort}' : port; - this.socketAddress = `${address}:${portDesc}`; - } -} diff --git a/packages/@aws-cdk/aws-rds/lib/cluster.ts b/packages/@aws-cdk/aws-rds/lib/cluster.ts index 13c502b1df04d..bc3cb557dd5b6 100644 --- a/packages/@aws-cdk/aws-rds/lib/cluster.ts +++ b/packages/@aws-cdk/aws-rds/lib/cluster.ts @@ -2,12 +2,13 @@ import ec2 = require('@aws-cdk/aws-ec2'); import kms = require('@aws-cdk/aws-kms'); import secretsmanager = require('@aws-cdk/aws-secretsmanager'); import { Construct, DeletionPolicy, Resource, Token } from '@aws-cdk/cdk'; -import { IClusterParameterGroup } from './cluster-parameter-group'; -import { DatabaseClusterAttributes, Endpoint, IDatabaseCluster } from './cluster-ref'; +import { DatabaseClusterAttributes, IDatabaseCluster } from './cluster-ref'; import { DatabaseSecret } from './database-secret'; +import { Endpoint } from './endpoint'; +import { IParameterGroup } from './parameter-group'; import { BackupProps, DatabaseClusterEngine, InstanceProps, Login } from './props'; import { CfnDBCluster, CfnDBInstance, CfnDBSubnetGroup } from './rds.generated'; -import { DatabaseEngine, RotationSingleUser, RotationSingleUserOptions } from './rotation-single-user'; +import { SecretRotation, SecretRotationApplication, SecretRotationOptions } from './secret-rotation'; /** * Properties for a new database cluster @@ -18,6 +19,13 @@ export interface DatabaseClusterProps { */ readonly engine: DatabaseClusterEngine; + /** + * What version of the database to start + * + * @default - The default for the engine is used. + */ + readonly engineVersion?: string; + /** * How many replicas/instances to create * @@ -111,7 +119,7 @@ export interface DatabaseClusterProps { * * @default - No parameter group. */ - readonly parameterGroup?: IClusterParameterGroup; + readonly parameterGroup?: IParameterGroup; /** * The CloudFormation policy to apply when the cluster and its instances @@ -241,7 +249,7 @@ export class DatabaseCluster extends DatabaseClusterBase { /** * The database engine of this cluster */ - public readonly engine: DatabaseClusterEngine; + private readonly secretRotationApplication: SecretRotationApplication; /** * The VPC where the DB subnet group is created. @@ -286,11 +294,12 @@ export class DatabaseCluster extends DatabaseClusterBase { }); } - this.engine = props.engine; + this.secretRotationApplication = props.engine.secretRotationApplication; const cluster = new CfnDBCluster(this, 'Resource', { // Basic - engine: this.engine, + engine: props.engine.name, + engineVersion: props.engineVersion, dbClusterIdentifier: props.clusterIdentifier, dbSubnetGroupName: subnetGroup.ref, vpcSecurityGroupIds: [this.securityGroupId], @@ -347,7 +356,8 @@ export class DatabaseCluster extends DatabaseClusterBase { const instance = new CfnDBInstance(this, `Instance${instanceIndex}`, { // Link to cluster - engine: props.engine, + engine: props.engine.name, + engineVersion: props.engineVersion, dbClusterIdentifier: cluster.ref, dbInstanceIdentifier: instanceIdentifier, // Instance properties @@ -355,6 +365,7 @@ export class DatabaseCluster extends DatabaseClusterBase { publiclyAccessible, // This is already set on the Cluster. Unclear to me whether it should be repeated or not. Better yes. dbSubnetGroupName: subnetGroup.ref, + dbParameterGroupName: props.instanceProps.parameterGroup && props.instanceProps.parameterGroup.parameterGroupName, }); instance.options.deletionPolicy = deleteReplacePolicy; @@ -375,13 +386,13 @@ export class DatabaseCluster extends DatabaseClusterBase { /** * Adds the single user rotation of the master password to this cluster. */ - public addRotationSingleUser(id: string, options: RotationSingleUserOptions = {}): RotationSingleUser { + public addRotationSingleUser(id: string, options: SecretRotationOptions = {}): SecretRotation { if (!this.secret) { throw new Error('Cannot add single user rotation for a cluster without secret.'); } - return new RotationSingleUser(this, id, { + return new SecretRotation(this, id, { secret: this.secret, - engine: toDatabaseEngine(this.engine), + application: this.secretRotationApplication, vpc: this.vpc, vpcSubnets: this.vpcSubnets, target: this, @@ -396,20 +407,3 @@ export class DatabaseCluster extends DatabaseClusterBase { function databaseInstanceType(instanceType: ec2.InstanceType) { return 'db.' + instanceType.toString(); } - -/** - * Transforms a DatbaseClusterEngine to a DatabaseEngine. - * - * @param engine the engine to transform - */ -function toDatabaseEngine(engine: DatabaseClusterEngine): DatabaseEngine { - switch (engine) { - case DatabaseClusterEngine.Aurora: - case DatabaseClusterEngine.AuroraMysql: - return DatabaseEngine.Mysql; - case DatabaseClusterEngine.AuroraPostgresql: - return DatabaseEngine.Postgres; - default: - throw new Error('Unknown engine'); - } -} diff --git a/packages/@aws-cdk/aws-rds/lib/database-secret.ts b/packages/@aws-cdk/aws-rds/lib/database-secret.ts index 46bb307a35978..977346328114a 100644 --- a/packages/@aws-cdk/aws-rds/lib/database-secret.ts +++ b/packages/@aws-cdk/aws-rds/lib/database-secret.ts @@ -1,6 +1,6 @@ import kms = require('@aws-cdk/aws-kms'); import secretsmanager = require('@aws-cdk/aws-secretsmanager'); -import cdk = require('@aws-cdk/cdk'); +import { Construct } from '@aws-cdk/cdk'; /** * Construction properties for a DatabaseSecret. @@ -25,7 +25,7 @@ export interface DatabaseSecretProps { * @resource AWS::SecretsManager::Secret */ export class DatabaseSecret extends secretsmanager.Secret { - constructor(scope: cdk.Construct, id: string, props: DatabaseSecretProps) { + constructor(scope: Construct, id: string, props: DatabaseSecretProps) { super(scope, id, { encryptionKey: props.encryptionKey, generateSecretString: { diff --git a/packages/@aws-cdk/aws-rds/lib/endpoint.ts b/packages/@aws-cdk/aws-rds/lib/endpoint.ts new file mode 100644 index 0000000000000..e0855a30efa02 --- /dev/null +++ b/packages/@aws-cdk/aws-rds/lib/endpoint.ts @@ -0,0 +1,31 @@ +import { Token } from '@aws-cdk/cdk'; + +/** + * Connection endpoint of a database cluster or instance + * + * Consists of a combination of hostname and port. + */ +export class Endpoint { + /** + * The hostname of the endpoint + */ + public readonly hostname: string; + + /** + * The port of the endpoint + */ + public readonly port: number; + + /** + * The combination of "HOSTNAME:PORT" for this endpoint + */ + public readonly socketAddress: string; + + constructor(address: string, port: number) { + this.hostname = address; + this.port = port; + + const portDesc = Token.isToken(port) ? '{IndirectPort}' : port; + this.socketAddress = `${address}:${portDesc}`; + } +} diff --git a/packages/@aws-cdk/aws-rds/lib/index.ts b/packages/@aws-cdk/aws-rds/lib/index.ts index 149610e4fe159..116e542651658 100644 --- a/packages/@aws-cdk/aws-rds/lib/index.ts +++ b/packages/@aws-cdk/aws-rds/lib/index.ts @@ -1,9 +1,14 @@ export * from './cluster'; export * from './cluster-ref'; export * from './props'; -export * from './cluster-parameter-group'; -export * from './rotation-single-user'; +export * from './parameter-group'; +export * from './secret-rotation'; export * from './database-secret'; +export * from './endpoint'; +export * from './option-group'; +export * from './instance'; // AWS::RDS CloudFormation Resources: export * from './rds.generated'; + +import './rds-augmentations.generated'; diff --git a/packages/@aws-cdk/aws-rds/lib/instance.ts b/packages/@aws-cdk/aws-rds/lib/instance.ts new file mode 100644 index 0000000000000..acfb4e095801e --- /dev/null +++ b/packages/@aws-cdk/aws-rds/lib/instance.ts @@ -0,0 +1,943 @@ +import ec2 = require('@aws-cdk/aws-ec2'); +import events = require('@aws-cdk/aws-events'); +import iam = require('@aws-cdk/aws-iam'); +import kms = require('@aws-cdk/aws-kms'); +import lambda = require('@aws-cdk/aws-lambda'); +import logs = require('@aws-cdk/aws-logs'); +import secretsmanager = require('@aws-cdk/aws-secretsmanager'); +import { Construct, DeletionPolicy, IResource, Resource, SecretValue, Token } from '@aws-cdk/cdk'; +import { DatabaseSecret } from './database-secret'; +import { Endpoint } from './endpoint'; +import { IOptionGroup} from './option-group'; +import { IParameterGroup } from './parameter-group'; +import { DatabaseClusterEngine } from './props'; +import { CfnDBInstance, CfnDBInstanceProps, CfnDBSubnetGroup } from './rds.generated'; +import { SecretRotation, SecretRotationApplication, SecretRotationOptions } from './secret-rotation'; + +export interface IDatabaseInstance extends IResource, ec2.IConnectable, secretsmanager.ISecretAttachmentTarget { + /** + * The instance identifier. + */ + readonly instanceIdentifier: string; + + /** + * The instance arn. + */ + readonly instanceArn: string; + + /** + * The instance endpoint address. + * + * @attribute + */ + readonly dbInstanceEndpointAddress: string; + + /** + * The instance endpoint port. + * + * @attribute + */ + readonly dbInstanceEndpointPort: string; + + /** + * The instance endpoint. + */ + readonly instanceEndpoint: Endpoint; + + /** + * The security group identifier of the instance. + */ + readonly securityGroupId: string; + + /** + * Defines a CloudWatch event rule which triggers for instance events. Use + * `rule.addEventPattern(pattern)` to specify a filter. + */ + onEvent(id: string, options: events.OnEventOptions): events.Rule; +} + +/** + * Properties that describe an existing instance + */ +export interface DatabaseInstanceAttributes { + /** + * The instance identifier. + */ + readonly instanceIdentifier: string; + + /** + * The endpoint address. + */ + readonly instanceEndpointAddress: string; + + /** + * The database port. + */ + readonly port: number; + + /** + * The security group identifier of the instance. + */ + readonly securityGroupId: string; +} + +/** + * A new or imported database instance. + */ +export abstract class DatabaseInstanceBase extends Resource implements IDatabaseInstance { + /** + * Import an existing database instance. + */ + public static fromDatabaseInstanceAttributes(scope: Construct, id: string, attrs: DatabaseInstanceAttributes): IDatabaseInstance { + class Import extends DatabaseInstanceBase implements IDatabaseInstance { + public readonly defaultPortRange = new ec2.TcpPort(attrs.port); + public readonly connections = new ec2.Connections({ + securityGroups: [ec2.SecurityGroup.fromSecurityGroupId(this, 'SecurityGroup', attrs.securityGroupId)], + defaultPortRange: this.defaultPortRange + }); + public readonly instanceIdentifier = attrs.instanceIdentifier; + public readonly dbInstanceEndpointAddress = attrs.instanceEndpointAddress; + public readonly dbInstanceEndpointPort = attrs.port.toString(); + public readonly instanceEndpoint = new Endpoint(attrs.instanceEndpointAddress, attrs.port); + public readonly securityGroupId = attrs.securityGroupId; + } + + return new Import(scope, id); + } + + public abstract readonly instanceIdentifier: string; + public abstract readonly dbInstanceEndpointAddress: string; + public abstract readonly dbInstanceEndpointPort: string; + public abstract readonly instanceEndpoint: Endpoint; + public abstract readonly connections: ec2.Connections; + public abstract readonly securityGroupId: string; + + /** + * Defines a CloudWatch event rule which triggers for instance events. Use + * `rule.addEventPattern(pattern)` to specify a filter. + */ + public onEvent(id: string, options: events.OnEventOptions) { + const rule = new events.Rule(this, id, options); + rule.addEventPattern({ + source: ['aws.rds'], + resources: [this.instanceArn] + }); + rule.addTarget(options.target); + return rule; + } + + /** + * The instance arn. + */ + public get instanceArn(): string { + return this.node.stack.formatArn({ + service: 'rds', + resource: 'db', + sep: ':', + resourceName: this.instanceIdentifier + }); + } + + /** + * Renders the secret attachment target specifications. + */ + public asSecretAttachmentTarget(): secretsmanager.SecretAttachmentTargetProps { + return { + targetId: this.instanceIdentifier, + targetType: secretsmanager.AttachmentTargetType.Instance + }; + } +} + +/** + * A database instance engine. Provides mapping to DatabaseEngine used for + * secret rotation. + */ +export class DatabaseInstanceEngine extends DatabaseClusterEngine { + public static readonly MariaDb = new DatabaseInstanceEngine('mariadb', SecretRotationApplication.MariaDbRotationSingleUser); + public static readonly Mysql = new DatabaseInstanceEngine('mysql', SecretRotationApplication.MysqlRotationSingleUser); + public static readonly OracleEE = new DatabaseInstanceEngine('oracle-ee', SecretRotationApplication.OracleRotationSingleUser); + public static readonly OracleSE2 = new DatabaseInstanceEngine('oracle-se2', SecretRotationApplication.OracleRotationSingleUser); + public static readonly OracleSE1 = new DatabaseInstanceEngine('oracle-se1', SecretRotationApplication.OracleRotationSingleUser); + public static readonly OracleSE = new DatabaseInstanceEngine('oracle-se', SecretRotationApplication.OracleRotationSingleUser); + public static readonly Postgres = new DatabaseInstanceEngine('postgres', SecretRotationApplication.PostgresRotationSingleUser); + public static readonly SqlServerEE = new DatabaseInstanceEngine('sqlserver-ee', SecretRotationApplication.SqlServerRotationSingleUser); + public static readonly SqlServerSE = new DatabaseInstanceEngine('sqlserver-se', SecretRotationApplication.SqlServerRotationSingleUser); + public static readonly SqlServerEX = new DatabaseInstanceEngine('sqlserver-ex', SecretRotationApplication.SqlServerRotationSingleUser); + public static readonly SqlServerWeb = new DatabaseInstanceEngine('sqlserver-web', SecretRotationApplication.SqlServerRotationSingleUser); +} + +/** + * The license model. + */ +export enum LicenseModel { + /** + * License included. + */ + LicenseIncluded = 'license-included', + + /** + * Bring your own licencse. + */ + BringYourOwnLicense = 'bring-your-own-license', + + /** + * General public license. + */ + GeneralPublicLicense = 'general-public-license' +} + +/** + * The processor features. + */ +export interface ProcessorFeatures { + /** + * The number of CPU core. + */ + readonly coreCount?: number; + + /** + * The number of threads per core. + */ + readonly threadsPerCore?: number; +} + +/** + * The type of storage. + */ +export enum StorageType { + /** + * Standard. + */ + Standard = 'standard', + + /** + * General purpose (SSD). + */ + GP2 = 'gp2', + + /** + * Provisioned IOPS (SSD). + */ + IO1 = 'io1' +} + +/** + * The retention period for Performance Insight. + */ +export enum PerformanceInsightRetentionPeriod { + /** + * Default retention period of 7 days. + */ + Default = 7, + + /** + * Long term retention period of 2 years. + */ + LongTerm = 731 +} + +/** + * Construction properties for a DatabaseInstanceNew + */ +export interface DatabaseInstanceNewProps { + /** + * The name of the compute and memory capacity classes. + */ + readonly instanceClass: ec2.InstanceType; + + /** + * Specifies if the database instance is a multiple Availability Zone deployment. + * + * @default false + */ + readonly multiAz?: boolean; + + /** + * The name of the Availability Zone where the DB instance will be located. + * + * @default no preference + */ + readonly availabilityZone?: string; + + /** + * The storage type. + * + * @default GP2 + */ + readonly storageType?: StorageType; + + /** + * The number of I/O operations per second (IOPS) that the database provisions. + * The value must be equal to or greater than 1000. + * + * @default no provisioned iops + */ + readonly iops?: number; + + /** + * The number of CPU cores and the number of threads per core. + * + * @default the default number of CPU cores and threads per core for the + * chosen instance class. + * + * See https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Concepts.DBInstanceClass.html#USER_ConfigureProcessor + */ + readonly processorFeatures?: ProcessorFeatures; + + /** + * A name for the DB instance. If you specify a name, AWS CloudFormation + * converts it to lowercase. + * + * @default a CloudFormation generated name + */ + readonly instanceIdentifier?: string; + + /** + * The VPC network where the DB subnet group should be created. + */ + readonly vpc: ec2.IVpc; + + /** + * The type of subnets to add to the created DB subnet group. + * + * @default private + */ + readonly vpcPlacement?: ec2.SubnetSelection; + + /** + * The port for the instance. + * + * @default the default port for the chosen engine. + */ + readonly port?: number; + + /** + * The option group to associate with the instance. + * + * @default no option group + */ + readonly optionGroup?: IOptionGroup; + + /** + * Whether to enable mapping of AWS Identity and Access Management (IAM) accounts + * to database accounts. + * + * @default false + */ + readonly iamAuthentication?: boolean; + + /** + * The number of days during which automatic DB snapshots are retained. Set + * to zero to disable backups. + * + * @default 1 day + */ + readonly backupRetentionPeriod?: number; + + /** + * The daily time range during which automated backups are performed. + * + * Constraints: + * - Must be in the format `hh24:mi-hh24:mi`. + * - Must be in Universal Coordinated Time (UTC). + * - Must not conflict with the preferred maintenance window. + * - Must be at least 30 minutes. + * + * @default a 30-minute window selected at random from an 8-hour block of + * time for each AWS Region. To see the time blocks available, see + * https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_UpgradeDBInstance.Maintenance.html#AdjustingTheMaintenanceWindow + */ + readonly preferredBackupWindow?: string; + + /** + * Indicates whether to copy all of the user-defined tags from the + * DB instance to snapshots of the DB instance. + * + * @default true + */ + readonly copyTagsToSnapshot?: boolean; + + /** + * Indicates whether automated backups should be deleted or retained when + * you delete a DB instance. + * + * @default false + */ + readonly deleteAutomatedBackups?: boolean; + + /** + * The interval, in seconds, between points when Amazon RDS collects enhanced + * monitoring metrics for the DB instance. + * + * @default no enhanced monitoring + */ + readonly monitoringInterval?: number; + + /** + * Whether to enable Performance Insights for the DB instance. + * + * @default false + */ + readonly enablePerformanceInsights?: boolean; + + /** + * The amount of time, in days, to retain Performance Insights data. + * + * @default 7 days + */ + readonly performanceInsightRetentionPeriod?: PerformanceInsightRetentionPeriod; + + /** + * The AWS KMS key for encryption of Performance Insights data. + * + * @default default master key + */ + readonly performanceInsightKmsKey?: kms.IKey; + + /** + * The list of log types that need to be enabled for exporting to + * CloudWatch Logs. + * + * @default no log exports + */ + readonly cloudwatchLogsExports?: string[]; + + /** + * The number of days log events are kept in CloudWatch Logs. When updating + * this property, unsetting it doesn't remove the log retention policy. To + * remove the retention policy, set the value to `Infinity`. + * + * @default logs never expire + */ + readonly cloudwatchLogsRetention?: logs.RetentionDays; + + /** + * Indicates that minor engine upgrades are applied automatically to the + * DB instance during the maintenance window. + * + * @default true + */ + readonly autoMinorVersionUpgrade?: boolean; + + // tslint:disable:max-line-length + /** + * The weekly time range (in UTC) during which system maintenance can occur. + * + * Format: `ddd:hh24:mi-ddd:hh24:mi` + * Constraint: Minimum 30-minute window + * + * @default a 30-minute window selected at random from an 8-hour block of + * time for each AWS Region, occurring on a random day of the week. To see + * the time blocks available, see https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_UpgradeDBInstance.Maintenance.html#AdjustingTheMaintenanceWindow + */ + // tslint:enable:max-line-length + readonly preferredMaintenanceWindow?: string; + + /** + * Indicates whether the DB instance should have deletion protection enabled. + * + * @default true + */ + readonly deletionProtection?: boolean; + + /** + * The CloudFormation policy to apply when the instance is removed from the + * stack or replaced during an update. + * + * @default Retain + */ + readonly deleteReplacePolicy?: DeletionPolicy +} + +/** + * A new database instance. + */ +abstract class DatabaseInstanceNew extends DatabaseInstanceBase implements IDatabaseInstance { + public readonly securityGroupId: string; + public readonly vpc: ec2.IVpc; + + protected readonly vpcPlacement?: ec2.SubnetSelection; + protected readonly newCfnProps: CfnDBInstanceProps; + protected readonly securityGroup: ec2.SecurityGroup; + + private readonly cloudwatchLogsExports?: string[]; + private readonly cloudwatchLogsRetention?: logs.RetentionDays; + + constructor(scope: Construct, id: string, props: DatabaseInstanceNewProps) { + super(scope, id); + + this.vpc = props.vpc; + this.vpcPlacement = props.vpcPlacement; + + const { subnetIds } = props.vpc.selectSubnets(props.vpcPlacement); + + const subnetGroup = new CfnDBSubnetGroup(this, 'SubnetGroup', { + dbSubnetGroupDescription: `Subnet group for ${this.node.id} database`, + subnetIds + }); + + this.securityGroup = new ec2.SecurityGroup(this, 'SecurityGroup', { + description: `Security group for ${this.node.id} database`, + vpc: props.vpc + }); + this.securityGroupId = this.securityGroup.securityGroupId; + + let monitoringRole; + if (props.monitoringInterval) { + monitoringRole = new iam.Role(this, 'MonitoringRole', { + assumedBy: new iam.ServicePrincipal('monitoring.rds.amazonaws.com'), + managedPolicyArns: [this.node.stack.formatArn({ + service: 'iam', + region: '', + account: 'aws', + resource: 'policy', + resourceName: 'service-role/AmazonRDSEnhancedMonitoringRole' + })] + }); + } + + const deletionProtection = props.deletionProtection !== undefined ? props.deletionProtection : true; + const storageType = props.storageType || StorageType.GP2; + const iops = storageType === StorageType.IO1 ? (props.iops || 1000) : undefined; + + this.cloudwatchLogsExports = props.cloudwatchLogsExports; + this.cloudwatchLogsRetention = props.cloudwatchLogsRetention; + + this.newCfnProps = { + autoMinorVersionUpgrade: props.autoMinorVersionUpgrade, + availabilityZone: props.multiAz ? undefined : props.availabilityZone, + backupRetentionPeriod: props.backupRetentionPeriod ? props.backupRetentionPeriod.toString() : undefined, + copyTagsToSnapshot: props.copyTagsToSnapshot !== undefined ? props.copyTagsToSnapshot : true, + dbInstanceClass: `db.${props.instanceClass}`, + dbInstanceIdentifier: props.instanceIdentifier, + dbSubnetGroupName: subnetGroup.dbSubnetGroupName, + deleteAutomatedBackups: props.deleteAutomatedBackups, + deletionProtection, + enableCloudwatchLogsExports: this.cloudwatchLogsExports, + enableIamDatabaseAuthentication: props.iamAuthentication, + enablePerformanceInsights: props.enablePerformanceInsights, + iops, + monitoringInterval: props.monitoringInterval, + monitoringRoleArn: monitoringRole && monitoringRole.roleArn, + multiAz: props.multiAz, + optionGroupName: props.optionGroup && props.optionGroup.optionGroupName, + performanceInsightsKmsKeyId: props.enablePerformanceInsights + ? props.performanceInsightKmsKey && props.performanceInsightKmsKey.keyArn + : undefined, + performanceInsightsRetentionPeriod: props.enablePerformanceInsights + ? (props.performanceInsightRetentionPeriod || PerformanceInsightRetentionPeriod.Default) + : undefined, + port: props.port ? props.port.toString() : undefined, + preferredBackupWindow: props.preferredBackupWindow, + preferredMaintenanceWindow: props.preferredMaintenanceWindow, + processorFeatures: props.processorFeatures && renderProcessorFeatures(props.processorFeatures), + publiclyAccessible: props.vpcPlacement && props.vpcPlacement.subnetType === ec2.SubnetType.Public, + storageType, + vpcSecurityGroups: [this.securityGroupId] + }; + } + + protected setLogRetention() { + if (this.cloudwatchLogsExports && this.cloudwatchLogsRetention) { + for (const log of this.cloudwatchLogsExports) { + new lambda.LogRetention(this, `LogRetention${log}`, { + logGroupName: `/aws/rds/instance/${this.instanceIdentifier}/${log}`, + retentionDays: this.cloudwatchLogsRetention + }); + } + } + } +} + +/** + * Construction properties for a DatabaseInstanceSource + */ +export interface DatabaseInstanceSourceProps extends DatabaseInstanceNewProps { + /** + * The database engine. + */ + readonly engine: DatabaseInstanceEngine; + + /** + * The license model. + * + * @default RDS default license model + */ + readonly licenseModel?: LicenseModel; + + /** + * The engine version. To prevent automatic upgrades, be sure to specify the + * full version number. + * + * @default RDS default engine version + */ + readonly engineVersion?: string; + + /** + * Whether to allow major version upgrades. + * + * @default false + */ + readonly allowMajorVersionUpgrade?: boolean; + + /** + * The time zone of the instance. + * + * @default RDS default timezone + */ + readonly timezone?: string; + + /** + * The allocated storage size, specified in gigabytes (GB). + * + * @default 100 + */ + readonly allocatedStorage?: number; + + /** + * The master user password. + * + * @default a Secrets Manager generated password + */ + readonly masterUserPassword?: SecretValue; + + /** + * The KMS key to use to encrypt the secret for the master user password. + * + * @default default master key + */ + readonly secretKmsKey?: kms.IKey; + + /** + * The name of the database. + * + * @default no name + */ + readonly databaseName?: string; + + /** + * The DB parameter group to associate with the instance. + * + * @default no parameter group + */ + readonly parameterGroup?: IParameterGroup; +} + +/** + * A new source database instance (not a read replica) + */ +abstract class DatabaseInstanceSource extends DatabaseInstanceNew implements IDatabaseInstance { + public abstract readonly secret?: secretsmanager.ISecret; + + protected readonly sourceCfnProps: CfnDBInstanceProps; + + private readonly secretRotationApplication: SecretRotationApplication; + + constructor(scope: Construct, id: string, props: DatabaseInstanceSourceProps) { + super(scope, id, props); + + this.secretRotationApplication = props.engine.secretRotationApplication; + + this.sourceCfnProps = { + ...this.newCfnProps, + allocatedStorage: props.allocatedStorage ? props.allocatedStorage.toString() : '100', + allowMajorVersionUpgrade: props.allowMajorVersionUpgrade, + dbName: props.databaseName, + dbParameterGroupName: props.parameterGroup && props.parameterGroup.parameterGroupName, + engine: props.engine.name, + engineVersion: props.engineVersion, + licenseModel: props.licenseModel, + timezone: props.timezone + }; + } + + /** + * Adds the single user rotation of the master password to this instance. + */ + public addRotationSingleUser(id: string, options: SecretRotationOptions = {}): SecretRotation { + if (!this.secret) { + throw new Error('Cannot add single user rotation for an instance without secret.'); + } + return new SecretRotation(this, id, { + secret: this.secret, + application: this.secretRotationApplication, + vpc: this.vpc, + vpcSubnets: this.vpcPlacement, + target: this, + ...options + }); + } +} + +/** + * Construction properties for a DatabaseInstance. + */ +export interface DatabaseInstanceProps extends DatabaseInstanceSourceProps { + /** + * The master user name. + */ + readonly masterUsername: string; + + /** + * For supported engines, specifies the character set to associate with the + * DB instance. + * + * @default RDS default character set name + */ + readonly characterSetName?: string; + + /** + * Indicates whether the DB instance is encrypted. + * + * @default false + */ + readonly storageEncrypted?: boolean; + + /** + * The master key that's used to encrypt the DB instance. + * + * @default default master key + */ + readonly kmsKey?: kms.IKey; +} + +/** + * A database instance + * + * @resource AWS::RDS::DBInstance + */ +export class DatabaseInstance extends DatabaseInstanceSource implements IDatabaseInstance { + public readonly instanceIdentifier: string; + public readonly dbInstanceEndpointAddress: string; + public readonly dbInstanceEndpointPort: string; + public readonly instanceEndpoint: Endpoint; + public readonly connections: ec2.Connections; + public readonly secret?: secretsmanager.ISecret; + + constructor(scope: Construct, id: string, props: DatabaseInstanceProps) { + super(scope, id, props); + + let secret; + if (!props.masterUserPassword) { + secret = new DatabaseSecret(this, 'Secret', { + username: props.masterUsername, + encryptionKey: props.secretKmsKey, + }); + } + + const instance = new CfnDBInstance(this, 'Resource', { + ...this.sourceCfnProps, + characterSetName: props.characterSetName, + kmsKeyId: props.kmsKey && props.kmsKey.keyArn, + masterUsername: secret ? secret.secretJsonValue('username').toString() : props.masterUsername, + masterUserPassword: secret + ? secret.secretJsonValue('password').toString() + : (props.masterUserPassword + ? props.masterUserPassword.toString() + : undefined), + storageEncrypted: props.kmsKey ? true : props.storageEncrypted + }); + + this.instanceIdentifier = instance.dbInstanceId; + this.dbInstanceEndpointAddress = instance.dbInstanceEndpointAddress; + this.dbInstanceEndpointPort = instance.dbInstanceEndpointPort; + + // create a number token that represents the port of the instance + const portAttribute = new Token(() => instance.dbInstanceEndpointPort).toNumber(); + this.instanceEndpoint = new Endpoint(instance.dbInstanceEndpointAddress, portAttribute); + + const deleteReplacePolicy = props.deleteReplacePolicy || DeletionPolicy.Retain; + instance.options.deletionPolicy = deleteReplacePolicy; + instance.options.updateReplacePolicy = deleteReplacePolicy; + + if (secret) { + this.secret = secret.addTargetAttachment('AttachedSecret', { + target: this + }); + } + + this.connections = new ec2.Connections({ + securityGroups: [this.securityGroup], + defaultPortRange: new ec2.TcpPort(this.instanceEndpoint.port) + }); + + this.setLogRetention(); + } +} + +/** + * Construction properties for a DatabaseInstanceFromSnapshot. + */ +export interface DatabaseInstanceFromSnapshotProps extends DatabaseInstanceSourceProps { + /** + * The name or Amazon Resource Name (ARN) of the DB snapshot that's used to + * restore the DB instance. If you're restoring from a shared manual DB + * snapshot, you must specify the ARN of the snapshot. + */ + readonly snapshotIdentifier: string; + + /** + * The master user name. + * + * @default inherited from the snapshot + */ + readonly masterUsername?: string; + + /** + * Whether to generate a new master user password and store it in + * Secrets Manager. `masterUsername` must be specified when this property + * is set to true. + * + * @default false + */ + readonly generateMasterUserPassword?: boolean; +} + +/** + * A database instance restored from a snapshot. + * + * @resource AWS::RDS::DBInstance + */ +export class DatabaseInstanceFromSnapshot extends DatabaseInstanceSource implements IDatabaseInstance { + public readonly instanceIdentifier: string; + public readonly dbInstanceEndpointAddress: string; + public readonly dbInstanceEndpointPort: string; + public readonly instanceEndpoint: Endpoint; + public readonly connections: ec2.Connections; + public readonly secret?: secretsmanager.ISecret; + + constructor(scope: Construct, id: string, props: DatabaseInstanceFromSnapshotProps) { + super(scope, id, props); + + if (props.generateMasterUserPassword && !props.masterUsername) { + throw new Error('`masterUsername` must be specified when `generateMasterUserPassword` is set to true.'); + } + + let secret; + if (!props.masterUserPassword && props.generateMasterUserPassword && props.masterUsername) { + secret = new DatabaseSecret(this, 'Secret', { + username: props.masterUsername, + encryptionKey: props.secretKmsKey, + }); + } + + const instance = new CfnDBInstance(this, 'Resource', { + ...this.sourceCfnProps, + dbSnapshotIdentifier: props.snapshotIdentifier, + masterUsername: secret ? secret.secretJsonValue('username').toString() : props.masterUsername, + masterUserPassword: secret + ? secret.secretJsonValue('password').toString() + : (props.masterUserPassword + ? props.masterUserPassword.toString() + : undefined), + }); + + this.instanceIdentifier = instance.dbInstanceId; + this.dbInstanceEndpointAddress = instance.dbInstanceEndpointAddress; + this.dbInstanceEndpointPort = instance.dbInstanceEndpointPort; + + // create a number token that represents the port of the instance + const portAttribute = new Token(() => instance.dbInstanceEndpointPort).toNumber(); + this.instanceEndpoint = new Endpoint(instance.dbInstanceEndpointAddress, portAttribute); + + const deleteReplacePolicy = props.deleteReplacePolicy || DeletionPolicy.Retain; + instance.options.deletionPolicy = deleteReplacePolicy; + instance.options.updateReplacePolicy = deleteReplacePolicy; + + if (secret) { + this.secret = secret.addTargetAttachment('AttachedSecret', { + target: this + }); + } + + this.connections = new ec2.Connections({ + securityGroups: [this.securityGroup], + defaultPortRange: new ec2.TcpPort(this.instanceEndpoint.port) + }); + + this.setLogRetention(); + } +} + +/** + * Construction properties for a DatabaseInstanceReadReplica. + */ +export interface DatabaseInstanceReadReplicaProps extends DatabaseInstanceSourceProps { + /** + * The source database instance. + * + * Each DB instance can have a limited number of read replicas. For more + * information, see https://docs.aws.amazon.com/AmazonRDS/latest/DeveloperGuide/USER_ReadRepl.html. + * + */ + readonly sourceDatabaseInstance: IDatabaseInstance; + + /** + * Indicates whether the DB instance is encrypted. + * + * @default false + */ + readonly storageEncrypted?: boolean; + + /** + * The master key that's used to encrypt the DB instance. + * + * @default default master key + */ + readonly kmsKey?: kms.IKey; +} + +/** + * A read replica database instance. + * + * @resource AWS::RDS::DBInstance + */ +export class DatabaseInstanceReadReplica extends DatabaseInstanceNew implements IDatabaseInstance { + public readonly instanceIdentifier: string; + public readonly dbInstanceEndpointAddress: string; + public readonly dbInstanceEndpointPort: string; + public readonly instanceEndpoint: Endpoint; + public readonly connections: ec2.Connections; + + constructor(scope: Construct, id: string, props: DatabaseInstanceReadReplicaProps) { + super(scope, id, props); + + const instance = new CfnDBInstance(this, 'Resource', { + ...this.newCfnProps, + sourceDbInstanceIdentifier: props.sourceDatabaseInstance.instanceIdentifier, + kmsKeyId: props.kmsKey && props.kmsKey.keyArn, + storageEncrypted: props.kmsKey ? true : props.storageEncrypted, + }); + + this.instanceIdentifier = instance.dbInstanceId; + this.dbInstanceEndpointAddress = instance.dbInstanceEndpointAddress; + this.dbInstanceEndpointPort = instance.dbInstanceEndpointPort; + + // create a number token that represents the port of the instance + const portAttribute = new Token(() => instance.dbInstanceEndpointPort).toNumber(); + this.instanceEndpoint = new Endpoint(instance.dbInstanceEndpointAddress, portAttribute); + + const deleteReplacePolicy = props.deleteReplacePolicy || DeletionPolicy.Retain; + instance.options.deletionPolicy = deleteReplacePolicy; + instance.options.updateReplacePolicy = deleteReplacePolicy; + + this.connections = new ec2.Connections({ + securityGroups: [this.securityGroup], + defaultPortRange: new ec2.TcpPort(this.instanceEndpoint.port) + }); + + this.setLogRetention(); + } +} + +/** + * Renders the processor features specifications + * + * @param features the processor features + */ +function renderProcessorFeatures(features: ProcessorFeatures): CfnDBInstance.ProcessorFeatureProperty[] | undefined { + const featuresList = Object.entries(features).map(([name, value]) => ({ name, value: value.toString() })); + + return featuresList.length === 0 ? undefined : featuresList; +} diff --git a/packages/@aws-cdk/aws-rds/lib/option-group.ts b/packages/@aws-cdk/aws-rds/lib/option-group.ts new file mode 100644 index 0000000000000..0180d1f3800fc --- /dev/null +++ b/packages/@aws-cdk/aws-rds/lib/option-group.ts @@ -0,0 +1,167 @@ +import ec2 = require('@aws-cdk/aws-ec2'); +import { Construct, IResource, Resource } from '@aws-cdk/cdk'; +import { DatabaseInstanceEngine } from './instance'; +import { CfnOptionGroup } from './rds.generated'; + +/** + * An option group + */ +export interface IOptionGroup extends IResource { + /** + * The name of the option group. + * + * @attribute + */ + readonly optionGroupName: string; +} + +/** + * Reference to an existing option group. + */ +export interface OptionGroupAttributes { + /** + * The name of the option group. + */ + readonly optionGroupName: string; +} + +/** + * Configuration properties for an option. + */ +export interface OptionConfiguration { + /** + * The name of the option. + */ + readonly name: string; + + /** + * The settings for the option. + * + * @default no settings + */ + readonly settings?: { [name: string]: string }; + + /** + * The version for the option. + * + * @default no version + */ + readonly version?: string; + + /** + * The port number that this option uses. If `port` is specified then `vpc` + * must also be specified. + * + * @default no port + */ + readonly port?: number; + + /** + * The VPC where a security group should be created for this option. If `vpc` + * is specified then `port` must also be specified. + */ + readonly vpc?: ec2.IVpc; +} + +/** + * Construction properties for an OptionGroup. + */ +export interface OptionGroupProps { + /** + * The database engine that this option group is associated with. + */ + readonly engine: DatabaseInstanceEngine; + + /** + * The major version number of the database engine that this option group + * is associated with. + */ + readonly majorEngineVersion: string; + + /** + * A description of the option group. + * + * @default a CDK generated description + */ + readonly description?: string; + + /** + * The configurations for this option group. + */ + readonly configurations: OptionConfiguration[]; +} + +export class OptionGroup extends Resource implements IOptionGroup { + /** + * Import an existing option group. + */ + public static fromOptionGroupName(scope: Construct, id: string, optionGroupName: string): IOptionGroup { + class Import extends Construct { + public readonly optionGroupName = optionGroupName; + } + return new Import(scope, id); + } + + /** + * The name of the option group. + */ + public readonly optionGroupName: string; + + /** + * The connections object for the options. + */ + public readonly optionConnections: { [key: string]: ec2.Connections } = {}; + + constructor(scope: Construct, id: string, props: OptionGroupProps) { + super(scope, id); + + const optionGroup = new CfnOptionGroup(this, 'Resource', { + engineName: props.engine.name, + majorEngineVersion: props.majorEngineVersion, + optionGroupDescription: props.description || `Option group for ${props.engine.name} ${props.majorEngineVersion}`, + optionConfigurations: this.renderConfigurations(props.configurations) + }); + + this.optionGroupName = optionGroup.optionGroupName; + } + + /** + * Renders the option configurations specifications. + */ + private renderConfigurations(configurations: OptionConfiguration[]): CfnOptionGroup.OptionConfigurationProperty[] { + const configs: CfnOptionGroup.OptionConfigurationProperty[] = []; + for (const config of configurations) { + let configuration: CfnOptionGroup.OptionConfigurationProperty = { + optionName: config.name, + optionSettings: config.settings && Object.entries(config.settings).map(([name, value]) => ({ name, value })), + optionVersion: config.version + }; + + if (config.port) { + if (!config.vpc) { + throw new Error('`port` and `vpc` must be specified together.'); + } + + const securityGroup = new ec2.SecurityGroup(this, `SecurityGroup${config.name}`, { + description: `Security group for ${config.name} option`, + vpc: config.vpc + }); + + this.optionConnections[config.name] = new ec2.Connections({ + securityGroups: [securityGroup], + defaultPortRange: new ec2.TcpPort(config.port) + }); + + configuration = { + ...configuration, + port: config.port, + vpcSecurityGroupMemberships: [securityGroup.securityGroupId] + }; + } + + configs.push(configuration); + } + + return configs; + } +} diff --git a/packages/@aws-cdk/aws-rds/lib/parameter-group.ts b/packages/@aws-cdk/aws-rds/lib/parameter-group.ts new file mode 100644 index 0000000000000..4344faf63072b --- /dev/null +++ b/packages/@aws-cdk/aws-rds/lib/parameter-group.ts @@ -0,0 +1,119 @@ +import { Construct, IResource, Resource } from '@aws-cdk/cdk'; +import { CfnDBClusterParameterGroup, CfnDBParameterGroup } from './rds.generated'; + +/** + * A parameter group + */ +export interface IParameterGroup extends IResource { + /** + * The name of this parameter group + */ + readonly parameterGroupName: string; +} + +/** + * Reference to an existing parameter group + */ +export interface ParameterGroupAttributes { + /** + * The name of the parameter group + */ + readonly parameterGroupName: string; +} + +/** + * A new cluster or instance parameter group + */ +abstract class ParameterGroupBase extends Resource implements IParameterGroup { + /** + * Imports a parameter group + */ + public static fromParameterGroupName(scope: Construct, id: string, parameterGroupName: string): IParameterGroup { + class Import extends Construct implements IParameterGroup { + public readonly parameterGroupName = parameterGroupName; + } + return new Import(scope, id); + } + + /** + * The name of the parameter group + */ + public abstract readonly parameterGroupName: string; +} + +/** + * Properties for a parameter group + */ +export interface ParameterGroupProps { + /** + * Database family of this parameter group + */ + readonly family: string; + + /** + * Description for this parameter group + * + * @default a CDK generated description + */ + readonly description?: string; + + /** + * The parameters in this parameter group + */ + readonly parameters: { [key: string]: string }; +} + +/** + * A parameter group + * + * @resource AWS::RDS::DBParameterGroup + */ +export class ParameterGroup extends ParameterGroupBase { + /** + * The name of the parameter group + */ + public readonly parameterGroupName: string; + + constructor(scope: Construct, id: string, props: ParameterGroupProps) { + super(scope, id); + + const resource = new CfnDBParameterGroup(this, 'Resource', { + description: props.description || `Parameter group for ${props.family}`, + family: props.family, + parameters: props.parameters, + }); + + this.parameterGroupName = resource.dbParameterGroupName; + } +} + +/** + * Construction properties for a ClusterParameterGroup + */ +// tslint:disable-next-line:no-empty-interface +export interface ClusterParameterGroupProps extends ParameterGroupProps { + +} +/** + * A cluster parameter group + * + * @resource AWS::RDS::DBClusterParameterGroup + */ +export class ClusterParameterGroup extends ParameterGroupBase { + /** + * The name of the parameter group + */ + public readonly parameterGroupName: string; + + constructor(scope: Construct, id: string, props: ClusterParameterGroupProps) { + super(scope, id); + + const resource = new CfnDBClusterParameterGroup(this, 'Resource', { + description: props.description || `Cluster parameter group for ${props.family}`, + family: props.family, + parameters: props.parameters, + }); + + this.parameterGroupName = resource.dbClusterParameterGroupName; + } +} diff --git a/packages/@aws-cdk/aws-rds/lib/props.ts b/packages/@aws-cdk/aws-rds/lib/props.ts index 869b1ec85371a..cde179018c92d 100644 --- a/packages/@aws-cdk/aws-rds/lib/props.ts +++ b/packages/@aws-cdk/aws-rds/lib/props.ts @@ -1,15 +1,32 @@ import ec2 = require('@aws-cdk/aws-ec2'); import kms = require('@aws-cdk/aws-kms'); import { SecretValue } from '@aws-cdk/cdk'; +import { IParameterGroup } from './parameter-group'; +import { SecretRotationApplication } from './secret-rotation'; /** - * The engine for the database cluster + * A database cluster engine. Provides mapping to the serverless application + * used for secret rotation. */ -export enum DatabaseClusterEngine { - Aurora = 'aurora', - AuroraMysql = 'aurora-mysql', - AuroraPostgresql = 'aurora-postgresql', - Neptune = 'neptune' +export class DatabaseClusterEngine { + public static readonly Aurora = new DatabaseClusterEngine('aurora', SecretRotationApplication.MysqlRotationSingleUser); + public static readonly AuroraMysql = new DatabaseClusterEngine('aurora-mysql', SecretRotationApplication.MysqlRotationSingleUser); + public static readonly AuroraPostgresql = new DatabaseClusterEngine('aurora-postgresql', SecretRotationApplication.PostgresRotationSingleUser); + + /** + * The engine. + */ + public readonly name: string; + + /** + * The secret rotation application. + */ + public readonly secretRotationApplication: SecretRotationApplication; + + constructor(name: string, secretRotationApplication: SecretRotationApplication) { + this.name = name; + this.secretRotationApplication = secretRotationApplication; + } } /** @@ -30,13 +47,24 @@ export interface InstanceProps { /** * Where to place the instances within the VPC + * + * @default private subnets */ readonly vpcSubnets?: ec2.SubnetSelection; /** - * Security group. If not specified a new one will be created. + * Security group. + * + * @default a new security group is created. */ readonly securityGroup?: ec2.ISecurityGroup; + + /** + * The DB parameter group to associate with the instance. + * + * @default no parameter group + */ + readonly parameterGroup?: IParameterGroup; } /** @@ -89,8 +117,3 @@ export interface Login { */ readonly kmsKey?: kms.IKey; } - -/** - * Type for database parameters - */ -export type Parameters = {[key: string]: any}; diff --git a/packages/@aws-cdk/aws-rds/lib/rotation-single-user.ts b/packages/@aws-cdk/aws-rds/lib/secret-rotation.ts similarity index 51% rename from packages/@aws-cdk/aws-rds/lib/rotation-single-user.ts rename to packages/@aws-cdk/aws-rds/lib/secret-rotation.ts index c877d3c4044cc..2131992d69382 100644 --- a/packages/@aws-cdk/aws-rds/lib/rotation-single-user.ts +++ b/packages/@aws-cdk/aws-rds/lib/secret-rotation.ts @@ -2,17 +2,26 @@ import ec2 = require('@aws-cdk/aws-ec2'); import lambda = require('@aws-cdk/aws-lambda'); import serverless = require('@aws-cdk/aws-sam'); import secretsmanager = require('@aws-cdk/aws-secretsmanager'); -import cdk = require('@aws-cdk/cdk'); +import { Construct } from '@aws-cdk/cdk'; /** - * A serverless application location. + * A secret rotation serverless application. */ -export class ServerlessApplicationLocation { - public static readonly MariaDbRotationSingleUser = new ServerlessApplicationLocation('SecretsManagerRDSMariaDBRotationSingleUser', '1.0.46'); - public static readonly MysqlRotationSingleUser = new ServerlessApplicationLocation('SecretsManagerRDSMySQLRotationSingleUser', '1.0.74'); - public static readonly OracleRotationSingleUser = new ServerlessApplicationLocation('SecretsManagerRDSOracleRotationSingleUser', '1.0.45'); - public static readonly PostgresRotationSingleUser = new ServerlessApplicationLocation('SecretsManagerRDSPostgreSQLRotationSingleUser', '1.0.75'); - public static readonly SqlServerRotationSingleUser = new ServerlessApplicationLocation('SecretsManagerRDSSQLServerRotationSingleUser', '1.0.74'); +export class SecretRotationApplication { + public static readonly MariaDbRotationSingleUser = new SecretRotationApplication('SecretsManagerRDSMariaDBRotationSingleUser', '1.0.57'); + public static readonly MariaDBRotationMultiUser = new SecretRotationApplication('SecretsManagerRDSMariaDBRotationMultiUser', '1.0.57'); + + public static readonly MysqlRotationSingleUser = new SecretRotationApplication('SecretsManagerRDSMySQLRotationSingleUser', '1.0.85'); + public static readonly MysqlRotationMultiUser = new SecretRotationApplication('SecretsManagerRDSMySQLRotationMultiUser', '1.0.85'); + + public static readonly OracleRotationSingleUser = new SecretRotationApplication('SecretsManagerRDSOracleRotationSingleUser', '1.0.56'); + public static readonly OracleRotationMultiUser = new SecretRotationApplication('SecretsManagerRDSOracleRotationMultiUser', '1.0.56'); + + public static readonly PostgresRotationSingleUser = new SecretRotationApplication('SecretsManagerRDSPostgreSQLRotationSingleUser', '1.0.86'); + public static readonly PostgreSQLRotationMultiUser = new SecretRotationApplication('SecretsManagerRDSPostgreSQLRotationMultiUser ', '1.0.86'); + + public static readonly SqlServerRotationSingleUser = new SecretRotationApplication('SecretsManagerRDSSQLServerRotationSingleUser', '1.0.57'); + public static readonly SqlServerRotationMultiUser = new SecretRotationApplication('SecretsManagerRDSSQLServerRotationMultiUser', '1.0.57'); public readonly applicationId: string; public readonly semanticVersion: string; @@ -24,39 +33,9 @@ export class ServerlessApplicationLocation { } /** - * The RDS database engine - */ -export enum DatabaseEngine { - /** - * MariaDB - */ - MariaDb = 'mariadb', - - /** - * MySQL - */ - Mysql = 'mysql', - - /** - * Oracle - */ - Oracle = 'oracle', - - /** - * PostgreSQL - */ - Postgres = 'postgres', - - /** - * SQL Server - */ - SqlServer = 'sqlserver' -} - -/** - * Options to add single user rotation to a database instance or cluster. + * Options to add secret rotation to a database instance or cluster. */ -export interface RotationSingleUserOptions { +export interface SecretRotationOptions { /** * Specifies the number of days after the previous rotation before * Secrets Manager triggers the next automatic rotation. @@ -64,19 +43,12 @@ export interface RotationSingleUserOptions { * @default 30 days */ readonly automaticallyAfterDays?: number; - - /** - * The location of the serverless application for the rotation. - * - * @default derived from the target's engine - */ - readonly serverlessApplicationLocation?: ServerlessApplicationLocation } /** - * Construction properties for a RotationSingleUser. + * Construction properties for a SecretRotation. */ -export interface RotationSingleUserProps extends RotationSingleUserOptions { +export interface SecretRotationProps extends SecretRotationOptions { /** * The secret to rotate. It must be a JSON string with the following format: * { @@ -85,7 +57,8 @@ export interface RotationSingleUserProps extends RotationSingleUserOptions { * 'username': , * 'password': , * 'dbname': , - * 'port': + * 'port': , + * 'masterarn': * } * * This is typically the case for a secret referenced from an AWS::SecretsManager::SecretTargetAttachment @@ -94,11 +67,9 @@ export interface RotationSingleUserProps extends RotationSingleUserOptions { readonly secret: secretsmanager.ISecret; /** - * The database engine. Either `serverlessApplicationLocation` or `engine` must be specified. - * - * @default - No engine specified. + * The serverless application for the rotation. */ - readonly engine?: DatabaseEngine; + readonly application: SecretRotationApplication; /** * The VPC where the Lambda rotation function will run. @@ -119,16 +90,12 @@ export interface RotationSingleUserProps extends RotationSingleUserOptions { } /** - * Single user secret rotation for a database instance or cluster. + * Secret rotation for a database instance or cluster. */ -export class RotationSingleUser extends cdk.Construct { - constructor(scope: cdk.Construct, id: string, props: RotationSingleUserProps) { +export class SecretRotation extends Construct { + constructor(scope: Construct, id: string, props: SecretRotationProps) { super(scope, id); - if (!props.serverlessApplicationLocation && !props.engine) { - throw new Error('Either `serverlessApplicationLocation` or `engine` must be specified.'); - } - if (!props.target.connections.defaultPortRange) { throw new Error('The `target` connections must have a default port range.'); } @@ -144,7 +111,7 @@ export class RotationSingleUser extends cdk.Construct { props.target.connections.allowDefaultPortFrom(securityGroup); const application = new serverless.CfnApplication(this, 'Resource', { - location: props.serverlessApplicationLocation || getApplicationLocation(props.engine), + location: props.application, parameters: { endpoint: `https://secretsmanager.${this.node.stack.region}.${this.node.stack.urlSuffix}`, functionName: rotationFunctionName, @@ -161,8 +128,8 @@ export class RotationSingleUser extends cdk.Construct { resourceName: rotationFunctionName })); - // Cannot use rotationLambda.addPermission because it currently does not - // return a cdk.Construct and we need to add a dependency. + // Cannot use rotationLambda.addPermission because it's a no-op on imported + // functions. const permission = new lambda.CfnPermission(this, 'Permission', { action: 'lambda:InvokeFunction', functionName: rotationFunctionName, @@ -177,26 +144,3 @@ export class RotationSingleUser extends cdk.Construct { rotationSchedule.node.addDependency(permission); // Cannot rotate without permission } } - -/** - * Returns the location for the rotation single user application. - * - * @param engine the database engine - * @throws if the engine is not supported - */ -function getApplicationLocation(engine: string = ''): ServerlessApplicationLocation { - switch (engine) { - case DatabaseEngine.MariaDb: - return ServerlessApplicationLocation.MariaDbRotationSingleUser; - case DatabaseEngine.Mysql: - return ServerlessApplicationLocation.MysqlRotationSingleUser; - case DatabaseEngine.Oracle: - return ServerlessApplicationLocation.OracleRotationSingleUser; - case DatabaseEngine.Postgres: - return ServerlessApplicationLocation.PostgresRotationSingleUser; - case DatabaseEngine.SqlServer: - return ServerlessApplicationLocation.SqlServerRotationSingleUser; - default: - throw new Error(`Engine ${engine} not supported for single user rotation.`); - } -} diff --git a/packages/@aws-cdk/aws-rds/package.json b/packages/@aws-cdk/aws-rds/package.json index 8fe84f834ecd1..c60e3fb830a42 100644 --- a/packages/@aws-cdk/aws-rds/package.json +++ b/packages/@aws-cdk/aws-rds/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-rds", - "version": "0.32.0", + "version": "0.33.0", "description": "CDK Constructs for AWS RDS", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -60,32 +60,44 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "cdk-build-tools": "^0.32.0", - "cdk-integ-tools": "^0.32.0", - "cfn2ts": "^0.32.0", - "pkglint": "^0.32.0" + "@aws-cdk/assert": "^0.33.0", + "@aws-cdk/aws-events-targets": "^0.33.0", + "cdk-build-tools": "^0.33.0", + "cdk-integ-tools": "^0.33.0", + "cfn2ts": "^0.33.0", + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/aws-ec2": "^0.32.0", - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/aws-kms": "^0.32.0", - "@aws-cdk/aws-lambda": "^0.32.0", - "@aws-cdk/aws-sam": "^0.32.0", - "@aws-cdk/aws-secretsmanager": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/aws-cloudwatch": "^0.33.0", + "@aws-cdk/aws-ec2": "^0.33.0", + "@aws-cdk/aws-events": "^0.33.0", + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/aws-kms": "^0.33.0", + "@aws-cdk/aws-lambda": "^0.33.0", + "@aws-cdk/aws-logs": "^0.33.0", + "@aws-cdk/aws-sam": "^0.33.0", + "@aws-cdk/aws-secretsmanager": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0" }, "homepage": "https://github.com/awslabs/aws-cdk", "peerDependencies": { - "@aws-cdk/aws-ec2": "^0.32.0", - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/aws-kms": "^0.32.0", - "@aws-cdk/aws-lambda": "^0.32.0", - "@aws-cdk/aws-sam": "^0.32.0", - "@aws-cdk/aws-secretsmanager": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/aws-cloudwatch": "^0.33.0", + "@aws-cdk/aws-ec2": "^0.33.0", + "@aws-cdk/aws-events": "^0.33.0", + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/aws-kms": "^0.33.0", + "@aws-cdk/aws-lambda": "^0.33.0", + "@aws-cdk/aws-logs": "^0.33.0", + "@aws-cdk/aws-sam": "^0.33.0", + "@aws-cdk/aws-secretsmanager": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0" }, "engines": { "node": ">= 8.10.0" + }, + "awslint": { + "exclude": [ + "construct-base-is-private:@aws-cdk/aws-rds.DatabaseInstanceBase" + ] } } diff --git a/packages/@aws-cdk/aws-rds/test/integ.cluster-rotation.lit.expected.json b/packages/@aws-cdk/aws-rds/test/integ.cluster-rotation.lit.expected.json index 774d57074bb82..306be57a6bd12 100644 --- a/packages/@aws-cdk/aws-rds/test/integ.cluster-rotation.lit.expected.json +++ b/packages/@aws-cdk/aws-rds/test/integ.cluster-rotation.lit.expected.json @@ -724,7 +724,7 @@ "Properties": { "Location": { "ApplicationId": "arn:aws:serverlessrepo:us-east-1:297356227824:applications/SecretsManagerRDSMySQLRotationSingleUser", - "SemanticVersion": "1.0.74" + "SemanticVersion": "1.0.85" }, "Parameters": { "endpoint": { diff --git a/packages/@aws-cdk/aws-rds/test/integ.cluster.ts b/packages/@aws-cdk/aws-rds/test/integ.cluster.ts index 84f843221df86..5e24f1370df2f 100644 --- a/packages/@aws-cdk/aws-rds/test/integ.cluster.ts +++ b/packages/@aws-cdk/aws-rds/test/integ.cluster.ts @@ -3,7 +3,7 @@ import kms = require('@aws-cdk/aws-kms'); import cdk = require('@aws-cdk/cdk'); import { SecretValue } from '@aws-cdk/cdk'; import { DatabaseCluster, DatabaseClusterEngine } from '../lib'; -import { ClusterParameterGroup } from '../lib/cluster-parameter-group'; +import { ClusterParameterGroup } from '../lib/parameter-group'; const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-cdk-rds-integ'); @@ -13,8 +13,10 @@ const vpc = new ec2.Vpc(stack, 'VPC', { maxAZs: 2 }); const params = new ClusterParameterGroup(stack, 'Params', { family: 'aurora5.6', description: 'A nice parameter group', + parameters: { + character_set_database: 'utf8mb4' + } }); -params.setParameter('character_set_database', 'utf8mb4'); const kmsKey = new kms.Key(stack, 'DbSecurity'); const cluster = new DatabaseCluster(stack, 'Database', { diff --git a/packages/@aws-cdk/aws-rds/test/integ.instance.lit.expected.json b/packages/@aws-cdk/aws-rds/test/integ.instance.lit.expected.json new file mode 100644 index 0000000000000..fa1f1d4ac9f2d --- /dev/null +++ b/packages/@aws-cdk/aws-rds/test/integ.instance.lit.expected.json @@ -0,0 +1,1126 @@ +{ + "Transform": "AWS::Serverless-2016-10-31", + "Resources": { + "VPCB9E5F0B4": { + "Type": "AWS::EC2::VPC", + "Properties": { + "CidrBlock": "10.0.0.0/16", + "EnableDnsHostnames": true, + "EnableDnsSupport": true, + "InstanceTenancy": "default", + "Tags": [ + { + "Key": "Name", + "Value": "aws-cdk-rds-instance/VPC" + } + ] + } + }, + "VPCPublicSubnet1SubnetB4246D30": { + "Type": "AWS::EC2::Subnet", + "Properties": { + "CidrBlock": "10.0.0.0/18", + "VpcId": { + "Ref": "VPCB9E5F0B4" + }, + "AvailabilityZone": "test-region-1a", + "MapPublicIpOnLaunch": true, + "Tags": [ + { + "Key": "Name", + "Value": "aws-cdk-rds-instance/VPC/PublicSubnet1" + }, + { + "Key": "aws-cdk:subnet-name", + "Value": "Public" + }, + { + "Key": "aws-cdk:subnet-type", + "Value": "Public" + } + ] + } + }, + "VPCPublicSubnet1RouteTableFEE4B781": { + "Type": "AWS::EC2::RouteTable", + "Properties": { + "VpcId": { + "Ref": "VPCB9E5F0B4" + }, + "Tags": [ + { + "Key": "Name", + "Value": "aws-cdk-rds-instance/VPC/PublicSubnet1" + } + ] + } + }, + "VPCPublicSubnet1RouteTableAssociation0B0896DC": { + "Type": "AWS::EC2::SubnetRouteTableAssociation", + "Properties": { + "RouteTableId": { + "Ref": "VPCPublicSubnet1RouteTableFEE4B781" + }, + "SubnetId": { + "Ref": "VPCPublicSubnet1SubnetB4246D30" + } + } + }, + "VPCPublicSubnet1DefaultRoute91CEF279": { + "Type": "AWS::EC2::Route", + "Properties": { + "RouteTableId": { + "Ref": "VPCPublicSubnet1RouteTableFEE4B781" + }, + "DestinationCidrBlock": "0.0.0.0/0", + "GatewayId": { + "Ref": "VPCIGWB7E252D3" + } + }, + "DependsOn": [ + "VPCVPCGW99B986DC" + ] + }, + "VPCPublicSubnet1EIP6AD938E8": { + "Type": "AWS::EC2::EIP", + "Properties": { + "Domain": "vpc" + } + }, + "VPCPublicSubnet1NATGatewayE0556630": { + "Type": "AWS::EC2::NatGateway", + "Properties": { + "AllocationId": { + "Fn::GetAtt": [ + "VPCPublicSubnet1EIP6AD938E8", + "AllocationId" + ] + }, + "SubnetId": { + "Ref": "VPCPublicSubnet1SubnetB4246D30" + }, + "Tags": [ + { + "Key": "Name", + "Value": "aws-cdk-rds-instance/VPC/PublicSubnet1" + } + ] + } + }, + "VPCPublicSubnet2Subnet74179F39": { + "Type": "AWS::EC2::Subnet", + "Properties": { + "CidrBlock": "10.0.64.0/18", + "VpcId": { + "Ref": "VPCB9E5F0B4" + }, + "AvailabilityZone": "test-region-1b", + "MapPublicIpOnLaunch": true, + "Tags": [ + { + "Key": "Name", + "Value": "aws-cdk-rds-instance/VPC/PublicSubnet2" + }, + { + "Key": "aws-cdk:subnet-name", + "Value": "Public" + }, + { + "Key": "aws-cdk:subnet-type", + "Value": "Public" + } + ] + } + }, + "VPCPublicSubnet2RouteTable6F1A15F1": { + "Type": "AWS::EC2::RouteTable", + "Properties": { + "VpcId": { + "Ref": "VPCB9E5F0B4" + }, + "Tags": [ + { + "Key": "Name", + "Value": "aws-cdk-rds-instance/VPC/PublicSubnet2" + } + ] + } + }, + "VPCPublicSubnet2RouteTableAssociation5A808732": { + "Type": "AWS::EC2::SubnetRouteTableAssociation", + "Properties": { + "RouteTableId": { + "Ref": "VPCPublicSubnet2RouteTable6F1A15F1" + }, + "SubnetId": { + "Ref": "VPCPublicSubnet2Subnet74179F39" + } + } + }, + "VPCPublicSubnet2DefaultRouteB7481BBA": { + "Type": "AWS::EC2::Route", + "Properties": { + "RouteTableId": { + "Ref": "VPCPublicSubnet2RouteTable6F1A15F1" + }, + "DestinationCidrBlock": "0.0.0.0/0", + "GatewayId": { + "Ref": "VPCIGWB7E252D3" + } + }, + "DependsOn": [ + "VPCVPCGW99B986DC" + ] + }, + "VPCPublicSubnet2EIP4947BC00": { + "Type": "AWS::EC2::EIP", + "Properties": { + "Domain": "vpc" + } + }, + "VPCPublicSubnet2NATGateway3C070193": { + "Type": "AWS::EC2::NatGateway", + "Properties": { + "AllocationId": { + "Fn::GetAtt": [ + "VPCPublicSubnet2EIP4947BC00", + "AllocationId" + ] + }, + "SubnetId": { + "Ref": "VPCPublicSubnet2Subnet74179F39" + }, + "Tags": [ + { + "Key": "Name", + "Value": "aws-cdk-rds-instance/VPC/PublicSubnet2" + } + ] + } + }, + "VPCPrivateSubnet1Subnet8BCA10E0": { + "Type": "AWS::EC2::Subnet", + "Properties": { + "CidrBlock": "10.0.128.0/18", + "VpcId": { + "Ref": "VPCB9E5F0B4" + }, + "AvailabilityZone": "test-region-1a", + "MapPublicIpOnLaunch": false, + "Tags": [ + { + "Key": "Name", + "Value": "aws-cdk-rds-instance/VPC/PrivateSubnet1" + }, + { + "Key": "aws-cdk:subnet-name", + "Value": "Private" + }, + { + "Key": "aws-cdk:subnet-type", + "Value": "Private" + } + ] + } + }, + "VPCPrivateSubnet1RouteTableBE8A6027": { + "Type": "AWS::EC2::RouteTable", + "Properties": { + "VpcId": { + "Ref": "VPCB9E5F0B4" + }, + "Tags": [ + { + "Key": "Name", + "Value": "aws-cdk-rds-instance/VPC/PrivateSubnet1" + } + ] + } + }, + "VPCPrivateSubnet1RouteTableAssociation347902D1": { + "Type": "AWS::EC2::SubnetRouteTableAssociation", + "Properties": { + "RouteTableId": { + "Ref": "VPCPrivateSubnet1RouteTableBE8A6027" + }, + "SubnetId": { + "Ref": "VPCPrivateSubnet1Subnet8BCA10E0" + } + } + }, + "VPCPrivateSubnet1DefaultRouteAE1D6490": { + "Type": "AWS::EC2::Route", + "Properties": { + "RouteTableId": { + "Ref": "VPCPrivateSubnet1RouteTableBE8A6027" + }, + "DestinationCidrBlock": "0.0.0.0/0", + "NatGatewayId": { + "Ref": "VPCPublicSubnet1NATGatewayE0556630" + } + } + }, + "VPCPrivateSubnet2SubnetCFCDAA7A": { + "Type": "AWS::EC2::Subnet", + "Properties": { + "CidrBlock": "10.0.192.0/18", + "VpcId": { + "Ref": "VPCB9E5F0B4" + }, + "AvailabilityZone": "test-region-1b", + "MapPublicIpOnLaunch": false, + "Tags": [ + { + "Key": "Name", + "Value": "aws-cdk-rds-instance/VPC/PrivateSubnet2" + }, + { + "Key": "aws-cdk:subnet-name", + "Value": "Private" + }, + { + "Key": "aws-cdk:subnet-type", + "Value": "Private" + } + ] + } + }, + "VPCPrivateSubnet2RouteTable0A19E10E": { + "Type": "AWS::EC2::RouteTable", + "Properties": { + "VpcId": { + "Ref": "VPCB9E5F0B4" + }, + "Tags": [ + { + "Key": "Name", + "Value": "aws-cdk-rds-instance/VPC/PrivateSubnet2" + } + ] + } + }, + "VPCPrivateSubnet2RouteTableAssociation0C73D413": { + "Type": "AWS::EC2::SubnetRouteTableAssociation", + "Properties": { + "RouteTableId": { + "Ref": "VPCPrivateSubnet2RouteTable0A19E10E" + }, + "SubnetId": { + "Ref": "VPCPrivateSubnet2SubnetCFCDAA7A" + } + } + }, + "VPCPrivateSubnet2DefaultRouteF4F5CFD2": { + "Type": "AWS::EC2::Route", + "Properties": { + "RouteTableId": { + "Ref": "VPCPrivateSubnet2RouteTable0A19E10E" + }, + "DestinationCidrBlock": "0.0.0.0/0", + "NatGatewayId": { + "Ref": "VPCPublicSubnet2NATGateway3C070193" + } + } + }, + "VPCIGWB7E252D3": { + "Type": "AWS::EC2::InternetGateway", + "Properties": { + "Tags": [ + { + "Key": "Name", + "Value": "aws-cdk-rds-instance/VPC" + } + ] + } + }, + "VPCVPCGW99B986DC": { + "Type": "AWS::EC2::VPCGatewayAttachment", + "Properties": { + "VpcId": { + "Ref": "VPCB9E5F0B4" + }, + "InternetGatewayId": { + "Ref": "VPCIGWB7E252D3" + } + } + }, + "ParameterGroup5E32DECB": { + "Type": "AWS::RDS::DBParameterGroup", + "Properties": { + "Description": "Parameter group for oracle-se1-11.2", + "Family": "oracle-se1-11.2", + "Parameters": { + "open_cursors": "2500" + } + } + }, + "OptionGroupSecurityGroupOEM7E39FD8C": { + "Type": "AWS::EC2::SecurityGroup", + "Properties": { + "GroupDescription": "Security group for OEM option", + "SecurityGroupEgress": [ + { + "CidrIp": "0.0.0.0/0", + "Description": "Allow all outbound traffic by default", + "IpProtocol": "-1" + } + ], + "SecurityGroupIngress": [ + { + "CidrIp": "0.0.0.0/0", + "Description": "from 0.0.0.0/0:1158", + "FromPort": 1158, + "IpProtocol": "tcp", + "ToPort": 1158 + } + ], + "VpcId": { + "Ref": "VPCB9E5F0B4" + } + } + }, + "OptionGroupACA43DC1": { + "Type": "AWS::RDS::OptionGroup", + "Properties": { + "EngineName": "oracle-se1", + "MajorEngineVersion": "11.2", + "OptionConfigurations": [ + { + "OptionName": "XMLDB" + }, + { + "OptionName": "OEM", + "Port": 1158, + "VpcSecurityGroupMemberships": [ + { + "Fn::GetAtt": [ + "OptionGroupSecurityGroupOEM7E39FD8C", + "GroupId" + ] + } + ] + } + ], + "OptionGroupDescription": "Option group for oracle-se1 11.2" + } + }, + "InstanceSubnetGroupF2CBA54F": { + "Type": "AWS::RDS::DBSubnetGroup", + "Properties": { + "DBSubnetGroupDescription": "Subnet group for Instance database", + "SubnetIds": [ + { + "Ref": "VPCPrivateSubnet1Subnet8BCA10E0" + }, + { + "Ref": "VPCPrivateSubnet2SubnetCFCDAA7A" + } + ] + } + }, + "InstanceSecurityGroupB4E5FA83": { + "Type": "AWS::EC2::SecurityGroup", + "Properties": { + "GroupDescription": "Security group for Instance database", + "SecurityGroupEgress": [ + { + "CidrIp": "0.0.0.0/0", + "Description": "Allow all outbound traffic by default", + "IpProtocol": "-1" + } + ], + "SecurityGroupIngress": [], + "VpcId": { + "Ref": "VPCB9E5F0B4" + } + } + }, + "InstanceSecurityGroupfrom00000IndirectPort7D6BC055": { + "Type": "AWS::EC2::SecurityGroupIngress", + "Properties": { + "IpProtocol": "tcp", + "CidrIp": "0.0.0.0/0", + "Description": "from 0.0.0.0/0:{IndirectPort}", + "FromPort": { + "Fn::GetAtt": [ + "InstanceC1063A87", + "Endpoint.Port" + ] + }, + "GroupId": { + "Fn::GetAtt": [ + "InstanceSecurityGroupB4E5FA83", + "GroupId" + ] + }, + "ToPort": { + "Fn::GetAtt": [ + "InstanceC1063A87", + "Endpoint.Port" + ] + } + } + }, + "InstanceSecurityGroupfromawscdkrdsinstanceInstanceRotationSecurityGroupBB71D98EIndirectPort60E4E51A": { + "Type": "AWS::EC2::SecurityGroupIngress", + "Properties": { + "IpProtocol": "tcp", + "Description": "from awscdkrdsinstanceInstanceRotationSecurityGroupBB71D98E:{IndirectPort}", + "FromPort": { + "Fn::GetAtt": [ + "InstanceC1063A87", + "Endpoint.Port" + ] + }, + "GroupId": { + "Fn::GetAtt": [ + "InstanceSecurityGroupB4E5FA83", + "GroupId" + ] + }, + "SourceSecurityGroupId": { + "Fn::GetAtt": [ + "InstanceRotationSecurityGroupEF8D211E", + "GroupId" + ] + }, + "ToPort": { + "Fn::GetAtt": [ + "InstanceC1063A87", + "Endpoint.Port" + ] + } + } + }, + "InstanceMonitoringRole3E2B4286": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "monitoring.rds.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "ManagedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AmazonRDSEnhancedMonitoringRole" + ] + ] + } + ] + } + }, + "InstanceSecret478E0A47": { + "Type": "AWS::SecretsManager::Secret", + "Properties": { + "GenerateSecretString": { + "ExcludeCharacters": "\"@/\\", + "GenerateStringKey": "password", + "PasswordLength": 30, + "SecretStringTemplate": "{\"username\":\"syscdk\"}" + } + } + }, + "InstanceSecretAttachedSecretBACA1D43": { + "Type": "AWS::SecretsManager::SecretTargetAttachment", + "Properties": { + "SecretId": { + "Ref": "InstanceSecret478E0A47" + }, + "TargetId": { + "Ref": "InstanceC1063A87" + }, + "TargetType": "AWS::RDS::DBInstance" + } + }, + "InstanceSecretAttachedSecretRotationSchedule275109B7": { + "Type": "AWS::SecretsManager::RotationSchedule", + "Properties": { + "SecretId": { + "Ref": "InstanceSecretAttachedSecretBACA1D43" + }, + "RotationLambdaARN": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":lambda:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":function:awscdkrdsinstanceInstanceRotation0925DC60" + ] + ] + }, + "RotationRules": { + "AutomaticallyAfterDays": 30 + } + }, + "DependsOn": [ + "InstanceRotationPermission63844D0A" + ] + }, + "InstanceC1063A87": { + "Type": "AWS::RDS::DBInstance", + "Properties": { + "DBInstanceClass": "db.t2.medium", + "AllocatedStorage": "100", + "AutoMinorVersionUpgrade": false, + "BackupRetentionPeriod": "7", + "CopyTagsToSnapshot": true, + "DBName": "ORCL", + "DBParameterGroupName": { + "Ref": "ParameterGroup5E32DECB" + }, + "DBSubnetGroupName": { + "Ref": "InstanceSubnetGroupF2CBA54F" + }, + "DeletionProtection": true, + "EnableCloudwatchLogsExports": [ + "trace", + "audit", + "alert", + "listener" + ], + "EnablePerformanceInsights": true, + "Engine": "oracle-se1", + "Iops": 1000, + "LicenseModel": "bring-your-own-license", + "MasterUsername": { + "Fn::Join": [ + "", + [ + "{{resolve:secretsmanager:", + { + "Ref": "InstanceSecret478E0A47" + }, + ":SecretString:username::}}" + ] + ] + }, + "MasterUserPassword": { + "Fn::Join": [ + "", + [ + "{{resolve:secretsmanager:", + { + "Ref": "InstanceSecret478E0A47" + }, + ":SecretString:password::}}" + ] + ] + }, + "MonitoringInterval": 60, + "MonitoringRoleArn": { + "Fn::GetAtt": [ + "InstanceMonitoringRole3E2B4286", + "Arn" + ] + }, + "MultiAZ": true, + "OptionGroupName": { + "Ref": "OptionGroupACA43DC1" + }, + "PerformanceInsightsRetentionPeriod": 7, + "StorageEncrypted": true, + "StorageType": "io1", + "VPCSecurityGroups": [ + { + "Fn::GetAtt": [ + "InstanceSecurityGroupB4E5FA83", + "GroupId" + ] + } + ] + }, + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain" + }, + "InstanceLogRetentiontrace487771C8": { + "Type": "Custom::LogRetention", + "Properties": { + "ServiceToken": { + "Fn::GetAtt": [ + "LogRetentionaae0aa3c5b4d4f87b02d85b201efdd8aFD4BFC8A", + "Arn" + ] + }, + "LogGroupName": { + "Fn::Join": [ + "", + [ + "/aws/rds/instance/", + { + "Ref": "InstanceC1063A87" + }, + "/trace" + ] + ] + }, + "RetentionInDays": 30 + } + }, + "InstanceLogRetentionaudit55C07CF6": { + "Type": "Custom::LogRetention", + "Properties": { + "ServiceToken": { + "Fn::GetAtt": [ + "LogRetentionaae0aa3c5b4d4f87b02d85b201efdd8aFD4BFC8A", + "Arn" + ] + }, + "LogGroupName": { + "Fn::Join": [ + "", + [ + "/aws/rds/instance/", + { + "Ref": "InstanceC1063A87" + }, + "/audit" + ] + ] + }, + "RetentionInDays": 30 + } + }, + "InstanceLogRetentionalert2B4B024B": { + "Type": "Custom::LogRetention", + "Properties": { + "ServiceToken": { + "Fn::GetAtt": [ + "LogRetentionaae0aa3c5b4d4f87b02d85b201efdd8aFD4BFC8A", + "Arn" + ] + }, + "LogGroupName": { + "Fn::Join": [ + "", + [ + "/aws/rds/instance/", + { + "Ref": "InstanceC1063A87" + }, + "/alert" + ] + ] + }, + "RetentionInDays": 30 + } + }, + "InstanceLogRetentionlistener232E8C3C": { + "Type": "Custom::LogRetention", + "Properties": { + "ServiceToken": { + "Fn::GetAtt": [ + "LogRetentionaae0aa3c5b4d4f87b02d85b201efdd8aFD4BFC8A", + "Arn" + ] + }, + "LogGroupName": { + "Fn::Join": [ + "", + [ + "/aws/rds/instance/", + { + "Ref": "InstanceC1063A87" + }, + "/listener" + ] + ] + }, + "RetentionInDays": 30 + } + }, + "InstanceRotationSecurityGroupEF8D211E": { + "Type": "AWS::EC2::SecurityGroup", + "Properties": { + "GroupDescription": "aws-cdk-rds-instance/Instance/Rotation/SecurityGroup", + "SecurityGroupEgress": [ + { + "CidrIp": "0.0.0.0/0", + "Description": "Allow all outbound traffic by default", + "IpProtocol": "-1" + } + ], + "SecurityGroupIngress": [], + "VpcId": { + "Ref": "VPCB9E5F0B4" + } + } + }, + "InstanceRotationAA37A997": { + "Type": "AWS::Serverless::Application", + "Properties": { + "Location": { + "ApplicationId": "arn:aws:serverlessrepo:us-east-1:297356227824:applications/SecretsManagerRDSOracleRotationSingleUser", + "SemanticVersion": "1.0.56" + }, + "Parameters": { + "endpoint": { + "Fn::Join": [ + "", + [ + "https://secretsmanager.", + { + "Ref": "AWS::Region" + }, + ".", + { + "Ref": "AWS::URLSuffix" + } + ] + ] + }, + "functionName": "awscdkrdsinstanceInstanceRotation0925DC60", + "vpcSecurityGroupIds": { + "Fn::GetAtt": [ + "InstanceRotationSecurityGroupEF8D211E", + "GroupId" + ] + }, + "vpcSubnetIds": { + "Fn::Join": [ + "", + [ + { + "Ref": "VPCPrivateSubnet1Subnet8BCA10E0" + }, + ",", + { + "Ref": "VPCPrivateSubnet2SubnetCFCDAA7A" + } + ] + ] + } + } + } + }, + "InstanceRotationPermission63844D0A": { + "Type": "AWS::Lambda::Permission", + "Properties": { + "Action": "lambda:InvokeFunction", + "FunctionName": "awscdkrdsinstanceInstanceRotation0925DC60", + "Principal": { + "Fn::Join": [ + "", + [ + "secretsmanager.", + { + "Ref": "AWS::URLSuffix" + } + ] + ] + } + }, + "DependsOn": [ + "InstanceRotationAA37A997" + ] + }, + "InstanceAvailabilityAD5D452C": { + "Type": "AWS::Events::Rule", + "Properties": { + "EventPattern": { + "source": [ + "aws.rds" + ], + "resources": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":rds:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":db:", + { + "Ref": "InstanceC1063A87" + } + ] + ] + } + ], + "detail": { + "EventCategories": [ + "availability" + ] + } + }, + "State": "ENABLED", + "Targets": [ + { + "Arn": { + "Fn::GetAtt": [ + "Function76856677", + "Arn" + ] + }, + "Id": "Function" + } + ] + } + }, + "LogRetentionaae0aa3c5b4d4f87b02d85b201efdd8aServiceRole9741ECFB": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": { + "Fn::Join": [ + "", + [ + "lambda.", + { + "Ref": "AWS::URLSuffix" + } + ] + ] + } + } + } + ], + "Version": "2012-10-17" + }, + "ManagedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + } + }, + "LogRetentionaae0aa3c5b4d4f87b02d85b201efdd8aServiceRoleDefaultPolicyADDA7DEB": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "logs:PutRetentionPolicy", + "logs:DeleteRetentionPolicy" + ], + "Effect": "Allow", + "Resource": "*" + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "LogRetentionaae0aa3c5b4d4f87b02d85b201efdd8aServiceRoleDefaultPolicyADDA7DEB", + "Roles": [ + { + "Ref": "LogRetentionaae0aa3c5b4d4f87b02d85b201efdd8aServiceRole9741ECFB" + } + ] + } + }, + "LogRetentionaae0aa3c5b4d4f87b02d85b201efdd8aFD4BFC8A": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "S3Bucket": { + "Ref": "LogRetentionaae0aa3c5b4d4f87b02d85b201efdd8aCodeS3BucketB81211B5" + }, + "S3Key": { + "Fn::Join": [ + "", + [ + { + "Fn::Select": [ + 0, + { + "Fn::Split": [ + "||", + { + "Ref": "LogRetentionaae0aa3c5b4d4f87b02d85b201efdd8aCodeS3VersionKey10C1B354" + } + ] + } + ] + }, + { + "Fn::Select": [ + 1, + { + "Fn::Split": [ + "||", + { + "Ref": "LogRetentionaae0aa3c5b4d4f87b02d85b201efdd8aCodeS3VersionKey10C1B354" + } + ] + } + ] + } + ] + ] + } + }, + "Handler": "index.handler", + "Role": { + "Fn::GetAtt": [ + "LogRetentionaae0aa3c5b4d4f87b02d85b201efdd8aServiceRole9741ECFB", + "Arn" + ] + }, + "Runtime": "nodejs8.10" + }, + "DependsOn": [ + "LogRetentionaae0aa3c5b4d4f87b02d85b201efdd8aServiceRoleDefaultPolicyADDA7DEB", + "LogRetentionaae0aa3c5b4d4f87b02d85b201efdd8aServiceRole9741ECFB" + ] + }, + "HighCPU94686517": { + "Type": "AWS::CloudWatch::Alarm", + "Properties": { + "ComparisonOperator": "GreaterThanOrEqualToThreshold", + "EvaluationPeriods": 1, + "Threshold": 90, + "Dimensions": [ + { + "Name": "DBInstanceIdentifier", + "Value": { + "Ref": "InstanceC1063A87" + } + } + ], + "MetricName": "CPUUtilization", + "Namespace": "AWS/RDS", + "Period": 300, + "Statistic": "Average" + } + }, + "FunctionServiceRole675BB04A": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": { + "Fn::Join": [ + "", + [ + "lambda.", + { + "Ref": "AWS::URLSuffix" + } + ] + ] + } + } + } + ], + "Version": "2012-10-17" + }, + "ManagedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + } + }, + "Function76856677": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "ZipFile": "exports.handler = (event) => console.log(event);" + }, + "Handler": "index.handler", + "Role": { + "Fn::GetAtt": [ + "FunctionServiceRole675BB04A", + "Arn" + ] + }, + "Runtime": "nodejs8.10" + }, + "DependsOn": [ + "FunctionServiceRole675BB04A" + ] + }, + "FunctionAllowEventRuleawscdkrdsinstanceInstanceAvailabilityCE39A6A71E819C19": { + "Type": "AWS::Lambda::Permission", + "Properties": { + "Action": "lambda:InvokeFunction", + "FunctionName": { + "Fn::GetAtt": [ + "Function76856677", + "Arn" + ] + }, + "Principal": "events.amazonaws.com", + "SourceArn": { + "Fn::GetAtt": [ + "InstanceAvailabilityAD5D452C", + "Arn" + ] + } + } + } + }, + "Parameters": { + "LogRetentionaae0aa3c5b4d4f87b02d85b201efdd8aCodeS3BucketB81211B5": { + "Type": "String", + "Description": "S3 bucket for asset \"aws-cdk-rds-instance/LogRetentionaae0aa3c5b4d4f87b02d85b201efdd8a/Code\"" + }, + "LogRetentionaae0aa3c5b4d4f87b02d85b201efdd8aCodeS3VersionKey10C1B354": { + "Type": "String", + "Description": "S3 key for asset version \"aws-cdk-rds-instance/LogRetentionaae0aa3c5b4d4f87b02d85b201efdd8a/Code\"" + }, + "LogRetentionaae0aa3c5b4d4f87b02d85b201efdd8aCodeArtifactHash327647CC": { + "Type": "String", + "Description":"Artifact hash for asset \"aws-cdk-rds-instance/LogRetentionaae0aa3c5b4d4f87b02d85b201efdd8a/Code\"" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-rds/test/integ.instance.lit.ts b/packages/@aws-cdk/aws-rds/test/integ.instance.lit.ts new file mode 100644 index 0000000000000..a8f1143dc96aa --- /dev/null +++ b/packages/@aws-cdk/aws-rds/test/integ.instance.lit.ts @@ -0,0 +1,104 @@ +import cloudwatch = require('@aws-cdk/aws-cloudwatch'); +import ec2 = require('@aws-cdk/aws-ec2'); +import targets = require('@aws-cdk/aws-events-targets'); +import lambda = require('@aws-cdk/aws-lambda'); +import logs = require('@aws-cdk/aws-logs'); +import cdk = require('@aws-cdk/cdk'); +import rds = require('../lib'); + +const app = new cdk.App(); + +class DatabaseInstanceStack extends cdk.Stack { + constructor(scope: cdk.App, id: string, props?: cdk.StackProps) { + super(scope, id, props); + + const vpc = new ec2.Vpc(this, 'VPC', { maxAZs: 2 }); + + /// !show + // Set open cursors with parameter group + const parameterGroup = new rds.ParameterGroup(this, 'ParameterGroup', { + family: 'oracle-se1-11.2', + parameters: { + open_cursors: '2500' + } + }); + + /// Add XMLDB and OEM with option group + const optionGroup = new rds.OptionGroup(this, 'OptionGroup', { + engine: rds.DatabaseInstanceEngine.OracleSE1, + majorEngineVersion: '11.2', + configurations: [ + { + name: 'XMLDB' + }, + { + name: 'OEM', + port: 1158, + vpc + } + ] + }); + + // Allow connections to OEM + optionGroup.optionConnections.OEM.connections.allowDefaultPortFromAnyIpv4(); + + // Database instance with production values + const instance = new rds.DatabaseInstance(this, 'Instance', { + engine: rds.DatabaseInstanceEngine.OracleSE1, + licenseModel: rds.LicenseModel.BringYourOwnLicense, + instanceClass: new ec2.InstanceTypePair(ec2.InstanceClass.Burstable2, ec2.InstanceSize.Medium), + multiAz: true, + storageType: rds.StorageType.IO1, + masterUsername: 'syscdk', + vpc, + databaseName: 'ORCL', + storageEncrypted: true, + backupRetentionPeriod: 7, + monitoringInterval: 60, + enablePerformanceInsights: true, + cloudwatchLogsExports: [ + 'trace', + 'audit', + 'alert', + 'listener' + ], + cloudwatchLogsRetention: logs.RetentionDays.OneMonth, + autoMinorVersionUpgrade: false, + optionGroup, + parameterGroup + }); + + // Allow connections on default port from any IPV4 + instance.connections.allowDefaultPortFromAnyIpv4(); + + // Rotate the master user password every 30 days + instance.addRotationSingleUser('Rotation'); + + // Add alarm for high CPU + new cloudwatch.Alarm(this, 'HighCPU', { + metric: instance.metricCPUUtilization(), + threshold: 90, + evaluationPeriods: 1 + }); + + // Trigger Lambda function on instance availability events + const fn = new lambda.Function(this, 'Function', { + code: lambda.Code.inline('exports.handler = (event) => console.log(event);'), + handler: 'index.handler', + runtime: lambda.Runtime.NodeJS810 + }); + + const availabilityRule = instance.onEvent('Availability', { target: new targets.LambdaFunction(fn) }); + availabilityRule.addEventPattern({ + detail: { + EventCategories: [ + 'availability' + ] + } + }); + /// !hide + } +} + +new DatabaseInstanceStack(app, 'aws-cdk-rds-instance'); +app.run(); diff --git a/packages/@aws-cdk/aws-rds/test/test.cluster.ts b/packages/@aws-cdk/aws-rds/test/test.cluster.ts index 09d7e6a8615d2..a56b720228e54 100644 --- a/packages/@aws-cdk/aws-rds/test/test.cluster.ts +++ b/packages/@aws-cdk/aws-rds/test/test.cluster.ts @@ -4,7 +4,7 @@ import kms = require('@aws-cdk/aws-kms'); import cdk = require('@aws-cdk/cdk'); import { SecretValue } from '@aws-cdk/cdk'; import { Test } from 'nodeunit'; -import { ClusterParameterGroup, DatabaseCluster, DatabaseClusterEngine } from '../lib'; +import { ClusterParameterGroup, DatabaseCluster, DatabaseClusterEngine, ParameterGroup } from '../lib'; export = { 'check that instantiation works'(test: Test) { @@ -145,18 +145,6 @@ export = { test.done(); }, - 'import/export cluster parameter group'(test: Test) { - // GIVEN - const stack = testStack(); - - // WHEN - const imported = ClusterParameterGroup.fromParameterGroupName(stack, 'ImportParams', 'name-of-param-group'); - - // THEN - test.deepEqual(stack.node.resolve(imported.parameterGroupName), 'name-of-param-group'); - test.done(); - }, - 'creates a secret when master credentials are not specified'(test: Test) { // GIVEN const stack = testStack(); @@ -242,6 +230,94 @@ export = { } })); + test.done(); + }, + + 'cluster with instance parameter group'(test: Test) { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + const parameterGroup = new ParameterGroup(stack, 'ParameterGroup', { + family: 'hello', + parameters: { + key: 'value' + } + }); + + // WHEN + new DatabaseCluster(stack, 'Database', { + engine: DatabaseClusterEngine.Aurora, + masterUser: { + username: 'admin', + }, + instanceProps: { + instanceType: new ec2.InstanceTypePair(ec2.InstanceClass.Burstable2, ec2.InstanceSize.Small), + parameterGroup, + vpc + } + }); + + expect(stack).to(haveResource('AWS::RDS::DBInstance', { + DBParameterGroupName: { + Ref: 'ParameterGroup5E32DECB' + } + })); + + test.done(); + + }, + + 'create a cluster using a specific version of MySQL'(test: Test) { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + // WHEN + new DatabaseCluster(stack, 'Database', { + engine: DatabaseClusterEngine.AuroraMysql, + engineVersion: "5.7.mysql_aurora.2.04.4", + masterUser: { + username: 'admin' + }, + instanceProps: { + instanceType: new ec2.InstanceTypePair(ec2.InstanceClass.Burstable2, ec2.InstanceSize.Small), + vpc + }, + }); + + // THEN + expect(stack).to(haveResource('AWS::RDS::DBCluster', { + Engine: "aurora-mysql", + EngineVersion: "5.7.mysql_aurora.2.04.4", + })); + + test.done(); + }, + + 'create a cluster using a specific version of Postgresql'(test: Test) { + // GIVEN + const stack = testStack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + // WHEN + new DatabaseCluster(stack, 'Database', { + engine: DatabaseClusterEngine.AuroraPostgresql, + engineVersion: "10.7", + masterUser: { + username: 'admin' + }, + instanceProps: { + instanceType: new ec2.InstanceTypePair(ec2.InstanceClass.Burstable2, ec2.InstanceSize.Small), + vpc + }, + }); + + // THEN + expect(stack).to(haveResource('AWS::RDS::DBCluster', { + Engine: "aurora-postgresql", + EngineVersion: "10.7", + })); + test.done(); } }; diff --git a/packages/@aws-cdk/aws-rds/test/test.instance.ts b/packages/@aws-cdk/aws-rds/test/test.instance.ts new file mode 100644 index 0000000000000..cfd1287ba49d2 --- /dev/null +++ b/packages/@aws-cdk/aws-rds/test/test.instance.ts @@ -0,0 +1,380 @@ +import { countResources, expect, haveResource, ResourcePart } from '@aws-cdk/assert'; +import ec2 = require('@aws-cdk/aws-ec2'); +import targets = require('@aws-cdk/aws-events-targets'); +import lambda = require('@aws-cdk/aws-lambda'); +import logs = require('@aws-cdk/aws-logs'); +import cdk = require('@aws-cdk/cdk'); +import { Test } from 'nodeunit'; +import rds = require('../lib'); + +export = { + 'create a DB instance'(test: Test) { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + // WHEN + new rds.DatabaseInstance(stack, 'Instance', { + engine: rds.DatabaseInstanceEngine.OracleSE1, + licenseModel: rds.LicenseModel.BringYourOwnLicense, + instanceClass: new ec2.InstanceTypePair(ec2.InstanceClass.Burstable2, ec2.InstanceSize.Medium), + multiAz: true, + storageType: rds.StorageType.IO1, + masterUsername: 'syscdk', + vpc, + databaseName: 'ORCL', + storageEncrypted: true, + backupRetentionPeriod: 7, + monitoringInterval: 60, + enablePerformanceInsights: true, + cloudwatchLogsExports: [ + 'trace', + 'audit', + 'alert', + 'listener' + ], + cloudwatchLogsRetention: logs.RetentionDays.OneMonth, + autoMinorVersionUpgrade: false, + }); + + // THEN + expect(stack).to(haveResource('AWS::RDS::DBInstance', { + Properties: { + DBInstanceClass: 'db.t2.medium', + AllocatedStorage: '100', + AutoMinorVersionUpgrade: false, + BackupRetentionPeriod: '7', + CopyTagsToSnapshot: true, + DBName: 'ORCL', + DBSubnetGroupName: { + Ref: 'InstanceSubnetGroupF2CBA54F' + }, + DeletionProtection: true, + EnableCloudwatchLogsExports: [ + 'trace', + 'audit', + 'alert', + 'listener' + ], + EnablePerformanceInsights: true, + Engine: 'oracle-se1', + Iops: 1000, + LicenseModel: 'bring-your-own-license', + MasterUsername: { + 'Fn::Join': [ + '', + [ + '{{resolve:secretsmanager:', + { + Ref: 'InstanceSecret478E0A47' + }, + ':SecretString:username::}}' + ] + ] + }, + MasterUserPassword: { + 'Fn::Join': [ + '', + [ + '{{resolve:secretsmanager:', + { + Ref: 'InstanceSecret478E0A47' + }, + ':SecretString:password::}}' + ] + ] + }, + MonitoringInterval: 60, + MonitoringRoleArn: { + 'Fn::GetAtt': [ + 'InstanceMonitoringRole3E2B4286', + 'Arn' + ] + }, + MultiAZ: true, + PerformanceInsightsRetentionPeriod: 7, + StorageEncrypted: true, + StorageType: 'io1', + VPCSecurityGroups: [ + { + 'Fn::GetAtt': [ + 'InstanceSecurityGroupB4E5FA83', + 'GroupId' + ] + } + ] + }, + DeletionPolicy: 'Retain', + UpdateReplacePolicy: 'Retain' + }, ResourcePart.CompleteDefinition)); + + expect(stack).to(haveResource('AWS::RDS::DBInstance', { + DeletionPolicy: 'Retain', + UpdateReplacePolicy: 'Retain' + }, ResourcePart.CompleteDefinition)); + + expect(stack).to(haveResource('AWS::RDS::DBSubnetGroup', { + DBSubnetGroupDescription: 'Subnet group for Instance database', + SubnetIds: [ + { + Ref: 'VPCPrivateSubnet1Subnet8BCA10E0' + }, + { + Ref: 'VPCPrivateSubnet2SubnetCFCDAA7A' + }, + { + Ref: 'VPCPrivateSubnet3Subnet3EDCD457' + } + ] + })); + + expect(stack).to(haveResource('AWS::EC2::SecurityGroup', { + GroupDescription: 'Security group for Instance database', + })); + + expect(stack).to(haveResource('AWS::IAM::Role', { + AssumeRolePolicyDocument: { + Statement: [ + { + Action: 'sts:AssumeRole', + Effect: 'Allow', + Principal: { + Service: 'monitoring.rds.amazonaws.com' + } + } + ], + Version: '2012-10-17' + }, + ManagedPolicyArns: [ + { + 'Fn::Join': [ + '', + [ + 'arn:', + { + Ref: 'AWS::Partition' + }, + ':iam::aws:policy/service-role/AmazonRDSEnhancedMonitoringRole' + ] + ] + } + ] + })); + + expect(stack).to(haveResource('AWS::SecretsManager::Secret', { + GenerateSecretString: { + ExcludeCharacters: '\"@/\\', + GenerateStringKey: 'password', + PasswordLength: 30, + SecretStringTemplate: '{"username":"syscdk"}' + } + })); + + expect(stack).to(haveResource('AWS::SecretsManager::SecretTargetAttachment', { + SecretId: { + Ref: 'InstanceSecret478E0A47' + }, + TargetId: { + Ref: 'InstanceC1063A87' + }, + TargetType: 'AWS::RDS::DBInstance' + })); + + expect(stack).to(countResources('Custom::LogRetention', 4)); + + test.done(); + }, + + 'instance with option and parameter group'(test: Test) { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + const optionGroup = new rds.OptionGroup(stack, 'OptionGroup', { + engine: rds.DatabaseInstanceEngine.OracleSE1, + majorEngineVersion: '11.2', + configurations: [ + { + name: 'XMLDB' + } + ] + }); + + const parameterGroup = new rds.ParameterGroup(stack, 'ParameterGroup', { + family: 'hello', + description: 'desc', + parameters: { + key: 'value' + } + }); + + // WHEN + new rds.DatabaseInstance(stack, 'Database', { + engine: rds.DatabaseInstanceEngine.SqlServerEE, + instanceClass: new ec2.InstanceTypePair(ec2.InstanceClass.Burstable2, ec2.InstanceSize.Small), + masterUsername: 'syscdk', + masterUserPassword: cdk.SecretValue.plainText('tooshort'), + vpc, + optionGroup, + parameterGroup + }); + + expect(stack).to(haveResource('AWS::RDS::DBInstance', { + DBParameterGroupName: { + Ref: 'ParameterGroup5E32DECB' + }, + OptionGroupName: { + Ref: 'OptionGroupACA43DC1' + } + })); + + test.done(); + }, + + 'create an instance from snapshot'(test: Test) { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + // WHEN + new rds.DatabaseInstanceFromSnapshot(stack, 'Instance', { + snapshotIdentifier: 'my-snapshot', + engine: rds.DatabaseInstanceEngine.Postgres, + instanceClass: new ec2.InstanceTypePair(ec2.InstanceClass.Burstable2, ec2.InstanceSize.Large), + vpc + }); + + expect(stack).to(haveResource('AWS::RDS::DBInstance', { + DBSnapshotIdentifier: 'my-snapshot' + })); + + test.done(); + }, + + 'throws when trying to generate a new password from snapshot without username'(test: Test) { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + // THEN + test.throws(() => new rds.DatabaseInstanceFromSnapshot(stack, 'Instance', { + snapshotIdentifier: 'my-snapshot', + engine: rds.DatabaseInstanceEngine.Mysql, + instanceClass: new ec2.InstanceTypePair(ec2.InstanceClass.Burstable2, ec2.InstanceSize.Large), + vpc, + generateMasterUserPassword: true, + }), /`masterUsername`.*`generateMasterUserPassword`/); + + test.done(); + }, + + 'create a read replica'(test: Test) { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + const sourceInstance = new rds.DatabaseInstance(stack, 'Instance', { + engine: rds.DatabaseInstanceEngine.Mysql, + instanceClass: new ec2.InstanceTypePair(ec2.InstanceClass.Burstable2, ec2.InstanceSize.Small), + masterUsername: 'admin', + vpc + }); + + // WHEN + new rds.DatabaseInstanceReadReplica(stack, 'ReadReplica', { + sourceDatabaseInstance: sourceInstance, + engine: rds.DatabaseInstanceEngine.Mysql, + instanceClass: new ec2.InstanceTypePair(ec2.InstanceClass.Burstable2, ec2.InstanceSize.Large), + vpc + }); + + // THEN + expect(stack).to(haveResource('AWS::RDS::DBInstance', { + SourceDBInstanceIdentifier: { + Ref: 'InstanceC1063A87' + } + })); + + test.done(); + }, + + 'on event'(test: Test) { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + const instance = new rds.DatabaseInstance(stack, 'Instance', { + engine: rds.DatabaseInstanceEngine.Mysql, + instanceClass: new ec2.InstanceTypePair(ec2.InstanceClass.Burstable2, ec2.InstanceSize.Small), + masterUsername: 'admin', + vpc + }); + const fn = new lambda.Function(stack, 'Function', { + code: lambda.Code.inline('dummy'), + handler: 'index.handler', + runtime: lambda.Runtime.NodeJS810 + }); + + // WHEN + instance.onEvent('InstanceEvent', { target: new targets.LambdaFunction(fn) }); + + // THEN + expect(stack).to(haveResource('AWS::Events::Rule', { + EventPattern: { + source: [ + 'aws.rds' + ], + resources: [ + { + 'Fn::Join': [ + '', + [ + 'arn:', + { + Ref: 'AWS::Partition' + }, + ':rds:', + { + Ref: 'AWS::Region' + }, + ':', + { + Ref: 'AWS::AccountId' + }, + ':db:', + { + Ref: 'InstanceC1063A87' + } + ] + ] + } + ] + } + })); + + test.done(); + }, + + 'can use metricCPUUtilization'(test: Test) { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + // WHEN + const instance = new rds.DatabaseInstance(stack, 'Instance', { + engine: rds.DatabaseInstanceEngine.Mysql, + instanceClass: new ec2.InstanceTypePair(ec2.InstanceClass.Burstable2, ec2.InstanceSize.Small), + masterUsername: 'admin', + vpc + }); + + // THEN + test.deepEqual(stack.node.resolve(instance.metricCPUUtilization()), { + dimensions: { DBInstanceIdentifier: { Ref: 'InstanceC1063A87' } }, + namespace: 'AWS/RDS', + metricName: 'CPUUtilization', + periodSec: 300, + statistic: 'Average' + }); + + test.done(); + } +}; diff --git a/packages/@aws-cdk/aws-rds/test/test.option-group.ts b/packages/@aws-cdk/aws-rds/test/test.option-group.ts new file mode 100644 index 0000000000000..22c5f6999ccd2 --- /dev/null +++ b/packages/@aws-cdk/aws-rds/test/test.option-group.ts @@ -0,0 +1,115 @@ +import { expect, haveResource } from '@aws-cdk/assert'; +import ec2 = require('@aws-cdk/aws-ec2'); +import cdk = require('@aws-cdk/cdk'); +import { Test } from 'nodeunit'; +import { DatabaseInstanceEngine, OptionGroup } from '../lib'; + +export = { + 'create an option group'(test: Test) { + // GIVEN + const stack = new cdk.Stack(); + + // WHEN + new OptionGroup(stack, 'Options', { + engine: DatabaseInstanceEngine.OracleSE1, + majorEngineVersion: '11.2', + configurations: [ + { + name: 'XMLDB' + } + ] + }); + + // THEN + expect(stack).to(haveResource('AWS::RDS::OptionGroup', { + EngineName: 'oracle-se1', + MajorEngineVersion: '11.2', + OptionGroupDescription: 'Option group for oracle-se1 11.2', + OptionConfigurations: [ + { + OptionName: 'XMLDB' + } + ] + })); + + test.done(); + }, + + 'option group with security groups'(test: Test) { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + // WHEN + const optionGroup = new OptionGroup(stack, 'Options', { + engine: DatabaseInstanceEngine.OracleSE1, + majorEngineVersion: '11.2', + configurations: [ + { + name: 'OEM', + port: 1158, + vpc + } + ] + }); + optionGroup.optionConnections.OEM.connections.allowDefaultPortFromAnyIpv4(); + + // THEN + expect(stack).to(haveResource('AWS::RDS::OptionGroup', { + EngineName: 'oracle-se1', + MajorEngineVersion: '11.2', + OptionGroupDescription: 'Option group for oracle-se1 11.2', + OptionConfigurations: [ + { + OptionName: 'OEM', + Port: 1158, + VpcSecurityGroupMemberships: [ + { + 'Fn::GetAtt': [ + 'OptionsSecurityGroupOEM6C9FE79D', + 'GroupId' + ] + } + ] + } + ] + })); + + expect(stack).to(haveResource('AWS::EC2::SecurityGroup', { + GroupDescription: 'Security group for OEM option', + SecurityGroupIngress: [ + { + CidrIp: '0.0.0.0/0', + Description: 'from 0.0.0.0/0:1158', + FromPort: 1158, + IpProtocol: "tcp", + ToPort: 1158 + } + ], + VpcId: { + Ref: 'VPCB9E5F0B4' + } + })); + + test.done(); + }, + + 'throws when using an option with port and no vpc'(test: Test) { + // GIVEN + const stack = new cdk.Stack(); + + // THEN + test.throws(() => new OptionGroup(stack, 'Options', { + engine: DatabaseInstanceEngine.OracleSE1, + majorEngineVersion: '11.2', + configurations: [ + { + name: 'OEM', + port: 1158 + } + ] + }), /`port`.*`vpc`/); + + test.done(); + } +}; diff --git a/packages/@aws-cdk/aws-rds/test/test.parameter-group.ts b/packages/@aws-cdk/aws-rds/test/test.parameter-group.ts new file mode 100644 index 0000000000000..f48d1ea4f3891 --- /dev/null +++ b/packages/@aws-cdk/aws-rds/test/test.parameter-group.ts @@ -0,0 +1,56 @@ +import { expect, haveResource } from '@aws-cdk/assert'; +import cdk = require('@aws-cdk/cdk'); +import { Test } from 'nodeunit'; +import { ClusterParameterGroup, ParameterGroup } from '../lib'; + +export = { + 'create a parameter group'(test: Test) { + // GIVEN + const stack = new cdk.Stack(); + + // WHEN + new ParameterGroup(stack, 'Params', { + family: 'hello', + description: 'desc', + parameters: { + key: 'value' + } + }); + + // THEN + expect(stack).to(haveResource('AWS::RDS::DBParameterGroup', { + Description: 'desc', + Family: 'hello', + Parameters: { + key: 'value' + } + })); + + test.done(); + }, + + 'create a cluster parameter group'(test: Test) { + // GIVEN + const stack = new cdk.Stack(); + + // WHEN + new ClusterParameterGroup(stack, 'Params', { + family: 'hello', + description: 'desc', + parameters: { + key: 'value' + } + }); + + // THEN + expect(stack).to(haveResource('AWS::RDS::DBClusterParameterGroup', { + Description: 'desc', + Family: 'hello', + Parameters: { + key: 'value' + } + })); + + test.done(); + } +}; diff --git a/packages/@aws-cdk/aws-rds/test/test.rotation-single-user.ts b/packages/@aws-cdk/aws-rds/test/test.secret-rotation.ts similarity index 55% rename from packages/@aws-cdk/aws-rds/test/test.rotation-single-user.ts rename to packages/@aws-cdk/aws-rds/test/test.secret-rotation.ts index 45c95cb7e9e69..edaf88c0af0b1 100644 --- a/packages/@aws-cdk/aws-rds/test/test.rotation-single-user.ts +++ b/packages/@aws-cdk/aws-rds/test/test.secret-rotation.ts @@ -5,6 +5,7 @@ import cdk = require('@aws-cdk/cdk'); import { SecretValue } from '@aws-cdk/cdk'; import { Test } from 'nodeunit'; import rds = require('../lib'); +import { SecretRotationApplication } from '../lib'; // tslint:disable:object-literal-key-quotes @@ -93,7 +94,7 @@ export = { expect(stack).to(haveResource('AWS::Serverless::Application', { "Location": { "ApplicationId": "arn:aws:serverlessrepo:us-east-1:297356227824:applications/SecretsManagerRDSMySQLRotationSingleUser", - "SemanticVersion": "1.0.74" + "SemanticVersion": "1.0.85" }, "Parameters": { "endpoint": { @@ -182,51 +183,193 @@ export = { test.done(); }, - 'throws when both application location and engine are not specified'(test: Test) { + 'throws when connections object has no default port range'(test: Test) { // GIVEN const stack = new cdk.Stack(); const vpc = new ec2.Vpc(stack, 'VPC'); + const secret = new secretsmanager.Secret(stack, 'Secret'); const securityGroup = new ec2.SecurityGroup(stack, 'SecurityGroup', { vpc, }); + + // WHEN const target = new ec2.Connections({ - defaultPortRange: new ec2.TcpPort(1521), securityGroups: [securityGroup] }); - const secret = new secretsmanager.Secret(stack, 'Secret'); // THEN - test.throws(() => new rds.RotationSingleUser(stack, 'Rotation', { + test.throws(() => new rds.SecretRotation(stack, 'Rotation', { secret, + application: SecretRotationApplication.MysqlRotationSingleUser, vpc, target - }), /`serverlessApplicationLocation`.+`engine`/); + }), /`target`.+default port range/); test.done(); }, - 'throws when connections object has no default port range'(test: Test) { + 'add a rds rotation single user to an instance'(test: Test) { // GIVEN const stack = new cdk.Stack(); const vpc = new ec2.Vpc(stack, 'VPC'); - const secret = new secretsmanager.Secret(stack, 'Secret'); - const securityGroup = new ec2.SecurityGroup(stack, 'SecurityGroup', { - vpc, + const instance = new rds.DatabaseInstance(stack, 'Database', { + engine: rds.DatabaseInstanceEngine.MariaDb, + instanceClass: new ec2.InstanceTypePair(ec2.InstanceClass.Burstable2, ec2.InstanceSize.Small), + masterUsername: 'syscdk', + vpc }); // WHEN - const target = new ec2.Connections({ - securityGroups: [securityGroup] + instance.addRotationSingleUser('Rotation'); + + // THEN + expect(stack).to(haveResource('AWS::EC2::SecurityGroupIngress', { + "IpProtocol": "tcp", + "Description": "from DatabaseRotationSecurityGroup1C5A8031:{IndirectPort}", + "FromPort": { + "Fn::GetAtt": [ + "DatabaseB269D8BB", + "Endpoint.Port" + ] + }, + "GroupId": { + "Fn::GetAtt": [ + "DatabaseSecurityGroup5C91FDCB", + "GroupId" + ] + }, + "SourceSecurityGroupId": { + "Fn::GetAtt": [ + "DatabaseRotationSecurityGroup17736B63", + "GroupId" + ] + }, + "ToPort": { + "Fn::GetAtt": [ + "DatabaseB269D8BB", + "Endpoint.Port" + ] + } + })); + + expect(stack).to(haveResource('AWS::SecretsManager::RotationSchedule', { + "SecretId": { + "Ref": "DatabaseSecretAttachedSecretE6CAC445" + }, + "RotationLambdaARN": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":lambda:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":function:DatabaseRotation0D47EBD2" + ] + ] + }, + "RotationRules": { + "AutomaticallyAfterDays": 30 + } + })); + + expect(stack).to(haveResource('AWS::EC2::SecurityGroup', { + "GroupDescription": "Database/Rotation/SecurityGroup" + })); + + expect(stack).to(haveResource('AWS::Serverless::Application', { + "Location": { + "ApplicationId": "arn:aws:serverlessrepo:us-east-1:297356227824:applications/SecretsManagerRDSMariaDBRotationSingleUser", + "SemanticVersion": "1.0.57" + }, + "Parameters": { + "endpoint": { + "Fn::Join": [ + "", + [ + "https://secretsmanager.", + { + "Ref": "AWS::Region" + }, + ".", + { + "Ref": "AWS::URLSuffix" + } + ] + ] + }, + "functionName": "DatabaseRotation0D47EBD2", + "vpcSecurityGroupIds": { + "Fn::GetAtt": [ + "DatabaseRotationSecurityGroup17736B63", + "GroupId" + ] + }, + "vpcSubnetIds": { + "Fn::Join": [ + "", + [ + { + "Ref": "VPCPrivateSubnet1Subnet8BCA10E0" + }, + ",", + { + "Ref": "VPCPrivateSubnet2SubnetCFCDAA7A" + }, + ",", + { + "Ref": "VPCPrivateSubnet3Subnet3EDCD457" + } + ] + ] + } + } + })); + + expect(stack).to(haveResource('AWS::Lambda::Permission', { + "Action": "lambda:InvokeFunction", + "FunctionName": "DatabaseRotation0D47EBD2", + "Principal": { + "Fn::Join": [ + "", + [ + "secretsmanager.", + { + "Ref": "AWS::URLSuffix" + } + ] + ] + } + })); + + test.done(); + }, + + 'throws when trying to add rotation to an instance without secret'(test: Test) { + // GIVEN + const stack = new cdk.Stack(); + const vpc = new ec2.Vpc(stack, 'VPC'); + + // WHEN + const instance = new rds.DatabaseInstance(stack, 'Database', { + engine: rds.DatabaseInstanceEngine.SqlServerEE, + instanceClass: new ec2.InstanceTypePair(ec2.InstanceClass.Burstable2, ec2.InstanceSize.Small), + masterUsername: 'syscdk', + masterUserPassword: SecretValue.plainText('tooshort'), + vpc }); // THEN - test.throws(() => new rds.RotationSingleUser(stack, 'Rotation', { - secret, - engine: rds.DatabaseEngine.Mysql, - vpc, - target - }), /`target`.+default port range/); + test.throws(() => instance.addRotationSingleUser('Rotation'), /without secret/); test.done(); - } + }, }; diff --git a/packages/@aws-cdk/aws-redshift/package.json b/packages/@aws-cdk/aws-redshift/package.json index 18dee5373556b..97f3237254840 100644 --- a/packages/@aws-cdk/aws-redshift/package.json +++ b/packages/@aws-cdk/aws-redshift/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-redshift", - "version": "0.32.0", + "version": "0.33.0", "description": "The CDK Construct Library for AWS::Redshift", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -60,19 +60,19 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "cdk-build-tools": "^0.32.0", - "cfn2ts": "^0.32.0", - "pkglint": "^0.32.0" + "@aws-cdk/assert": "^0.33.0", + "cdk-build-tools": "^0.33.0", + "cfn2ts": "^0.33.0", + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "homepage": "https://github.com/awslabs/aws-cdk", "peerDependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "engines": { "node": ">= 8.10.0" } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-robomaker/package.json b/packages/@aws-cdk/aws-robomaker/package.json index c91ba7a1443b9..9cd98c5f8e363 100644 --- a/packages/@aws-cdk/aws-robomaker/package.json +++ b/packages/@aws-cdk/aws-robomaker/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-robomaker", - "version": "0.32.0", + "version": "0.33.0", "description": "The CDK Construct Library for AWS::RoboMaker", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -62,18 +62,18 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "cdk-build-tools": "^0.32.0", - "cfn2ts": "^0.32.0", - "pkglint": "^0.32.0" + "@aws-cdk/assert": "^0.33.0", + "cdk-build-tools": "^0.33.0", + "cfn2ts": "^0.33.0", + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "peerDependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "engines": { "node": ">= 8.10.0" } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-route53-targets/package-lock.json b/packages/@aws-cdk/aws-route53-targets/package-lock.json index 26addd8e9759a..9edecd66f219b 100644 --- a/packages/@aws-cdk/aws-route53-targets/package-lock.json +++ b/packages/@aws-cdk/aws-route53-targets/package-lock.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-route53-targets", - "version": "0.32.0", + "version": "0.33.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/@aws-cdk/aws-route53-targets/package.json b/packages/@aws-cdk/aws-route53-targets/package.json index c4b3a8ed34c3f..630aa156a8097 100644 --- a/packages/@aws-cdk/aws-route53-targets/package.json +++ b/packages/@aws-cdk/aws-route53-targets/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-route53-targets", - "version": "0.32.0", + "version": "0.33.0", "description": "CDK Constructs for AWS Route53 Alias Targets", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -68,31 +68,31 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "@aws-cdk/aws-ec2": "^0.32.0", - "@aws-cdk/aws-s3": "^0.32.0", - "cdk-build-tools": "^0.32.0", - "cdk-integ-tools": "^0.32.0", - "cfn2ts": "^0.32.0", + "@aws-cdk/assert": "^0.33.0", + "@aws-cdk/aws-ec2": "^0.33.0", + "@aws-cdk/aws-s3": "^0.33.0", + "cdk-build-tools": "^0.33.0", + "cdk-integ-tools": "^0.33.0", + "cfn2ts": "^0.33.0", "jest": "^24.7.1", - "pkglint": "^0.32.0" + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/aws-cloudfront": "^0.32.0", - "@aws-cdk/aws-elasticloadbalancingv2": "^0.32.0", - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/aws-route53": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/aws-cloudfront": "^0.33.0", + "@aws-cdk/aws-elasticloadbalancingv2": "^0.33.0", + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/aws-route53": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0" }, "homepage": "https://github.com/awslabs/aws-cdk", "peerDependencies": { - "@aws-cdk/aws-cloudfront": "^0.32.0", - "@aws-cdk/aws-elasticloadbalancingv2": "^0.32.0", - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/aws-route53": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/aws-cloudfront": "^0.33.0", + "@aws-cdk/aws-elasticloadbalancingv2": "^0.33.0", + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/aws-route53": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0" }, "engines": { "node": ">= 8.10.0" } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-route53/lib/records/_util.ts b/packages/@aws-cdk/aws-route53/lib/records/_util.ts index b51a2f89620a8..ba503721f258c 100644 --- a/packages/@aws-cdk/aws-route53/lib/records/_util.ts +++ b/packages/@aws-cdk/aws-route53/lib/records/_util.ts @@ -11,7 +11,7 @@ import { IHostedZone } from '../hosted-zone-ref'; * * @returns
    *
  • If +providedName+ ends with a +.+, use it as-is
  • - *
  • If +providedName+ ends with +zoneName+, append a trailing +.+
  • + *
  • If +providedName+ ends with or equals +zoneName+, append a trailing +.+
  • *
  • Otherwise, append +.+, +zoneName+ and a trailing +.+
  • *
*/ @@ -21,7 +21,7 @@ export function determineFullyQualifiedDomainName(providedName: string, hostedZo } const suffix = `.${hostedZone.zoneName}`; - if (providedName.endsWith(suffix)) { + if (providedName.endsWith(suffix) || providedName === hostedZone.zoneName) { return `${providedName}.`; } diff --git a/packages/@aws-cdk/aws-route53/package-lock.json b/packages/@aws-cdk/aws-route53/package-lock.json index 62e2811c449ff..fd376bf6534c6 100644 --- a/packages/@aws-cdk/aws-route53/package-lock.json +++ b/packages/@aws-cdk/aws-route53/package-lock.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-route53", - "version": "0.32.0", + "version": "0.33.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/@aws-cdk/aws-route53/package.json b/packages/@aws-cdk/aws-route53/package.json index 9f1f30ceb29cf..ba5526e6e56c3 100644 --- a/packages/@aws-cdk/aws-route53/package.json +++ b/packages/@aws-cdk/aws-route53/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-route53", - "version": "0.32.0", + "version": "0.33.0", "description": "CDK Constructs for AWS Route53", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -60,25 +60,25 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", + "@aws-cdk/assert": "^0.33.0", "aws-sdk": "^2.438.0", - "cdk-build-tools": "^0.32.0", - "cdk-integ-tools": "^0.32.0", - "cfn2ts": "^0.32.0", - "pkglint": "^0.32.0" + "cdk-build-tools": "^0.33.0", + "cdk-integ-tools": "^0.33.0", + "cfn2ts": "^0.33.0", + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/aws-ec2": "^0.32.0", - "@aws-cdk/aws-logs": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0", - "@aws-cdk/cx-api": "^0.32.0" + "@aws-cdk/aws-ec2": "^0.33.0", + "@aws-cdk/aws-logs": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0", + "@aws-cdk/cx-api": "^0.33.0" }, "homepage": "https://github.com/awslabs/aws-cdk", "peerDependencies": { - "@aws-cdk/aws-ec2": "^0.32.0", - "@aws-cdk/aws-logs": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0", - "@aws-cdk/cx-api": "^0.32.0" + "@aws-cdk/aws-ec2": "^0.33.0", + "@aws-cdk/aws-logs": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0", + "@aws-cdk/cx-api": "^0.33.0" }, "engines": { "node": ">= 8.10.0" @@ -89,4 +89,4 @@ "from-attributes:fromPublicHostedZoneAttributes" ] } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-route53/test/test.alias-record.ts b/packages/@aws-cdk/aws-route53/test/test.alias-record.ts index a44005631df18..412f0f271d17d 100644 --- a/packages/@aws-cdk/aws-route53/test/test.alias-record.ts +++ b/packages/@aws-cdk/aws-route53/test/test.alias-record.ts @@ -38,6 +38,42 @@ export = { } })); + test.done(); + }, + 'test alias record on zone root'(test: Test) { + // GIVEN + const stack = new Stack(); + const zone = new PublicHostedZone(stack, 'HostedZone', { zoneName: 'test.public' }); + + const target: IAliasRecordTarget = { + bind: () => { + return { + hostedZoneId: 'Z2P70J7EXAMPLE', + dnsName: 'foo.example.com' + }; + } + }; + + // WHEN + new AliasRecord(zone, 'Alias', { + zone, + recordName: 'test.public', + target + }); + + // THEN - stack contains a record set + expect(stack).to(haveResource('AWS::Route53::RecordSet', { + Name: 'test.public.', + HostedZoneId: { + Ref: 'HostedZoneDB99F866' + }, + Type: 'A', + AliasTarget: { + HostedZoneId: 'Z2P70J7EXAMPLE', + DNSName: 'foo.example.com', + } + })); + test.done(); } }; diff --git a/packages/@aws-cdk/aws-route53resolver/package.json b/packages/@aws-cdk/aws-route53resolver/package.json index 38e522c98c419..b95848e2f7d0a 100644 --- a/packages/@aws-cdk/aws-route53resolver/package.json +++ b/packages/@aws-cdk/aws-route53resolver/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-route53resolver", - "version": "0.32.0", + "version": "0.33.0", "description": "The CDK Construct Library for AWS::Route53Resolver", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -61,18 +61,18 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "cdk-build-tools": "^0.32.0", - "cfn2ts": "^0.32.0", - "pkglint": "^0.32.0" + "@aws-cdk/assert": "^0.33.0", + "cdk-build-tools": "^0.33.0", + "cfn2ts": "^0.33.0", + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "peerDependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "engines": { "node": ">= 8.10.0" } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-s3-deployment/package.json b/packages/@aws-cdk/aws-s3-deployment/package.json index 54f531f2b51ea..e3291cb1ac05d 100644 --- a/packages/@aws-cdk/aws-s3-deployment/package.json +++ b/packages/@aws-cdk/aws-s3-deployment/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-s3-deployment", - "version": "0.32.0", + "version": "0.33.0", "description": "Constructs for deploying contents to S3 buckets", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -74,29 +74,29 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "cdk-build-tools": "^0.32.0", - "cdk-integ-tools": "^0.32.0", - "pkglint": "^0.32.0" + "@aws-cdk/assert": "^0.33.0", + "cdk-build-tools": "^0.33.0", + "cdk-integ-tools": "^0.33.0", + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/assets": "^0.32.0", - "@aws-cdk/aws-cloudformation": "^0.32.0", - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/aws-lambda": "^0.32.0", - "@aws-cdk/aws-s3": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/assets": "^0.33.0", + "@aws-cdk/aws-cloudformation": "^0.33.0", + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/aws-lambda": "^0.33.0", + "@aws-cdk/aws-s3": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0" }, "homepage": "https://github.com/awslabs/aws-cdk", "peerDependencies": { - "@aws-cdk/assets": "^0.32.0", - "@aws-cdk/aws-cloudformation": "^0.32.0", - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/aws-lambda": "^0.32.0", - "@aws-cdk/aws-s3": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/assets": "^0.33.0", + "@aws-cdk/aws-cloudformation": "^0.33.0", + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/aws-lambda": "^0.33.0", + "@aws-cdk/aws-s3": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0" }, "engines": { "node": ">= 8.10.0" } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-s3-notifications/package-lock.json b/packages/@aws-cdk/aws-s3-notifications/package-lock.json index aa0ecfd09fd06..25ab8df3f01b2 100644 --- a/packages/@aws-cdk/aws-s3-notifications/package-lock.json +++ b/packages/@aws-cdk/aws-s3-notifications/package-lock.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-s3-notifications", - "version": "0.32.0", + "version": "0.33.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/@aws-cdk/aws-s3-notifications/package.json b/packages/@aws-cdk/aws-s3-notifications/package.json index ba679ddb10da5..2538e271b7d6f 100644 --- a/packages/@aws-cdk/aws-s3-notifications/package.json +++ b/packages/@aws-cdk/aws-s3-notifications/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-s3-notifications", - "version": "0.32.0", + "version": "0.33.0", "description": "Bucket Notifications API for AWS S3", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -67,30 +67,30 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "cdk-build-tools": "^0.32.0", - "pkglint": "^0.32.0", - "cdk-integ-tools": "^0.32.0", - "jest": "^24.7.1" + "@aws-cdk/assert": "^0.33.0", + "cdk-build-tools": "^0.33.0", + "cdk-integ-tools": "^0.33.0", + "jest": "^24.7.1", + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/aws-lambda": "^0.32.0", - "@aws-cdk/aws-s3": "^0.32.0", - "@aws-cdk/aws-sns": "^0.32.0", - "@aws-cdk/aws-sqs": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/aws-lambda": "^0.33.0", + "@aws-cdk/aws-s3": "^0.33.0", + "@aws-cdk/aws-sns": "^0.33.0", + "@aws-cdk/aws-sqs": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0" }, "homepage": "https://github.com/awslabs/aws-cdk", "peerDependencies": { - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/aws-lambda": "^0.32.0", - "@aws-cdk/aws-s3": "^0.32.0", - "@aws-cdk/aws-sns": "^0.32.0", - "@aws-cdk/aws-sqs": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/aws-lambda": "^0.33.0", + "@aws-cdk/aws-s3": "^0.33.0", + "@aws-cdk/aws-sns": "^0.33.0", + "@aws-cdk/aws-sqs": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0" }, "engines": { "node": ">= 8.10.0" } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-s3/lib/bucket.ts b/packages/@aws-cdk/aws-s3/lib/bucket.ts index 0302b90523716..496bfa1ddadb3 100644 --- a/packages/@aws-cdk/aws-s3/lib/bucket.ts +++ b/packages/@aws-cdk/aws-s3/lib/bucket.ts @@ -604,7 +604,7 @@ export interface BucketProps { * If you choose KMS, you can specify a KMS key via `encryptionKey`. If * encryption key is not specified, a key will automatically be created. * - * @default BucketEncryption.Unencrypted + * @default - `Kms` if `encryptionKey` is specified, or `Unencrypted` otherwise. */ readonly encryption?: BucketEncryption; @@ -934,8 +934,11 @@ export class Bucket extends BucketBase { encryptionKey?: kms.IKey } { - // default to unencrypted. - const encryptionType = props.encryption || BucketEncryption.Unencrypted; + // default based on whether encryptionKey is specified + let encryptionType = props.encryption; + if (encryptionType === undefined) { + encryptionType = props.encryptionKey ? BucketEncryption.Kms : BucketEncryption.Unencrypted; + } // if encryption key is set, encryption must be set to KMS. if (encryptionType !== BucketEncryption.Kms && props.encryptionKey) { diff --git a/packages/@aws-cdk/aws-s3/package.json b/packages/@aws-cdk/aws-s3/package.json index 7a7d17fee34e0..cfe21bcf00999 100644 --- a/packages/@aws-cdk/aws-s3/package.json +++ b/packages/@aws-cdk/aws-s3/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-s3", - "version": "0.32.0", + "version": "0.33.0", "description": "CDK Constructs for AWS S3", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -60,26 +60,26 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "cdk-build-tools": "^0.32.0", - "cdk-integ-tools": "^0.32.0", - "cfn2ts": "^0.32.0", - "pkglint": "^0.32.0" + "@aws-cdk/assert": "^0.33.0", + "cdk-build-tools": "^0.33.0", + "cdk-integ-tools": "^0.33.0", + "cfn2ts": "^0.33.0", + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/aws-events": "^0.32.0", - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/aws-kms": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/aws-events": "^0.33.0", + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/aws-kms": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0" }, "homepage": "https://github.com/awslabs/aws-cdk", "peerDependencies": { - "@aws-cdk/aws-events": "^0.32.0", - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/aws-kms": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/aws-events": "^0.33.0", + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/aws-kms": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0" }, "engines": { "node": ">= 8.10.0" } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-s3/test/test.bucket.ts b/packages/@aws-cdk/aws-s3/test/test.bucket.ts index 32ed9ba691330..8bdae25647490 100644 --- a/packages/@aws-cdk/aws-s3/test/test.bucket.ts +++ b/packages/@aws-cdk/aws-s3/test/test.bucket.ts @@ -1370,4 +1370,14 @@ export = { }); test.done(); }, + + 'if a kms key is specified, it implies bucket is encrypted with kms (dah)'(test: Test) { + // GIVEN + const stack = new Stack(); + const key = new kms.Key(stack, 'k'); + + // THEN + new Bucket(stack, 'b', { encryptionKey: key }); + test.done(); + } }; diff --git a/packages/@aws-cdk/aws-sagemaker/package.json b/packages/@aws-cdk/aws-sagemaker/package.json index 73c0156b3c20e..a03c3ebd04480 100644 --- a/packages/@aws-cdk/aws-sagemaker/package.json +++ b/packages/@aws-cdk/aws-sagemaker/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-sagemaker", - "version": "0.32.0", + "version": "0.33.0", "description": "The CDK Construct Library for AWS::SageMaker", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -61,18 +61,18 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "cdk-build-tools": "^0.32.0", - "cfn2ts": "^0.32.0", - "pkglint": "^0.32.0" + "@aws-cdk/assert": "^0.33.0", + "cdk-build-tools": "^0.33.0", + "cfn2ts": "^0.33.0", + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "peerDependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "engines": { "node": ">= 8.10.0" } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-sam/package.json b/packages/@aws-cdk/aws-sam/package.json index d2109f04674e8..aefdfdb433f92 100644 --- a/packages/@aws-cdk/aws-sam/package.json +++ b/packages/@aws-cdk/aws-sam/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-sam", - "version": "0.32.0", + "version": "0.33.0", "description": "The CDK Construct Library for the AWS Serverless Application Model (SAM) resources", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -61,18 +61,18 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "cdk-build-tools": "^0.32.0", - "cfn2ts": "^0.32.0", - "pkglint": "^0.32.0" + "@aws-cdk/assert": "^0.33.0", + "cdk-build-tools": "^0.33.0", + "cfn2ts": "^0.33.0", + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "peerDependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "engines": { "node": ">= 8.10.0" } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-sdb/package.json b/packages/@aws-cdk/aws-sdb/package.json index b70ac4f2c92a1..a1c9d37559c87 100644 --- a/packages/@aws-cdk/aws-sdb/package.json +++ b/packages/@aws-cdk/aws-sdb/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-sdb", - "version": "0.32.0", + "version": "0.33.0", "description": "The CDK Construct Library for AWS::SDB", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -60,19 +60,19 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "cdk-build-tools": "^0.32.0", - "cfn2ts": "^0.32.0", - "pkglint": "^0.32.0" + "@aws-cdk/assert": "^0.33.0", + "cdk-build-tools": "^0.33.0", + "cfn2ts": "^0.33.0", + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "homepage": "https://github.com/awslabs/aws-cdk", "peerDependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "engines": { "node": ">= 8.10.0" } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-secretsmanager/package.json b/packages/@aws-cdk/aws-secretsmanager/package.json index 502847e4378e6..3dabf9e72d898 100644 --- a/packages/@aws-cdk/aws-secretsmanager/package.json +++ b/packages/@aws-cdk/aws-secretsmanager/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-secretsmanager", - "version": "0.32.0", + "version": "0.33.0", "description": "The CDK Construct Library for AWS::SecretsManager", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -61,25 +61,25 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "cdk-build-tools": "^0.32.0", - "cdk-integ-tools": "^0.32.0", - "cfn2ts": "^0.32.0", - "pkglint": "^0.32.0" + "@aws-cdk/assert": "^0.33.0", + "cdk-build-tools": "^0.33.0", + "cdk-integ-tools": "^0.33.0", + "cfn2ts": "^0.33.0", + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/aws-ec2": "^0.32.0", - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/aws-kms": "^0.32.0", - "@aws-cdk/aws-lambda": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/aws-ec2": "^0.33.0", + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/aws-kms": "^0.33.0", + "@aws-cdk/aws-lambda": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0" }, "peerDependencies": { - "@aws-cdk/aws-ec2": "^0.32.0", - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/aws-kms": "^0.32.0", - "@aws-cdk/aws-lambda": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/aws-ec2": "^0.33.0", + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/aws-kms": "^0.33.0", + "@aws-cdk/aws-lambda": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0" }, "engines": { "node": ">= 8.10.0" @@ -90,4 +90,4 @@ "from-attributes:fromSecretTargetAttachmentAttributes" ] } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-servicecatalog/package.json b/packages/@aws-cdk/aws-servicecatalog/package.json index 17098e5a42774..fd110a2e0f05a 100644 --- a/packages/@aws-cdk/aws-servicecatalog/package.json +++ b/packages/@aws-cdk/aws-servicecatalog/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-servicecatalog", - "version": "0.32.0", + "version": "0.33.0", "description": "The CDK Construct Library for AWS::ServiceCatalog", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -60,19 +60,19 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "cdk-build-tools": "^0.32.0", - "cfn2ts": "^0.32.0", - "pkglint": "^0.32.0" + "@aws-cdk/assert": "^0.33.0", + "cdk-build-tools": "^0.33.0", + "cfn2ts": "^0.33.0", + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "homepage": "https://github.com/awslabs/aws-cdk", "peerDependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "engines": { "node": ">= 8.10.0" } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-servicediscovery/package.json b/packages/@aws-cdk/aws-servicediscovery/package.json index e98ad286fcbf5..8e4f59a20461b 100644 --- a/packages/@aws-cdk/aws-servicediscovery/package.json +++ b/packages/@aws-cdk/aws-servicediscovery/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-servicediscovery", - "version": "0.32.0", + "version": "0.33.0", "description": "The CDK Construct Library for AWS::ServiceDiscovery", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -60,26 +60,26 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "cdk-build-tools": "^0.32.0", - "cdk-integ-tools": "^0.32.0", - "cfn2ts": "^0.32.0", - "pkglint": "^0.32.0" + "@aws-cdk/assert": "^0.33.0", + "cdk-build-tools": "^0.33.0", + "cdk-integ-tools": "^0.33.0", + "cfn2ts": "^0.33.0", + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/aws-ec2": "^0.32.0", - "@aws-cdk/aws-elasticloadbalancingv2": "^0.32.0", - "@aws-cdk/aws-route53": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/aws-ec2": "^0.33.0", + "@aws-cdk/aws-elasticloadbalancingv2": "^0.33.0", + "@aws-cdk/aws-route53": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0" }, "homepage": "https://github.com/awslabs/aws-cdk", "peerDependencies": { - "@aws-cdk/aws-ec2": "^0.32.0", - "@aws-cdk/aws-elasticloadbalancingv2": "^0.32.0", - "@aws-cdk/aws-route53": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/aws-ec2": "^0.33.0", + "@aws-cdk/aws-elasticloadbalancingv2": "^0.33.0", + "@aws-cdk/aws-route53": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0" }, "engines": { "node": ">= 8.10.0" } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ses/package.json b/packages/@aws-cdk/aws-ses/package.json index 61af38f44a6d3..c8040318eca04 100644 --- a/packages/@aws-cdk/aws-ses/package.json +++ b/packages/@aws-cdk/aws-ses/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-ses", - "version": "0.32.0", + "version": "0.33.0", "description": "The CDK Construct Library for AWS::SES", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -60,30 +60,30 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "cdk-build-tools": "^0.32.0", - "cdk-integ-tools": "^0.32.0", - "cfn2ts": "^0.32.0", - "pkglint": "^0.32.0" + "@aws-cdk/assert": "^0.33.0", + "cdk-build-tools": "^0.33.0", + "cdk-integ-tools": "^0.33.0", + "cfn2ts": "^0.33.0", + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/aws-kms": "^0.32.0", - "@aws-cdk/aws-lambda": "^0.32.0", - "@aws-cdk/aws-s3": "^0.32.0", - "@aws-cdk/aws-sns": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/aws-kms": "^0.33.0", + "@aws-cdk/aws-lambda": "^0.33.0", + "@aws-cdk/aws-s3": "^0.33.0", + "@aws-cdk/aws-sns": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0" }, "homepage": "https://github.com/awslabs/aws-cdk", "peerDependencies": { - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/aws-kms": "^0.32.0", - "@aws-cdk/aws-lambda": "^0.32.0", - "@aws-cdk/aws-s3": "^0.32.0", - "@aws-cdk/aws-sns": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/aws-kms": "^0.33.0", + "@aws-cdk/aws-lambda": "^0.33.0", + "@aws-cdk/aws-s3": "^0.33.0", + "@aws-cdk/aws-sns": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0" }, "engines": { "node": ">= 8.10.0" } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-sns/lib/subscription.ts b/packages/@aws-cdk/aws-sns/lib/subscription.ts index 93efac028d294..184227aac4b90 100644 --- a/packages/@aws-cdk/aws-sns/lib/subscription.ts +++ b/packages/@aws-cdk/aws-sns/lib/subscription.ts @@ -16,7 +16,7 @@ export interface SubscriptionProps { * * The meaning of this value depends on the value for 'protocol'. */ - readonly endpoint: any; + readonly endpoint: string; /** * The topic to subscribe to. diff --git a/packages/@aws-cdk/aws-sns/package.json b/packages/@aws-cdk/aws-sns/package.json index b02e24cef43a9..16400f40b3ef9 100644 --- a/packages/@aws-cdk/aws-sns/package.json +++ b/packages/@aws-cdk/aws-sns/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-sns", - "version": "0.32.0", + "version": "0.33.0", "description": "CDK Constructs for AWS SNS", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -63,29 +63,29 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "@aws-cdk/aws-s3": "^0.32.0", - "cdk-build-tools": "^0.32.0", - "cdk-integ-tools": "^0.32.0", - "cfn2ts": "^0.32.0", - "pkglint": "^0.32.0" + "@aws-cdk/assert": "^0.33.0", + "@aws-cdk/aws-s3": "^0.33.0", + "cdk-build-tools": "^0.33.0", + "cdk-integ-tools": "^0.33.0", + "cfn2ts": "^0.33.0", + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/aws-cloudwatch": "^0.32.0", - "@aws-cdk/aws-events": "^0.32.0", - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/aws-lambda": "^0.32.0", - "@aws-cdk/aws-sqs": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/aws-cloudwatch": "^0.33.0", + "@aws-cdk/aws-events": "^0.33.0", + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/aws-lambda": "^0.33.0", + "@aws-cdk/aws-sqs": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0" }, "homepage": "https://github.com/awslabs/aws-cdk", "peerDependencies": { - "@aws-cdk/aws-cloudwatch": "^0.32.0", - "@aws-cdk/aws-events": "^0.32.0", - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/aws-lambda": "^0.32.0", - "@aws-cdk/aws-sqs": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/aws-cloudwatch": "^0.33.0", + "@aws-cdk/aws-events": "^0.33.0", + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/aws-lambda": "^0.33.0", + "@aws-cdk/aws-sqs": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0" }, "engines": { "node": ">= 8.10.0" @@ -95,4 +95,4 @@ "construct-base-is-private:@aws-cdk/aws-sns.TopicBase" ] } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-sqs/package-lock.json b/packages/@aws-cdk/aws-sqs/package-lock.json index d49b7ccef9eb1..90eb753fa806c 100644 --- a/packages/@aws-cdk/aws-sqs/package-lock.json +++ b/packages/@aws-cdk/aws-sqs/package-lock.json @@ -1,45 +1,9 @@ { "name": "@aws-cdk/aws-sqs", - "version": "0.32.0", + "version": "0.33.0", "lockfileVersion": 1, "requires": true, "dependencies": { - "@aws-cdk/aws-autoscaling-api": { - "version": "0.32.0", - "resolved": "https://registry.npmjs.org/@aws-cdk/aws-autoscaling-api/-/aws-autoscaling-api-0.32.0.tgz", - "integrity": "sha512-LSyXgDrAKS0DboM6lCHcBaw5CzvErtqHyBdgfWBPLyqiTnMUaM8m4Wkb32wWdtgMXOfaaRR8/sT6pkPcytFA/g==", - "requires": { - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0" - } - }, - "@aws-cdk/aws-iam": { - "version": "0.32.0", - "resolved": "https://registry.npmjs.org/@aws-cdk/aws-iam/-/aws-iam-0.32.0.tgz", - "integrity": "sha512-oAJSJ6JRG52BFg3tgx+poCvAt0iFUS1dQiMUtZPnxAp/Ij5agOHLW2THjSHwUBtpUWFLQ4o8hElEUL+TQUG3Yw==", - "requires": { - "@aws-cdk/cdk": "^0.32.0", - "@aws-cdk/region-info": "^0.32.0" - } - }, - "@aws-cdk/cdk": { - "version": "0.32.0", - "resolved": "https://registry.npmjs.org/@aws-cdk/cdk/-/cdk-0.32.0.tgz", - "integrity": "sha512-/OIp++CSI+BydfgaJeV7YY2oNWzpxQVYjkym/Ydeyzd8Zq0dr0fj0jgY1t0iBLt10QEkaxzlJrIjNxsBWdsn8A==", - "requires": { - "@aws-cdk/cx-api": "^0.32.0" - } - }, - "@aws-cdk/cx-api": { - "version": "0.32.0", - "resolved": "https://registry.npmjs.org/@aws-cdk/cx-api/-/cx-api-0.32.0.tgz", - "integrity": "sha512-cuES2BrQqYchwA+t+ZYxgnqJQcKBaazLEujrsy+0IOXvqeHmCE1wlAC741H1z9Yi47fprUPsZO5GrKu7BPlahQ==" - }, - "@aws-cdk/region-info": { - "version": "0.32.0", - "resolved": "https://registry.npmjs.org/@aws-cdk/region-info/-/region-info-0.32.0.tgz", - "integrity": "sha512-4sUUMAua/yjI8BY/mfE6VUmUZGaTHdFw85Up/nf9xjecDNfr1yuPeaCrveVzzDE1/bUC7809PStzMqu866rFWw==" - }, "aws-sdk": { "version": "2.462.0", "resolved": "https://registry.npmjs.org/aws-sdk/-/aws-sdk-2.462.0.tgz", diff --git a/packages/@aws-cdk/aws-sqs/package.json b/packages/@aws-cdk/aws-sqs/package.json index dd97e515d13a7..ffad93a03ae57 100644 --- a/packages/@aws-cdk/aws-sqs/package.json +++ b/packages/@aws-cdk/aws-sqs/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-sqs", - "version": "0.32.0", + "version": "0.33.0", "description": "CDK Constructs for AWS SQS", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -60,26 +60,26 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "@aws-cdk/aws-s3": "^0.32.0", + "@aws-cdk/assert": "^0.33.0", + "@aws-cdk/aws-s3": "^0.33.0", "aws-sdk": "^2.438.0", - "cdk-build-tools": "^0.32.0", - "cdk-integ-tools": "^0.32.0", - "cfn2ts": "^0.32.0", - "pkglint": "^0.32.0" + "cdk-build-tools": "^0.33.0", + "cdk-integ-tools": "^0.33.0", + "cfn2ts": "^0.33.0", + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/aws-cloudwatch": "^0.32.0", - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/aws-kms": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/aws-cloudwatch": "^0.33.0", + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/aws-kms": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0" }, "homepage": "https://github.com/awslabs/aws-cdk", "peerDependencies": { - "@aws-cdk/aws-cloudwatch": "^0.32.0", - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/aws-kms": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/aws-cloudwatch": "^0.33.0", + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/aws-kms": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0" }, "engines": { "node": ">= 8.10.0" @@ -89,4 +89,4 @@ "construct-base-is-private:@aws-cdk/aws-sqs.QueueBase" ] } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ssm/package.json b/packages/@aws-cdk/aws-ssm/package.json index 9425d616a2ba5..5afe73e33439d 100644 --- a/packages/@aws-cdk/aws-ssm/package.json +++ b/packages/@aws-cdk/aws-ssm/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-ssm", - "version": "0.32.0", + "version": "0.33.0", "description": "The CDK Construct Library for AWS::SSM", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -60,20 +60,20 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "cdk-build-tools": "^0.32.0", - "cdk-integ-tools": "^0.32.0", - "cfn2ts": "^0.32.0", - "pkglint": "^0.32.0" + "@aws-cdk/assert": "^0.33.0", + "cdk-build-tools": "^0.33.0", + "cdk-integ-tools": "^0.33.0", + "cfn2ts": "^0.33.0", + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0" }, "homepage": "https://github.com/awslabs/aws-cdk", "peerDependencies": { - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0" }, "engines": { "node": ">= 8.10.0" @@ -87,4 +87,4 @@ "from-attributes:fromStringListParameterAttributes" ] } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/index.ts b/packages/@aws-cdk/aws-stepfunctions-tasks/lib/index.ts index 3405a459919d1..0decc8f601c18 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/index.ts +++ b/packages/@aws-cdk/aws-stepfunctions-tasks/lib/index.ts @@ -5,6 +5,4 @@ export * from './run-ecs-task-base-types'; export * from './publish-to-topic'; export * from './send-to-queue'; export * from './run-ecs-ec2-task'; -export * from './run-ecs-fargate-task'; -export * from './number-value'; -export * from './json-path'; +export * from './run-ecs-fargate-task'; \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/json-path.ts b/packages/@aws-cdk/aws-stepfunctions-tasks/lib/json-path.ts deleted file mode 100644 index 9b80f9e37a9d5..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/json-path.ts +++ /dev/null @@ -1,119 +0,0 @@ -import { Token, TokenMap } from '@aws-cdk/cdk'; -import { NumberValue } from './number-value'; - -/** - * Class to create special parameters for state machine states - */ -export class JsonPath { - /** - * Instead of using a literal string, get the value from a JSON path - */ - public static stringFromPath(path: string): string { - if (!path.startsWith('$.')) { - throw new Error("JSONPath values must start with '$.'"); - } - return new JsonPathToken(path).toString(); - } - - /** - * Instead of using a literal string list, get the value from a JSON path - */ - public static listFromPath(path: string): string[] { - if (!path.startsWith('$.')) { - throw new Error("JSONPath values must start with '$.'"); - } - return new JsonPathToken(path).toList(); - } - - /** - * Get a number from a JSON path - */ - public static numberFromPath(path: string): NumberValue { - return NumberValue.fromJsonPath(path); - } - - private constructor() { - } -} - -const JSON_PATH_TOKEN_SYMBOL = Symbol.for('JsonPathToken'); - -class JsonPathToken extends Token { - public static isJsonPathToken(x: object): x is JsonPathToken { - return (x as any)[JSON_PATH_TOKEN_SYMBOL] === true; - } - - constructor(public readonly path: string) { - super(() => path); // Make function to prevent eager evaluation in superclass - Object.defineProperty(this, JSON_PATH_TOKEN_SYMBOL, { value: true }); - } -} - -/** - * Render a parameter string - * - * If the string value starts with '$.', render it as a path string, otherwise as a direct string. - */ -export function renderString(key: string, value: string | undefined): {[key: string]: string} { - if (value === undefined) { return {}; } - - const path = jsonPathString(value); - if (path !== undefined) { - return { [key + '.$']: path }; - } else { - return { [key]: value }; - } -} - -/** - * Render a parameter string - * - * If the string value starts with '$.', render it as a path string, otherwise as a direct string. - */ -export function renderStringList(key: string, value: string[] | undefined): {[key: string]: string[] | string} { - if (value === undefined) { return {}; } - - const path = jsonPathStringList(value); - if (path !== undefined) { - return { [key + '.$']: path }; - } else { - return { [key]: value }; - } -} - -/** - * Render a parameter string - * - * If the string value starts with '$.', render it as a path string, otherwise as a direct string. - */ -export function renderNumber(key: string, value: NumberValue | undefined): {[key: string]: number | string} { - if (value === undefined) { return {}; } - - if (!value.isLiteralNumber) { - return { [key + '.$']: value.jsonPath }; - } else { - return { [key]: value.numberValue }; - } -} - -/** - * If the indicated string is an encoded JSON path, return the path - * - * Otherwise return undefined. - */ -function jsonPathString(x: string): string | undefined { - return pathFromToken(TokenMap.instance().lookupString(x)); -} - -/** - * If the indicated string list is an encoded JSON path, return the path - * - * Otherwise return undefined. - */ -function jsonPathStringList(x: string[]): string | undefined { - return pathFromToken(TokenMap.instance().lookupList(x)); -} - -function pathFromToken(token: Token | undefined) { - return token && (JsonPathToken.isJsonPathToken(token) ? token.path : undefined); -} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/number-value.ts b/packages/@aws-cdk/aws-stepfunctions-tasks/lib/number-value.ts deleted file mode 100644 index 4d01b302ab504..0000000000000 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/number-value.ts +++ /dev/null @@ -1,53 +0,0 @@ -/** - * A number value argument to a Task - * - * Either obtained from the current state, or from a literal number. - * - * This class is only necessary until https://github.com/awslabs/aws-cdk/issues/1455 is solved, - * after which time we'll be able to use actual numbers to encode Tokens. - */ -export class NumberValue { - /** - * Use a literal number - */ - public static fromNumber(n: number): NumberValue { - return new NumberValue(n); - } - - /** - * Obtain a number from the current state - */ - public static fromJsonPath(path: string): NumberValue { - return new NumberValue(undefined, path); - } - - private constructor(private readonly n?: number, private readonly path?: string) { - } - - /** - * Return whether the NumberValue contains a literal number - */ - public get isLiteralNumber(): boolean { - return this.n !== undefined; - } - - /** - * Get the literal number from the NumberValue - */ - public get numberValue(): number { - if (this.n === undefined) { - throw new Error('NumberValue does not have a number'); - } - return this.n; - } - - /** - * Get the JSON Path from the NumberValue - */ - public get jsonPath(): string { - if (this.path === undefined) { - throw new Error('NumberValue does not have a JSONPath'); - } - return this.path; - } -} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/publish-to-topic.ts b/packages/@aws-cdk/aws-stepfunctions-tasks/lib/publish-to-topic.ts index ec2fd3ef36e75..9c2b6e54514d1 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/publish-to-topic.ts +++ b/packages/@aws-cdk/aws-stepfunctions-tasks/lib/publish-to-topic.ts @@ -1,26 +1,15 @@ import iam = require('@aws-cdk/aws-iam'); import sns = require('@aws-cdk/aws-sns'); import sfn = require('@aws-cdk/aws-stepfunctions'); -import cdk = require('@aws-cdk/cdk'); -import { renderString } from './json-path'; /** * Properties for PublishTask */ export interface PublishToTopicProps { /** - * The text message to send to the queue. - * - * Exactly one of `message` and `messageObject` is required. - */ - readonly message?: string; - - /** - * Object to be JSON-encoded and used as message - * - * Exactly one of `message`, `messageObject` and `messagePath` is required. + * The text message to send to the topic. */ - readonly messageObject?: string; + readonly message: sfn.TaskInput; /** * If true, send a different message to every subscription type @@ -59,13 +48,9 @@ export class PublishToTopic implements sfn.IStepFunctionsTask { constructor(private readonly topic: sns.ITopic, private readonly props: PublishToTopicProps) { this.waitForTaskToken = props.waitForTaskToken === true; - - if ((props.message === undefined) === (props.messageObject === undefined)) { - throw new Error(`Supply exactly one of 'message' or 'messageObject'`); - } } - public bind(task: sfn.Task): sfn.StepFunctionsTaskProperties { + public bind(_task: sfn.Task): sfn.StepFunctionsTaskProperties { return { resourceArn: 'arn:aws:states:::sns:publish' + (this.waitForTaskToken ? '.waitForTaskToken' : ''), policyStatements: [new iam.PolicyStatement() @@ -74,11 +59,11 @@ export class PublishToTopic implements sfn.IStepFunctionsTask { ], parameters: { TopicArn: this.topic.topicArn, - ...(this.props.messageObject - ? { Message: new cdk.Token(() => task.node.stringifyJson(this.props.messageObject)) } - : renderString('Message', this.props.message)), - MessageStructure: this.props.messagePerSubscriptionType ? "json" : undefined, - ...renderString('Subject', this.props.subject), + ...sfn.FieldUtils.renderObject({ + Message: this.props.message.value, + MessageStructure: this.props.messagePerSubscriptionType ? "json" : undefined, + Subject: this.props.subject, + }) } }; } diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/run-ecs-task-base-types.ts b/packages/@aws-cdk/aws-stepfunctions-tasks/lib/run-ecs-task-base-types.ts index 7e1ca0e1e21be..a4238287cd819 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/run-ecs-task-base-types.ts +++ b/packages/@aws-cdk/aws-stepfunctions-tasks/lib/run-ecs-task-base-types.ts @@ -1,5 +1,3 @@ -import { NumberValue } from "./number-value"; - export interface ContainerOverride { /** * Name of the container inside the task definition @@ -23,21 +21,21 @@ export interface ContainerOverride { * * @Default The default value from the task definition. */ - readonly cpu?: NumberValue; + readonly cpu?: number; /** * Hard memory limit on the container * * @Default The default value from the task definition. */ - readonly memoryLimit?: NumberValue; + readonly memoryLimit?: number; /** * Soft memory limit on the container * * @Default The default value from the task definition. */ - readonly memoryReservation?: NumberValue; + readonly memoryReservation?: number; } /** diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/run-ecs-task-base.ts b/packages/@aws-cdk/aws-stepfunctions-tasks/lib/run-ecs-task-base.ts index 0e87b79c83720..064ba419c26ac 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/run-ecs-task-base.ts +++ b/packages/@aws-cdk/aws-stepfunctions-tasks/lib/run-ecs-task-base.ts @@ -3,7 +3,6 @@ import ecs = require('@aws-cdk/aws-ecs'); import iam = require('@aws-cdk/aws-iam'); import sfn = require('@aws-cdk/aws-stepfunctions'); import cdk = require('@aws-cdk/cdk'); -import { renderNumber, renderString, renderStringList } from './json-path'; import { ContainerOverride } from './run-ecs-task-base-types'; /** @@ -162,17 +161,17 @@ function renderOverrides(containerOverrides?: ContainerOverride[]) { const ret = new Array(); for (const override of containerOverrides) { - ret.push({ - ...renderString('Name', override.containerName), - ...renderStringList('Command', override.command), - ...renderNumber('Cpu', override.cpu), - ...renderNumber('Memory', override.memoryLimit), - ...renderNumber('MemoryReservation', override.memoryReservation), + ret.push(sfn.FieldUtils.renderObject({ + Name: override.containerName, + Command: override.command, + Cpu: override.cpu, + Memory: override.memoryLimit, + MemoryReservation: override.memoryReservation, Environment: override.environment && override.environment.map(e => ({ - ...renderString('Name', e.name), - ...renderString('Value', e.value), + Name: e.name, + Value: e.value, })) - }); + })); } return { ContainerOverrides: ret }; diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/send-to-queue.ts b/packages/@aws-cdk/aws-stepfunctions-tasks/lib/send-to-queue.ts index 22237069465c2..49369d82ae896 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/send-to-queue.ts +++ b/packages/@aws-cdk/aws-stepfunctions-tasks/lib/send-to-queue.ts @@ -1,17 +1,15 @@ import iam = require('@aws-cdk/aws-iam'); import sqs = require('@aws-cdk/aws-sqs'); import sfn = require('@aws-cdk/aws-stepfunctions'); -import { renderNumber, renderString } from './json-path'; -import { NumberValue } from './number-value'; /** * Properties for SendMessageTask */ export interface SendToQueueProps { /** - * The message body to send to the queue. + * The text message to send to the queue. */ - readonly messageBody: string; + readonly messageBody: sfn.TaskInput; /** * The length of time, in seconds, for which to delay a specific message. @@ -20,7 +18,7 @@ export interface SendToQueueProps { * * @default Default value of the queue is used */ - readonly delaySeconds?: NumberValue; + readonly delaySeconds?: number; /** * The token used for deduplication of sent messages. @@ -70,10 +68,12 @@ export class SendToQueue implements sfn.IStepFunctionsTask { ], parameters: { QueueUrl: this.queue.queueUrl, - ...renderString('MessageBody', this.props.messageBody), - ...renderNumber('DelaySeconds', this.props.delaySeconds), - ...renderString('MessageDeduplicationId', this.props.messageDeduplicationId), - ...renderString('MessageGroupId', this.props.messageGroupId), + ...sfn.FieldUtils.renderObject({ + MessageBody: this.props.messageBody.value, + DelaySeconds: this.props.delaySeconds, + MessageDeduplicationId: this.props.messageDeduplicationId, + MessageGroupId: this.props.messageGroupId, + }) } }; } diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/package-lock.json b/packages/@aws-cdk/aws-stepfunctions-tasks/package-lock.json index 8fe2a7e44abd5..1abfa69b77ed3 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/package-lock.json +++ b/packages/@aws-cdk/aws-stepfunctions-tasks/package-lock.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-stepfunctions-tasks", - "version": "0.32.0", + "version": "0.33.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/package.json b/packages/@aws-cdk/aws-stepfunctions-tasks/package.json index fe10957de3958..94d3f7aa93309 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/package.json +++ b/packages/@aws-cdk/aws-stepfunctions-tasks/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-stepfunctions-tasks", - "version": "0.32.0", + "version": "0.33.0", "description": "Task integrations for AWS StepFunctions", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -72,36 +72,36 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "cdk-build-tools": "^0.32.0", - "cdk-integ-tools": "^0.32.0", + "@aws-cdk/assert": "^0.33.0", + "cdk-build-tools": "^0.33.0", + "cdk-integ-tools": "^0.33.0", "jest": "^24.8.0", - "pkglint": "^0.32.0" + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/aws-cloudwatch": "^0.32.0", - "@aws-cdk/aws-ec2": "^0.32.0", - "@aws-cdk/aws-ecs": "^0.32.0", - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/aws-lambda": "^0.32.0", - "@aws-cdk/aws-sns": "^0.32.0", - "@aws-cdk/aws-sqs": "^0.32.0", - "@aws-cdk/aws-stepfunctions": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/aws-cloudwatch": "^0.33.0", + "@aws-cdk/aws-ec2": "^0.33.0", + "@aws-cdk/aws-ecs": "^0.33.0", + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/aws-lambda": "^0.33.0", + "@aws-cdk/aws-sns": "^0.33.0", + "@aws-cdk/aws-sqs": "^0.33.0", + "@aws-cdk/aws-stepfunctions": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0" }, "homepage": "https://github.com/awslabs/aws-cdk", "peerDependencies": { - "@aws-cdk/aws-cloudwatch": "^0.32.0", - "@aws-cdk/aws-ec2": "^0.32.0", - "@aws-cdk/aws-ecs": "^0.32.0", - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/aws-lambda": "^0.32.0", - "@aws-cdk/aws-sns": "^0.32.0", - "@aws-cdk/aws-sqs": "^0.32.0", - "@aws-cdk/aws-stepfunctions": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/aws-cloudwatch": "^0.33.0", + "@aws-cdk/aws-ec2": "^0.33.0", + "@aws-cdk/aws-ecs": "^0.33.0", + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/aws-lambda": "^0.33.0", + "@aws-cdk/aws-sns": "^0.33.0", + "@aws-cdk/aws-sqs": "^0.33.0", + "@aws-cdk/aws-stepfunctions": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0" }, "engines": { "node": ">= 8.10.0" } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/ecs-tasks.test.ts b/packages/@aws-cdk/aws-stepfunctions-tasks/test/ecs-tasks.test.ts index 829d1534101a4..b1edbbd9a1de7 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/ecs-tasks.test.ts +++ b/packages/@aws-cdk/aws-stepfunctions-tasks/test/ecs-tasks.test.ts @@ -4,7 +4,6 @@ import ecs = require('@aws-cdk/aws-ecs'); import sfn = require('@aws-cdk/aws-stepfunctions'); import { Stack } from '@aws-cdk/cdk'; import tasks = require('../lib'); -import { JsonPath, NumberValue } from '../lib'; let stack: Stack; let vpc: ec2.Vpc; @@ -20,7 +19,7 @@ beforeEach(() => { }); }); -test('Canot create a Farkate task with a fargate-incompatible task definition', () => { +test('Cannot create a Fargate task with a fargate-incompatible task definition', () => { const taskDefinition = new ecs.TaskDefinition(stack, 'TD', { memoryMiB: '512', cpu: '256', @@ -35,7 +34,7 @@ test('Canot create a Farkate task with a fargate-incompatible task definition', .toThrowError(/not configured for compatibility with Fargate/); }); -test('Canot create a Farkate task without a default container', () => { +test('Cannot create a Fargate task without a default container', () => { const taskDefinition = new ecs.TaskDefinition(stack, 'TD', { memoryMiB: '512', cpu: '256', @@ -64,7 +63,7 @@ test('Running a Fargate Task', () => { { containerName: 'TheContainer', environment: [ - {name: 'SOME_KEY', value: JsonPath.stringFromPath('$.SomeKey')} + {name: 'SOME_KEY', value: sfn.Data.stringAt('$.SomeKey')} ] } ] @@ -162,7 +161,7 @@ test('Running an EC2 Task with bridge network', () => { { containerName: 'TheContainer', environment: [ - {name: 'SOME_KEY', value: JsonPath.stringFromPath('$.SomeKey')} + {name: 'SOME_KEY', value: sfn.Data.stringAt('$.SomeKey')} ] } ] @@ -296,9 +295,9 @@ test('Running an EC2 Task with overridden number values', () => { containerOverrides: [ { containerName: 'TheContainer', - command: JsonPath.listFromPath('$.TheCommand'), - cpu: NumberValue.fromNumber(5), - memoryLimit: JsonPath.numberFromPath('$.MemoryLimit'), + command: sfn.Data.listAt('$.TheCommand'), + cpu: 5, + memoryLimit: sfn.Data.numberAt('$.MemoryLimit'), } ] }); diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/integ.ec2-task.ts b/packages/@aws-cdk/aws-stepfunctions-tasks/test/integ.ec2-task.ts index 49d1a0d4dee9c..9ce9f362534d8 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/integ.ec2-task.ts +++ b/packages/@aws-cdk/aws-stepfunctions-tasks/test/integ.ec2-task.ts @@ -37,7 +37,7 @@ const definition = new sfn.Pass(stack, 'Start', { environment: [ { name: 'SOME_KEY', - value: tasks.JsonPath.stringFromPath('$.SomeKey') + value: sfn.Data.stringAt('$.SomeKey') } ] } diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/integ.fargate-task.ts b/packages/@aws-cdk/aws-stepfunctions-tasks/test/integ.fargate-task.ts index 320c278437ab6..5589cf0e1ef67 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/integ.fargate-task.ts +++ b/packages/@aws-cdk/aws-stepfunctions-tasks/test/integ.fargate-task.ts @@ -37,7 +37,7 @@ const definition = new sfn.Pass(stack, 'Start', { environment: [ { name: 'SOME_KEY', - value: tasks.JsonPath.stringFromPath('$.SomeKey') + value: sfn.Data.stringAt('$.SomeKey') } ] } diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/publish-to-topic.test.ts b/packages/@aws-cdk/aws-stepfunctions-tasks/test/publish-to-topic.test.ts index aa2840864c07a..ad846441a73d6 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/publish-to-topic.test.ts +++ b/packages/@aws-cdk/aws-stepfunctions-tasks/test/publish-to-topic.test.ts @@ -10,7 +10,7 @@ test('publish to SNS', () => { // WHEN const pub = new sfn.Task(stack, 'Publish', { task: new tasks.PublishToTopic(topic, { - message: 'Send this message' + message: sfn.TaskInput.fromText('Send this message') }) }); // THEN @@ -24,3 +24,29 @@ test('publish to SNS', () => { }, }); }); + +test('publish JSON to SNS', () => { + // GIVEN + const stack = new cdk.Stack(); + const topic = new sns.Topic(stack, 'Topic'); + + // WHEN + const pub = new sfn.Task(stack, 'Publish', { task: new tasks.PublishToTopic(topic, { + message: sfn.TaskInput.fromObject({ + Input: 'Send this message' + }) + }) }); + + // THEN + expect(stack.node.resolve(pub.toStateJson())).toEqual({ + Type: 'Task', + Resource: 'arn:aws:states:::sns:publish', + End: true, + Parameters: { + TopicArn: { Ref: 'TopicBFC7AF6E' }, + Message: { + Input: 'Send this message' + } + }, + }); +}); diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/send-to-queue.test.ts b/packages/@aws-cdk/aws-stepfunctions-tasks/test/send-to-queue.test.ts index 6af5300dba9aa..6bd53350058fa 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/send-to-queue.test.ts +++ b/packages/@aws-cdk/aws-stepfunctions-tasks/test/send-to-queue.test.ts @@ -3,15 +3,20 @@ import sfn = require('@aws-cdk/aws-stepfunctions'); import cdk = require('@aws-cdk/cdk'); import tasks = require('../lib'); -test('publish to queue', () => { +let stack: cdk.Stack; +let queue: sqs.Queue; + +beforeEach(() => { // GIVEN - const stack = new cdk.Stack(); - const queue = new sqs.Queue(stack, 'Queue'); + stack = new cdk.Stack(); + queue = new sqs.Queue(stack, 'Queue'); +}); +test('publish to queue', () => { // WHEN const pub = new sfn.Task(stack, 'Send', { task: new tasks.SendToQueue(queue, { - messageBody: 'Send this message', - messageDeduplicationId: tasks.JsonPath.stringFromPath('$.deduping'), + messageBody: sfn.TaskInput.fromText('Send this message'), + messageDeduplicationId: sfn.Data.stringAt('$.deduping'), }) }); // THEN @@ -25,4 +30,74 @@ test('publish to queue', () => { 'MessageDeduplicationId.$': '$.deduping' }, }); +}); + +test('message body can come from state', () => { + // WHEN + const pub = new sfn.Task(stack, 'Send', { + task: new tasks.SendToQueue(queue, { + messageBody: sfn.TaskInput.fromDataAt('$.theMessage') + }) + }); + + // THEN + expect(stack.node.resolve(pub.toStateJson())).toEqual({ + Type: 'Task', + Resource: 'arn:aws:states:::sqs:sendMessage', + End: true, + Parameters: { + 'QueueUrl': { Ref: 'Queue4A7E3555' }, + 'MessageBody.$': '$.theMessage', + }, + }); +}); + +test('message body can be an object', () => { + // WHEN + const pub = new sfn.Task(stack, 'Send', { + task: new tasks.SendToQueue(queue, { + messageBody: sfn.TaskInput.fromObject({ + literal: 'literal', + SomeInput: sfn.Data.stringAt('$.theMessage') + }) + }) + }); + + // THEN + expect(stack.node.resolve(pub.toStateJson())).toEqual({ + Type: 'Task', + Resource: 'arn:aws:states:::sqs:sendMessage', + End: true, + Parameters: { + QueueUrl: { Ref: 'Queue4A7E3555' }, + MessageBody: { + 'literal': 'literal', + 'SomeInput.$': '$.theMessage', + } + }, + }); +}); + +test('message body object can contain references', () => { + // WHEN + const pub = new sfn.Task(stack, 'Send', { + task: new tasks.SendToQueue(queue, { + messageBody: sfn.TaskInput.fromObject({ + queueArn: queue.queueArn + }) + }) + }); + + // THEN + expect(stack.node.resolve(pub.toStateJson())).toEqual({ + Type: 'Task', + Resource: 'arn:aws:states:::sqs:sendMessage', + End: true, + Parameters: { + QueueUrl: { Ref: 'Queue4A7E3555' }, + MessageBody: { + queueArn: { 'Fn::GetAtt': ['Queue4A7E3555', 'Arn'] } + } + }, + }); }); \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions/README.md b/packages/@aws-cdk/aws-stepfunctions/README.md index 3640e5d6d09ee..4d51b322514a5 100644 --- a/packages/@aws-cdk/aws-stepfunctions/README.md +++ b/packages/@aws-cdk/aws-stepfunctions/README.md @@ -119,8 +119,8 @@ couple of the tasks available are: Many tasks take parameters. The values for those can either be supplied directly in the workflow definition (by specifying their values), or at -runtime by passing a value obtained from the static functions on `JsonPath`, -such as `JsonPath.stringFromPath()`. +runtime by passing a value obtained from the static functions on `Data`, +such as `Data.stringAt()`. If so, the value is taken from the indicated location in the state JSON, similar to (for example) `inputPath`. @@ -155,9 +155,22 @@ import sns = require('@aws-cdk/aws-sns'); // ... const topic = new sns.Topic(this, 'Topic'); -const task = new sfn.Task(this, 'Publish', { + +// Use a field from the execution data as message. +const task1 = new sfn.Task(this, 'Publish1', { + task: new tasks.PublishToTopic(topic, { + message: TaskInput.fromDataAt('$.state.message'), + }) +}); + +// Combine a field from the execution data with +// a literal object. +const task2 = new sfn.Task(this, 'Publish2', { task: new tasks.PublishToTopic(topic, { - message: JsonPath.stringFromPath('$.state.message'), + message: TaskInput.fromObject({ + field1: 'somedata', + field2: Data.stringAt('$.field2'), + }) }) }); ``` @@ -170,11 +183,26 @@ import sqs = require('@aws-cdk/aws-sqs'); // ... const queue = new sns.Queue(this, 'Queue'); -const task = new sfn.Task(this, 'Send', { + +// Use a field from the execution data as message. +const task1 = new sfn.Task(this, 'Send1', { + task: new tasks.SendToQueue(queue, { + messageBody: TaskInput.fromDataAt('$.message'), + // Only for FIFO queues + messageGroupId: '1234' + }) +}); + +// Combine a field from the execution data with +// a literal object. +const task2 = new sfn.Task(this, 'Send2', { task: new tasks.SendToQueue(queue, { - messageBody: JsonPath.stringFromPath('$.message'), + messageBody: TaskInput.fromObject({ + field1: 'somedata', + field2: Data.stringAt('$.field2'), + }), // Only for FIFO queues - messageGroupId: JsonPath.stringFromPath('$.messageGroupId'), + messageGroupId: '1234' }) }); ``` @@ -195,7 +223,7 @@ const fargateTask = new ecs.RunEcsFargateTask({ environment: [ { name: 'CONTAINER_INPUT', - value: JsonPath.stringFromPath('$.valueFromStateData') + value: Data.stringAt('$.valueFromStateData') } ] } @@ -464,4 +492,4 @@ Contributions welcome: - [ ] A single `LambdaTask` class that is both a `Lambda` and a `Task` in one might make for a nice API. - [ ] Expression parser for Conditions. -- [ ] Simulate state machines in unit tests. \ No newline at end of file +- [ ] Simulate state machines in unit tests. diff --git a/packages/@aws-cdk/aws-stepfunctions/lib/fields.ts b/packages/@aws-cdk/aws-stepfunctions/lib/fields.ts new file mode 100644 index 0000000000000..4fd4e2a693e05 --- /dev/null +++ b/packages/@aws-cdk/aws-stepfunctions/lib/fields.ts @@ -0,0 +1,136 @@ +import { findReferencedPaths, JsonPathToken, renderObject } from "./json-path"; + +/** + * Extract a field from the State Machine data that gets passed around between states + */ +export class Data { + /** + * Instead of using a literal string, get the value from a JSON path + */ + public static stringAt(path: string): string { + validateDataPath(path); + return new JsonPathToken(path).toString(); + } + + /** + * Instead of using a literal string list, get the value from a JSON path + */ + public static listAt(path: string): string[] { + validateDataPath(path); + return new JsonPathToken(path).toList(); + } + + /** + * Instead of using a literal number, get the value from a JSON path + */ + public static numberAt(path: string): number { + validateDataPath(path); + return new JsonPathToken(path).toNumber(); + } + + /** + * Use the entire data structure + * + * Will be an object at invocation time, but is represented in the CDK + * application as a string. + */ + public static get entirePayload(): string { + return new JsonPathToken('$').toString(); + } + + private constructor() { + } +} + +/** + * Extract a field from the State Machine Context data + * + * @see https://docs.aws.amazon.com/step-functions/latest/dg/connect-to-resource.html#wait-token-contextobject + */ +export class Context { + /** + * Instead of using a literal string, get the value from a JSON path + */ + public static stringAt(path: string): string { + validateContextPath(path); + return new JsonPathToken(path).toString(); + } + + /** + * Instead of using a literal number, get the value from a JSON path + */ + public static numberAt(path: string): number { + validateContextPath(path); + return new JsonPathToken(path).toNumber(); + } + + /** + * Return the Task Token field + * + * External actions will need this token to report step completion + * back to StepFunctions using the `SendTaskSuccess` or `SendTaskFailure` + * calls. + */ + public static get taskToken(): string { + return new JsonPathToken('$$.Task.Token').toString(); + } + + /** + * Use the entire context data structure + * + * Will be an object at invocation time, but is represented in the CDK + * application as a string. + */ + public static get entireContext(): string { + return new JsonPathToken('$$').toString(); + } + + private constructor() { + } +} + +/** + * Helper functions to work with structures containing fields + */ +export class FieldUtils { + + /** + * Render a JSON structure containing fields to the right StepFunctions structure + */ + public static renderObject(obj?: {[key: string]: any}): {[key: string]: any} | undefined { + return renderObject(obj); + } + + /** + * Return all JSON paths used in the given structure + */ + public static findReferencedPaths(obj?: {[key: string]: any}): string[] { + return Array.from(findReferencedPaths(obj)).sort(); + } + + /** + * Returns whether the given task structure contains the TaskToken field anywhere + * + * The field is considered included if the field itself or one of its containing + * fields occurs anywhere in the payload. + */ + public static containsTaskToken(obj?: {[key: string]: any}): boolean { + const paths = findReferencedPaths(obj); + return paths.has('$$.Task.Token') || paths.has('$$.Task') || paths.has('$$'); + } + + private constructor() { + } +} + +function validateDataPath(path: string) { + if (!path.startsWith('$.')) { + throw new Error("Data JSON path values must start with '$.'"); + } +} + +function validateContextPath(path: string) { + if (!path.startsWith('$$.')) { + throw new Error("Context JSON path values must start with '$$.'"); + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions/lib/index.ts b/packages/@aws-cdk/aws-stepfunctions/lib/index.ts index a550a54412b66..c86d357b3ac02 100644 --- a/packages/@aws-cdk/aws-stepfunctions/lib/index.ts +++ b/packages/@aws-cdk/aws-stepfunctions/lib/index.ts @@ -1,4 +1,6 @@ +export * from './fields'; export * from './activity'; +export * from './input'; export * from './types'; export * from './condition'; export * from './state-machine'; diff --git a/packages/@aws-cdk/aws-stepfunctions/lib/input.ts b/packages/@aws-cdk/aws-stepfunctions/lib/input.ts new file mode 100644 index 0000000000000..dedb89ad9af87 --- /dev/null +++ b/packages/@aws-cdk/aws-stepfunctions/lib/input.ts @@ -0,0 +1,58 @@ +import { Context, Data } from "./fields"; + +/** + * Type union for task classes that accept multiple types of payload + */ +export class TaskInput { + /** + * Use a literal string as task input + * + * This might be a JSON-encoded object, or just a text. + */ + public static fromText(text: string) { + return new TaskInput(InputType.Text, text); + } + + /** + * Use an object as task input + * + * This object may contain Data and Context fields + * as object values, if desired. + */ + public static fromObject(obj: {[key: string]: any}) { + return new TaskInput(InputType.Object, obj); + } + + /** + * Use a part of the execution data as task input + * + * Use this when you want to use a subobject or string from + * the current state machine execution as complete payload + * to a task. + */ + public static fromDataAt(path: string) { + return new TaskInput(InputType.Text, Data.stringAt(path)); + } + + /** + * Use a part of the task context as task input + * + * Use this when you want to use a subobject or string from + * the current task context as complete payload + * to a task. + */ + public static fromContextAt(path: string) { + return new TaskInput(InputType.Text, Context.stringAt(path)); + } + + private constructor(public readonly type: InputType, public readonly value: any) { + } +} + +/** + * The type of task input + */ +export enum InputType { + Text, + Object +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions/lib/json-path.ts b/packages/@aws-cdk/aws-stepfunctions/lib/json-path.ts new file mode 100644 index 0000000000000..eb80f01684e3c --- /dev/null +++ b/packages/@aws-cdk/aws-stepfunctions/lib/json-path.ts @@ -0,0 +1,196 @@ +import { Token, TokenMap } from '@aws-cdk/cdk'; + +const JSON_PATH_TOKEN_SYMBOL = Symbol.for('@aws-cdk/aws-stepfunctions.JsonPathToken'); + +export class JsonPathToken extends Token { + public static isJsonPathToken(x: any): x is JsonPathToken { + return (x as any)[JSON_PATH_TOKEN_SYMBOL] === true; + } + + constructor(public readonly path: string) { + super(() => path, `field${path}`); // Make function to prevent eager evaluation in superclass + Object.defineProperty(this, JSON_PATH_TOKEN_SYMBOL, { value: true }); + } +} + +/** + * Deep render a JSON object to expand JSON path fields, updating the key to end in '.$' + */ +export function renderObject(obj: object | undefined): object | undefined { + return recurseObject(obj, { + handleString: renderString, + handleList: renderStringList, + handleNumber: renderNumber + }); +} + +/** + * Return all JSON paths that are used in the given structure + */ +export function findReferencedPaths(obj: object | undefined): Set { + const found = new Set(); + + recurseObject(obj, { + handleString(_key: string, x: string) { + const path = jsonPathString(x); + if (path !== undefined) { found.add(path); } + return {}; + }, + + handleList(_key: string, x: string[]) { + const path = jsonPathStringList(x); + if (path !== undefined) { found.add(path); } + return {}; + }, + + handleNumber(_key: string, x: number) { + const path = jsonPathNumber(x); + if (path !== undefined) { found.add(path); } + return {}; + } + }); + + return found; +} + +interface FieldHandlers { + handleString(key: string, x: string): {[key: string]: string}; + handleList(key: string, x: string[]): {[key: string]: string[] | string }; + handleNumber(key: string, x: number): {[key: string]: number | string}; +} + +export function recurseObject(obj: object | undefined, handlers: FieldHandlers): object | undefined { + if (obj === undefined) { return undefined; } + + const ret: any = {}; + for (const [key, value] of Object.entries(obj)) { + if (typeof value === 'string') { + Object.assign(ret, handlers.handleString(key, value)); + } else if (typeof value === 'number') { + Object.assign(ret, handlers.handleNumber(key, value)); + } else if (Array.isArray(value)) { + Object.assign(ret, recurseArray(key, value, handlers)); + } else if (value === null || value === undefined) { + // Nothing + } else if (typeof value === 'object') { + ret[key] = recurseObject(value, handlers); + } + } + + return ret; +} + +/** + * Render an array that may or may not contain a string list token + */ +function recurseArray(key: string, arr: any[], handlers: FieldHandlers): {[key: string]: any[] | string} { + if (isStringArray(arr)) { + const path = jsonPathStringList(arr); + if (path !== undefined) { + return handlers.handleList(key, arr); + } + + // Fall through to correctly reject encoded strings inside an array. + // They cannot be represented because there is no key to append a '.$' to. + } + + return { + [key]: arr.map(value => { + if ((typeof value === 'string' && jsonPathString(value) !== undefined) + || (typeof value === 'number' && jsonPathNumber(value) !== undefined) + || (isStringArray(value) && jsonPathStringList(value) !== undefined)) { + throw new Error('Cannot use JsonPath fields in an array, they must be used in objects'); + } + if (typeof value === 'object' && value !== null) { + return recurseObject(value, handlers); + } + return value; + }) + }; +} + +function isStringArray(x: any): x is string[] { + return Array.isArray(x) && x.every(el => typeof el === 'string'); +} + +/** + * Render a parameter string + * + * If the string value starts with '$.', render it as a path string, otherwise as a direct string. + */ +function renderString(key: string, value: string): {[key: string]: string} { + const path = jsonPathString(value); + if (path !== undefined) { + return { [key + '.$']: path }; + } else { + return { [key]: value }; + } +} + +/** + * Render a parameter string + * + * If the string value starts with '$.', render it as a path string, otherwise as a direct string. + */ +function renderStringList(key: string, value: string[]): {[key: string]: string[] | string} { + const path = jsonPathStringList(value); + if (path !== undefined) { + return { [key + '.$']: path }; + } else { + return { [key]: value }; + } +} + +/** + * Render a parameter string + * + * If the string value starts with '$.', render it as a path string, otherwise as a direct string. + */ +function renderNumber(key: string, value: number): {[key: string]: number | string} { + const path = jsonPathNumber(value); + if (path !== undefined) { + return { [key + '.$']: path }; + } else { + return { [key]: value }; + } +} + +/** + * If the indicated string is an encoded JSON path, return the path + * + * Otherwise return undefined. + */ +function jsonPathString(x: string): string | undefined { + const fragments = TokenMap.instance().splitString(x); + const jsonPathTokens = fragments.tokens.filter(JsonPathToken.isJsonPathToken); + + if (jsonPathTokens.length > 0 && fragments.length > 1) { + throw new Error(`Field references must be the entire string, cannot concatenate them (found '${x}')`); + } + if (jsonPathTokens.length > 0) { + return jsonPathTokens[0].path; + } + return undefined; +} + +/** + * If the indicated string list is an encoded JSON path, return the path + * + * Otherwise return undefined. + */ +function jsonPathStringList(x: string[]): string | undefined { + return pathFromToken(TokenMap.instance().lookupList(x)); +} + +/** + * If the indicated number is an encoded JSON path, return the path + * + * Otherwise return undefined. + */ +function jsonPathNumber(x: number): string | undefined { + return pathFromToken(TokenMap.instance().lookupNumberToken(x)); +} + +function pathFromToken(token: Token | undefined) { + return token && (JsonPathToken.isJsonPathToken(token) ? token.path : undefined); +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions/lib/states/pass.ts b/packages/@aws-cdk/aws-stepfunctions/lib/states/pass.ts index 70e4eee290f0d..4bb97d4374f39 100644 --- a/packages/@aws-cdk/aws-stepfunctions/lib/states/pass.ts +++ b/packages/@aws-cdk/aws-stepfunctions/lib/states/pass.ts @@ -51,7 +51,7 @@ export interface PassProps { * * @default No injected result */ - readonly result?: any; + readonly result?: {[key: string]: any}; } /** diff --git a/packages/@aws-cdk/aws-stepfunctions/package.json b/packages/@aws-cdk/aws-stepfunctions/package.json index 39a2f07c8e165..88f4c9f9edbe5 100644 --- a/packages/@aws-cdk/aws-stepfunctions/package.json +++ b/packages/@aws-cdk/aws-stepfunctions/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-stepfunctions", - "version": "0.32.0", + "version": "0.33.0", "description": "The CDK Construct Library for AWS::StepFunctions", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -60,24 +60,24 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "cdk-build-tools": "^0.32.0", - "cdk-integ-tools": "^0.32.0", - "cfn2ts": "^0.32.0", - "pkglint": "^0.32.0" + "@aws-cdk/assert": "^0.33.0", + "cdk-build-tools": "^0.33.0", + "cdk-integ-tools": "^0.33.0", + "cfn2ts": "^0.33.0", + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/aws-cloudwatch": "^0.32.0", - "@aws-cdk/aws-events": "^0.32.0", - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/aws-cloudwatch": "^0.33.0", + "@aws-cdk/aws-events": "^0.33.0", + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0" }, "homepage": "https://github.com/awslabs/aws-cdk", "peerDependencies": { - "@aws-cdk/aws-cloudwatch": "^0.32.0", - "@aws-cdk/aws-events": "^0.32.0", - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/aws-cloudwatch": "^0.33.0", + "@aws-cdk/aws-events": "^0.33.0", + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0" }, "engines": { "node": ">= 8.10.0" @@ -88,4 +88,4 @@ "export:@aws-cdk/aws-stepfunctions.IActivity" ] } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions/test/test.fields.ts b/packages/@aws-cdk/aws-stepfunctions/test/test.fields.ts new file mode 100644 index 0000000000000..737ad04d43ec3 --- /dev/null +++ b/packages/@aws-cdk/aws-stepfunctions/test/test.fields.ts @@ -0,0 +1,135 @@ +import { Test } from 'nodeunit'; +import { Context, Data, FieldUtils } from "../lib"; + +export = { + 'deep replace correctly handles fields in arrays'(test: Test) { + test.deepEqual(FieldUtils.renderObject({ + literal: 'literal', + field: Data.stringAt('$.stringField'), + listField: Data.listAt('$.listField'), + deep: [ + 'literal', + { + deepField: Data.numberAt('$.numField'), + } + ] + }), { + 'literal': 'literal', + 'field.$': '$.stringField', + 'listField.$': '$.listField', + 'deep': [ + 'literal', + { + 'deepField.$': '$.numField' + } + ], + }); + + test.done(); + }, + + 'exercise contextpaths'(test: Test) { + test.deepEqual(FieldUtils.renderObject({ + str: Context.stringAt('$$.Execution.StartTime'), + count: Context.numberAt('$$.State.RetryCount'), + token: Context.taskToken, + }), { + 'str.$': '$$.Execution.StartTime', + 'count.$': '$$.State.RetryCount', + 'token.$': '$$.Task.Token' + }); + + test.done(); + }, + + 'find all referenced paths'(test: Test) { + test.deepEqual(FieldUtils.findReferencedPaths({ + literal: 'literal', + field: Data.stringAt('$.stringField'), + listField: Data.listAt('$.listField'), + deep: [ + 'literal', + { + field: Data.stringAt('$.stringField'), + deepField: Data.numberAt('$.numField'), + } + ] + }), [ + '$.listField', + '$.numField', + '$.stringField', + ]); + + test.done(); + }, + + 'cannot have JsonPath fields in arrays'(test: Test) { + test.throws(() => { + FieldUtils.renderObject({ + deep: [Data.stringAt('$.hello')] + }); + }, /Cannot use JsonPath fields in an array/); + + test.done(); + }, + + 'datafield path must be correct'(test: Test) { + test.throws(() => { + Data.stringAt('hello'); + }, /must start with '\$.'/); + + test.done(); + }, + + 'context path must be correct'(test: Test) { + test.throws(() => { + Context.stringAt('hello'); + }, /must start with '\$\$.'/); + + test.done(); + }, + + 'test contains task token'(test: Test) { + test.equal(true, FieldUtils.containsTaskToken({ + field: Context.taskToken + })); + + test.equal(true, FieldUtils.containsTaskToken({ + field: Context.stringAt('$$.Task'), + })); + + test.equal(true, FieldUtils.containsTaskToken({ + field: Context.entireContext + })); + + test.equal(false, FieldUtils.containsTaskToken({ + oops: 'not here' + })); + + test.equal(false, FieldUtils.containsTaskToken({ + oops: Context.stringAt('$$.Execution.StartTime') + })); + + test.done(); + }, + + 'arbitrary JSONPath fields are not replaced'(test: Test) { + test.deepEqual(FieldUtils.renderObject({ + field: '$.content', + }), { + field: '$.content' + }); + + test.done(); + }, + + 'fields cannot be used somewhere in a string interpolation'(test: Test) { + test.throws(() => { + FieldUtils.renderObject({ + field: `contains ${Data.stringAt('$.hello')}` + }); + }, /Field references must be the entire string/); + + test.done(); + } +}; \ No newline at end of file diff --git a/packages/@aws-cdk/aws-transfer/package.json b/packages/@aws-cdk/aws-transfer/package.json index aeb46d95d0102..0f550263400c7 100644 --- a/packages/@aws-cdk/aws-transfer/package.json +++ b/packages/@aws-cdk/aws-transfer/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-transfer", - "version": "0.32.0", + "version": "0.33.0", "description": "The CDK Construct Library for AWS::Transfer", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -63,18 +63,18 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "cdk-build-tools": "^0.32.0", - "cfn2ts": "^0.32.0", - "pkglint": "^0.32.0" + "@aws-cdk/assert": "^0.33.0", + "cdk-build-tools": "^0.33.0", + "cfn2ts": "^0.33.0", + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "peerDependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "engines": { "node": ">= 8.10.0" } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-waf/package.json b/packages/@aws-cdk/aws-waf/package.json index c8c67c75a4584..311a30a4324b5 100644 --- a/packages/@aws-cdk/aws-waf/package.json +++ b/packages/@aws-cdk/aws-waf/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-waf", - "version": "0.32.0", + "version": "0.33.0", "description": "The CDK Construct Library for AWS::WAF", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -60,19 +60,19 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "cdk-build-tools": "^0.32.0", - "cfn2ts": "^0.32.0", - "pkglint": "^0.32.0" + "@aws-cdk/assert": "^0.33.0", + "cdk-build-tools": "^0.33.0", + "cfn2ts": "^0.33.0", + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "homepage": "https://github.com/awslabs/aws-cdk", "peerDependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "engines": { "node": ">= 8.10.0" } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-wafregional/package.json b/packages/@aws-cdk/aws-wafregional/package.json index f8bb533bea9cb..2db176bf24009 100644 --- a/packages/@aws-cdk/aws-wafregional/package.json +++ b/packages/@aws-cdk/aws-wafregional/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-wafregional", - "version": "0.32.0", + "version": "0.33.0", "description": "The CDK Construct Library for AWS::WAFRegional", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -60,19 +60,19 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "cdk-build-tools": "^0.32.0", - "cfn2ts": "^0.32.0", - "pkglint": "^0.32.0" + "@aws-cdk/assert": "^0.33.0", + "cdk-build-tools": "^0.33.0", + "cfn2ts": "^0.33.0", + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "homepage": "https://github.com/awslabs/aws-cdk", "peerDependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "engines": { "node": ">= 8.10.0" } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-workspaces/package.json b/packages/@aws-cdk/aws-workspaces/package.json index 2bd1527d03301..e16326d18d3ad 100644 --- a/packages/@aws-cdk/aws-workspaces/package.json +++ b/packages/@aws-cdk/aws-workspaces/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/aws-workspaces", - "version": "0.32.0", + "version": "0.33.0", "description": "The CDK Construct Library for AWS::WorkSpaces", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -60,19 +60,19 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "cdk-build-tools": "^0.32.0", - "cfn2ts": "^0.32.0", - "pkglint": "^0.32.0" + "@aws-cdk/assert": "^0.33.0", + "cdk-build-tools": "^0.33.0", + "cfn2ts": "^0.33.0", + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "homepage": "https://github.com/awslabs/aws-cdk", "peerDependencies": { - "@aws-cdk/cdk": "^0.32.0" + "@aws-cdk/cdk": "^0.33.0" }, "engines": { "node": ">= 8.10.0" } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/cdk/lib/cfn-resource.ts b/packages/@aws-cdk/cdk/lib/cfn-resource.ts index d04eac39c5c12..efdebd222796a 100644 --- a/packages/@aws-cdk/cdk/lib/cfn-resource.ts +++ b/packages/@aws-cdk/cdk/lib/cfn-resource.ts @@ -2,12 +2,12 @@ import cxapi = require('@aws-cdk/cx-api'); import { CfnCondition } from './cfn-condition'; import { Construct, IConstruct } from './construct'; import { CreationPolicy, DeletionPolicy, UpdatePolicy } from './resource-policy'; -import { TagManager } from './tag-manager'; import { capitalizePropertyNames, ignoreEmpty, PostResolveToken } from './util'; // import required to be here, otherwise causes a cycle when running the generated JavaScript // tslint:disable-next-line:ordered-imports import { CfnRefElement } from './cfn-element'; import { CfnReference } from './cfn-reference'; +import { TagManager } from './tag-manager'; export interface CfnResourceProps { /** @@ -23,12 +23,6 @@ export interface CfnResourceProps { readonly properties?: any; } -export interface ITaggable { - /** - * TagManager to set, remove and format tags - */ - readonly tags: TagManager; -} /** * Represents a CloudFormation resource. */ @@ -56,13 +50,6 @@ export class CfnResource extends CfnRefElement { return (construct as any).resourceType !== undefined; } - /** - * Check whether the given construct is Taggable - */ - public static isTaggable(construct: any): construct is ITaggable { - return (construct as any).tags !== undefined; - } - /** * Options for this resource, such as condition, update policy etc. */ @@ -212,7 +199,7 @@ export class CfnResource extends CfnRefElement { public _toCloudFormation(): object { try { // merge property overrides onto properties and then render (and validate). - const tags = CfnResource.isTaggable(this) ? this.tags.renderTags() : undefined; + const tags = TagManager.isTaggable(this) ? this.tags.renderTags() : undefined; const properties = deepMerge( this.properties || {}, { tags }, @@ -234,9 +221,11 @@ export class CfnResource extends CfnRefElement { Metadata: ignoreEmpty(this.options.metadata), Condition: this.options.condition && this.options.condition.logicalId }, props => { - const r = deepMerge(props, this.rawOverrides); - r.Properties = this.renderProperties(r.Properties); - return r; + // let derived classes to influence how properties are rendered (e.g. change capitalization) + props.Properties = this.renderProperties(props.Properties); + + // merge overrides *after* rendering + return deepMerge(props, this.rawOverrides); }) } }; @@ -279,6 +268,7 @@ export enum TagType { Standard = 'StandardTag', AutoScalingGroup = 'AutoScalingGroupTag', Map = 'StringToStringMap', + KeyValue = 'KeyValue', NotTaggable = 'NotTaggable', } diff --git a/packages/@aws-cdk/cdk/lib/construct.ts b/packages/@aws-cdk/cdk/lib/construct.ts index 900df346bdb09..24735d55f7e98 100644 --- a/packages/@aws-cdk/cdk/lib/construct.ts +++ b/packages/@aws-cdk/cdk/lib/construct.ts @@ -1,7 +1,7 @@ import cxapi = require('@aws-cdk/cx-api'); import { IAspect } from './aspect'; import { CLOUDFORMATION_TOKEN_RESOLVER, CloudFormationLang } from './cloudformation-lang'; -import { IDependable } from './dependency'; +import { DependableTrait, IDependable } from './dependency'; import { resolve } from './resolve'; import { createStackTrace } from './stack-trace'; import { Token } from './token'; @@ -183,6 +183,21 @@ export class ConstructNode { return ret; } + /** + * Returns the child construct that has the id "Default" or "Resource". + * @throws if there is more than one child + * @returns a construct or undefined if there is no default child + */ + public get defaultChild(): IConstruct | undefined { + const resourceChild = this.tryFindChild('Resource'); + const defaultChild = this.tryFindChild('Default'); + if (resourceChild && defaultChild) { + throw new Error(`Cannot determine default child for ${this.path}. There is both a child with id "Resource" and id "Default"`); + } + + return defaultChild || resourceChild; + } + /** * All direct children of this construct. */ @@ -537,7 +552,7 @@ export class ConstructNode { for (const source of this.findAll()) { for (const dependable of source.node.dependencies) { - for (const target of dependable.dependencyRoots) { + for (const target of DependableTrait.get(dependable).dependencyRoots) { let foundTargets = found.get(source); if (!foundTargets) { found.set(source, foundTargets = new Set()); } @@ -594,14 +609,6 @@ export class Construct implements IConstruct { */ public readonly node: ConstructNode; - /** - * The set of constructs that form the root of this dependable - * - * All resources under all returned constructs are included in the ordering - * dependency. - */ - public readonly dependencyRoots: IConstruct[] = [this]; - /** * Creates a new construct node. * @@ -612,6 +619,12 @@ export class Construct implements IConstruct { */ constructor(scope: Construct, id: string) { this.node = new ConstructNode(this, scope, id); + + // Implement IDependable privately + const self = this; + DependableTrait.implement(this, { + get dependencyRoots() { return [self]; }, + }); } /** @@ -706,4 +719,5 @@ export interface OutgoingReference { } // Import this _after_ everything else to help node work the classes out in the correct order... -import { Reference } from './reference'; + +import { Reference } from './reference'; \ No newline at end of file diff --git a/packages/@aws-cdk/cdk/lib/dependency.ts b/packages/@aws-cdk/cdk/lib/dependency.ts index 30a2137ae4590..a62ce86f49285 100644 --- a/packages/@aws-cdk/cdk/lib/dependency.ts +++ b/packages/@aws-cdk/cdk/lib/dependency.ts @@ -1,7 +1,10 @@ import { IConstruct } from "./construct"; /** - * A set of constructs that can be depended upon + * Trait marker for classes that can be depended upon + * + * The presence of this interface indicates that an object has + * an `IDependableTrait` implementation. * * This interface can be used to take an (ordering) dependency on a set of * constructs. An ordering dependency implies that the resources represented by @@ -9,13 +12,7 @@ import { IConstruct } from "./construct"; * deployed. */ export interface IDependable { - /** - * The set of constructs that form the root of this dependable - * - * All resources under all returned constructs are included in the ordering - * dependency. - */ - readonly dependencyRoots: IConstruct[]; + // Empty, this interface is a trait marker } /** @@ -27,17 +24,71 @@ export interface IDependable { export class ConcreteDependable implements IDependable { private readonly _dependencyRoots = new Array(); + constructor() { + const self = this; + DependableTrait.implement(this, { + get dependencyRoots() { return self._dependencyRoots; }, + }); + } + /** * Add a construct to the dependency roots */ public add(construct: IConstruct) { this._dependencyRoots.push(construct); } +} +/** + * Trait for IDependable + * + * Traits are interfaces that are privately implemented by objects. Instead of + * showing up in the public interface of a class, they need to be queried + * explicitly. This is used to implement certain framework features that are + * not intended to be used by Construct consumers, and so should be hidden + * from accidental use. + * + * @example + * + * // Usage + * const roots = DependableTrait.get(construct).dependencyRoots; + * + * // Definition + * DependableTrait.implement(construct, { + * get dependencyRoots() { return []; } + * }); + */ +export abstract class DependableTrait { /** - * Retrieve the current set of dependency roots + * Register `instance` to have the given DependableTrait + * + * Should be called in the class constructor. */ - public get dependencyRoots(): IConstruct[] { - return this._dependencyRoots; + public static implement(instance: IDependable, trait: DependableTrait) { + // I would also like to reference classes (to cut down on the list of objects + // we need to manage), but we can't do that either since jsii doesn't have the + // concept of a class reference. + DependableTrait.traitMap.set(instance, trait); } + + /** + * Return the matching DependableTrait for the given class instance. + */ + public static get(instance: IDependable): DependableTrait { + const ret = DependableTrait.traitMap.get(instance); + if (!ret) { + throw new Error(`${instance} does not implement DependableTrait`); + } + return ret; + } + + private static traitMap = new WeakMap(); + + /** + * The set of constructs that form the root of this dependable + * + * All resources under all returned constructs are included in the ordering + * dependency. + */ + public abstract readonly dependencyRoots: IConstruct[]; } \ No newline at end of file diff --git a/packages/@aws-cdk/cdk/lib/encoding.ts b/packages/@aws-cdk/cdk/lib/encoding.ts index c4d072e64df65..90af8112ff41b 100644 --- a/packages/@aws-cdk/cdk/lib/encoding.ts +++ b/packages/@aws-cdk/cdk/lib/encoding.ts @@ -24,7 +24,7 @@ export class TokenString { /** * Returns a `TokenString` for this string. */ - public static forStringToken(s: string) { + public static forString(s: string) { return new TokenString(s, STRING_TOKEN_REGEX); } @@ -106,7 +106,7 @@ export function containsListTokenElement(xs: any[]) { */ export function unresolved(obj: any): boolean { if (typeof(obj) === 'string') { - return TokenString.forStringToken(obj).test(); + return TokenString.forString(obj).test(); } else if (typeof obj === 'number') { return extractTokenDouble(obj) !== undefined; } else if (Array.isArray(obj) && obj.length === 1) { diff --git a/packages/@aws-cdk/cdk/lib/resolve.ts b/packages/@aws-cdk/cdk/lib/resolve.ts index 0f9bf51a10704..01b970935409e 100644 --- a/packages/@aws-cdk/cdk/lib/resolve.ts +++ b/packages/@aws-cdk/cdk/lib/resolve.ts @@ -77,7 +77,7 @@ export function resolve(obj: any, options: IResolveOptions): any { // string - potentially replace all stringified Tokens // if (typeof(obj) === 'string') { - const str = TokenString.forStringToken(obj); + const str = TokenString.forString(obj); if (str.test()) { const fragments = str.split(tokenMap.lookupToken.bind(tokenMap)); return options.resolver.resolveString(fragments, makeContext()); diff --git a/packages/@aws-cdk/cdk/lib/stack.ts b/packages/@aws-cdk/cdk/lib/stack.ts index 572736e9c782f..41d3626c57fe0 100644 --- a/packages/@aws-cdk/cdk/lib/stack.ts +++ b/packages/@aws-cdk/cdk/lib/stack.ts @@ -7,7 +7,6 @@ import { Construct, IConstruct, PATH_SEP } from './construct'; import { Environment } from './environment'; import { HashedAddressingScheme, IAddressingScheme, LogicalIDs } from './logical-id'; import { makeUniqueId } from './uniqueid'; - export interface StackProps { /** * The AWS environment (account/region) where this stack will be deployed. @@ -41,6 +40,13 @@ export interface StackProps { * @default true */ readonly autoDeploy?: boolean; + + /** + * Stack tags that will be applied to all the taggable resources and the stack itself. + * + * @default {} + */ + readonly tags?: { [key: string]: string }; } const STACK_SYMBOL = Symbol.for('@aws-cdk/cdk.Stack'); @@ -48,7 +54,8 @@ const STACK_SYMBOL = Symbol.for('@aws-cdk/cdk.Stack'); /** * A root construct which represents a single CloudFormation stack. */ -export class Stack extends Construct { +export class Stack extends Construct implements ITaggable { + /** * Adds a metadata annotation "aws:cdk:physical-name" to the construct if physicalName * is non-null. This can be used later by tools and aspects to determine if resources @@ -73,6 +80,11 @@ export class Stack extends Construct { private static readonly VALID_STACK_NAME_REGEX = /^[A-Za-z][A-Za-z0-9-]*$/; + /** + * Tags to be applied to the stack. + */ + public readonly tags: TagManager; + /** * Lists all missing contextual information. * This is returned when the stack is synthesized under the 'missing' attribute @@ -150,6 +162,7 @@ export class Stack extends Construct { this.logicalIds = new LogicalIDs(props && props.namingScheme ? props.namingScheme : new HashedAddressingScheme()); this.name = props.stackName !== undefined ? props.stackName : this.calculateStackName(); this.autoDeploy = props && props.autoDeploy === false ? false : true; + this.tags = new TagManager(TagType.KeyValue, "aws:cdk:stack", props.tags); if (!Stack.VALID_STACK_NAME_REGEX.test(this.name)) { throw new Error(`Stack name must match the regular expression: ${Stack.VALID_STACK_NAME_REGEX.toString()}, got '${name}'`); @@ -490,6 +503,10 @@ export class Stack extends Construct { } } } + + if (this.tags.hasTags()) { + this.node.addMetadata(cxapi.STACK_TAGS_METADATA_KEY, this.tags.renderTags()); + } } protected synthesize(builder: cxapi.CloudAssemblyBuilder): void { @@ -552,6 +569,7 @@ export class Stack extends Construct { visit(this); const app = this.parentApp(); + if (app && app.node.metadata.length > 0) { output[PATH_SEP] = app.node.metadata; } @@ -559,6 +577,7 @@ export class Stack extends Construct { return output; function visit(node: IConstruct) { + if (node.node.metadata.length > 0) { // Make the path absolute output[PATH_SEP + node.node.path] = node.node.metadata.map(md => node.node.resolve(md) as cxapi.MetadataEntry); @@ -664,8 +683,9 @@ function cfnElements(node: IConstruct, into: CfnElement[] = []): CfnElement[] { import { ArnComponents, arnFromComponents, parseArn } from './arn'; import { CfnElement } from './cfn-element'; import { CfnReference } from './cfn-reference'; -import { CfnResource } from './cfn-resource'; +import { CfnResource, TagType } from './cfn-resource'; import { Aws, ScopedAws } from './pseudo'; +import { ITaggable, TagManager } from './tag-manager'; /** * Find all resources in a set of constructs diff --git a/packages/@aws-cdk/cdk/lib/string-fragments.ts b/packages/@aws-cdk/cdk/lib/string-fragments.ts index 9ca8e2057dd96..f33caf2cd94ec 100644 --- a/packages/@aws-cdk/cdk/lib/string-fragments.ts +++ b/packages/@aws-cdk/cdk/lib/string-fragments.ts @@ -12,7 +12,7 @@ type IntrinsicFragment = { type: 'intrinsic'; value: any; }; type Fragment = LiteralFragment | TokenFragment | IntrinsicFragment; /** - * Fragments of a string with markers + * Fragments of a concatenated string containing stringified Tokens */ export class TokenizedStringFragments { private readonly fragments = new Array(); @@ -43,6 +43,22 @@ export class TokenizedStringFragments { this.fragments.push({ type: 'intrinsic', value }); } + /** + * Return all Tokens from this string + */ + public get tokens(): Token[] { + const ret = new Array(); + for (const f of this.fragments) { + if (f.type === 'token') { + ret.push(f.token); + } + } + return ret; + } + + /** + * Apply a transformation function to all tokens in the string + */ public mapTokens(mapper: ITokenMapper): TokenizedStringFragments { const ret = new TokenizedStringFragments(); diff --git a/packages/@aws-cdk/cdk/lib/tag-aspect.ts b/packages/@aws-cdk/cdk/lib/tag-aspect.ts index e6f373fffea92..d2f50ca7cd1f5 100644 --- a/packages/@aws-cdk/cdk/lib/tag-aspect.ts +++ b/packages/@aws-cdk/cdk/lib/tag-aspect.ts @@ -1,6 +1,7 @@ +// import cxapi = require('@aws-cdk/cx-api'); import { IAspect } from './aspect'; -import { CfnResource, ITaggable } from './cfn-resource'; import { IConstruct } from './construct'; +import { ITaggable, TagManager } from './tag-manager'; /** * Properties for a tag @@ -71,12 +72,8 @@ export abstract class TagBase implements IAspect { } public visit(construct: IConstruct): void { - if (!CfnResource.isCfnResource(construct)) { - return; - } - const resource = construct as CfnResource; - if (CfnResource.isTaggable(resource)) { - this.applyTag(resource); + if (TagManager.isTaggable(construct)) { + this.applyTag(construct); } } diff --git a/packages/@aws-cdk/cdk/lib/tag-manager.ts b/packages/@aws-cdk/cdk/lib/tag-manager.ts index 9a7b24da4ddfc..ed6a2e6504136 100644 --- a/packages/@aws-cdk/cdk/lib/tag-manager.ts +++ b/packages/@aws-cdk/cdk/lib/tag-manager.ts @@ -18,6 +18,10 @@ interface CfnAsgTag { propagateAtLaunch: boolean; } +interface StackTag { + Key: string; + Value: string; +} /** * Interface for converter between CloudFormation and internal tag representations */ @@ -142,6 +146,36 @@ class MapFormatter implements ITagFormatter { } } +/** + * StackTags are of the format { Key: key, Value: value } + */ +class KeyValueFormatter implements ITagFormatter { + public parseTags(keyValueTags: any, priority: number): Tag[] { + const tags: Tag[] = []; + for (const key in keyValueTags) { + if (keyValueTags.hasOwnProperty(key)) { + const value = keyValueTags[key]; + tags.push({ + key, + value, + priority + }); + } + } + return tags; + } + public formatTags(unformattedTags: Tag[]): any { + const tags: StackTag[] = []; + unformattedTags.forEach(tag => { + tags.push({ + Key: tag.key, + Value: tag.value + }); + }); + return tags; + } +} + class NoFormat implements ITagFormatter { public parseTags(_cfnPropertyTags: any): Tag[] { return []; @@ -155,13 +189,32 @@ const TAG_FORMATTERS: {[key: string]: ITagFormatter} = { [TagType.AutoScalingGroup]: new AsgFormatter(), [TagType.Standard]: new StandardFormatter(), [TagType.Map]: new MapFormatter(), + [TagType.KeyValue]: new KeyValueFormatter(), [TagType.NotTaggable]: new NoFormat(), }; +/** + * Interface to implement tags. + */ +export interface ITaggable { + /** + * TagManager to set, remove and format tags + */ + readonly tags: TagManager; +} + /** * TagManager facilitates a common implementation of tagging for Constructs. */ export class TagManager { + + /** + * Check whether the given construct is Taggable + */ + public static isTaggable(construct: any): construct is ITaggable { + return (construct as any).tags !== undefined; + } + private readonly tags = new Map(); private readonly priorities = new Map(); private readonly tagFormatter: ITagFormatter; @@ -217,6 +270,13 @@ export class TagManager { return true; } + /** + * Returns true if there are any tags defined + */ + public hasTags(): boolean { + return this.tags.size > 0; + } + private _setTag(...tags: Tag[]) { for (const tag of tags) { if (tag.priority >= (this.priorities.get(tag.key) || 0)) { diff --git a/packages/@aws-cdk/cdk/lib/token-map.ts b/packages/@aws-cdk/cdk/lib/token-map.ts index 9730cf0f063a4..0adb4ef31fb8a 100644 --- a/packages/@aws-cdk/cdk/lib/token-map.ts +++ b/packages/@aws-cdk/cdk/lib/token-map.ts @@ -1,5 +1,6 @@ import { BEGIN_LIST_TOKEN_MARKER, BEGIN_STRING_TOKEN_MARKER, createTokenDouble, END_TOKEN_MARKER, extractTokenDouble, TokenString, VALID_KEY_CHARS } from "./encoding"; +import { TokenizedStringFragments } from "./string-fragments"; import { Token } from "./token"; const glob = global as any; @@ -73,13 +74,20 @@ export class TokenMap { return createTokenDouble(tokenIndex); } + /** + * Split a string into literals and Tokens + */ + public splitString(s: string): TokenizedStringFragments { + const str = TokenString.forString(s); + return str.split(this.lookupToken.bind(this)); + } + /** * Reverse a string representation into a Token object */ public lookupString(s: string): Token | undefined { - const str = TokenString.forStringToken(s); - const fragments = str.split(this.lookupToken.bind(this)); - if (fragments.length === 1) { + const fragments = this.splitString(s); + if (fragments.tokens.length > 0 && fragments.length === 1) { return fragments.firstToken; } return undefined; diff --git a/packages/@aws-cdk/cdk/lib/token.ts b/packages/@aws-cdk/cdk/lib/token.ts index d7d64df131c61..bc4f3dca4e971 100644 --- a/packages/@aws-cdk/cdk/lib/token.ts +++ b/packages/@aws-cdk/cdk/lib/token.ts @@ -93,16 +93,16 @@ export class Token { * on the string. */ public toString(): string { - const valueType = typeof this.valueOrFunction; // Optimization: if we can immediately resolve this, don't bother - // registering a Token. - if (valueType === 'string' || valueType === 'number' || valueType === 'boolean') { - return this.valueOrFunction.toString(); + // registering a Token (unless it's already a token). + if (typeof(this.valueOrFunction) === 'string') { + return this.valueOrFunction; } if (this.tokenStringification === undefined) { this.tokenStringification = TokenMap.instance().registerString(this, this.displayName); } + return this.tokenStringification; } @@ -139,9 +139,8 @@ export class Token { * is constructing a `FnJoin` or a `FnSelect` on it. */ public toList(): string[] { - const valueType = typeof this.valueOrFunction; - if (valueType === 'string' || valueType === 'number' || valueType === 'boolean') { - throw this.newError('Got a literal Token value; only intrinsics can ever evaluate to lists.'); + if (Array.isArray(this.valueOrFunction)) { + return this.valueOrFunction; } if (this.tokenListification === undefined) { @@ -160,14 +159,13 @@ export class Token { * other operations can and probably will destroy the token-ness of the value. */ public toNumber(): number { + // Optimization: if we can immediately resolve this, don't bother + // registering a Token. + if (typeof(this.valueOrFunction) === 'number') { + return this.valueOrFunction; + } + if (this.tokenNumberification === undefined) { - const valueType = typeof this.valueOrFunction; - // Optimization: if we can immediately resolve this, don't bother - // registering a Token. - if (valueType === 'number') { return this.valueOrFunction; } - if (valueType !== 'function') { - throw this.newError(`Token value is not number or lazy, can't represent as number: ${this.valueOrFunction}`); - } this.tokenNumberification = TokenMap.instance().registerNumber(this); } diff --git a/packages/@aws-cdk/cdk/package-lock.json b/packages/@aws-cdk/cdk/package-lock.json index bbe4a2f77567e..262a407780c5d 100644 --- a/packages/@aws-cdk/cdk/package-lock.json +++ b/packages/@aws-cdk/cdk/package-lock.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/cdk", - "version": "0.32.0", + "version": "0.33.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/@aws-cdk/cdk/package.json b/packages/@aws-cdk/cdk/package.json index b3ecaa2a41a89..542fb3a61b6ca 100644 --- a/packages/@aws-cdk/cdk/package.json +++ b/packages/@aws-cdk/cdk/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/cdk", - "version": "0.32.0", + "version": "0.33.0", "description": "AWS Cloud Development Kit Core Library", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -36,6 +36,9 @@ "construct-ctor:@aws-cdk/cdk.App.", "construct-ctor:@aws-cdk/cdk.Root.", "construct-ctor:@aws-cdk/cdk.Stack..params*", + "props-no-any:@aws-cdk/cdk.CfnOutputProps.value", + "props-no-any:@aws-cdk/cdk.CfnParameterProps.default", + "props-no-any:@aws-cdk/cdk.CfnResourceProps.properties", "props-no-cfn-types:@aws-cdk/cdk.CfnOutputProps*", "props-no-cfn-types:@aws-cdk/cdk.StringListCfnOutputProps*" ] @@ -70,20 +73,20 @@ "license": "Apache-2.0", "devDependencies": { "@types/lodash": "^4.14.130", - "cdk-build-tools": "^0.32.0", - "cfn2ts": "^0.32.0", + "cdk-build-tools": "^0.33.0", + "cfn2ts": "^0.33.0", "fast-check": "^1.14.0", "lodash": "^4.17.11", - "pkglint": "^0.32.0" + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/cx-api": "^0.32.0" + "@aws-cdk/cx-api": "^0.33.0" }, "homepage": "https://github.com/awslabs/aws-cdk", "peerDependencies": { - "@aws-cdk/cx-api": "^0.32.0" + "@aws-cdk/cx-api": "^0.33.0" }, "engines": { "node": ">= 8.10.0" } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/cdk/test/test.construct.ts b/packages/@aws-cdk/cdk/test/test.construct.ts index b314b3b42f64e..8ae01847064e3 100644 --- a/packages/@aws-cdk/cdk/test/test.construct.ts +++ b/packages/@aws-cdk/cdk/test/test.construct.ts @@ -479,6 +479,47 @@ export = { test.ok(child2.node.root === root); test.ok(child1_1_1.node.root === root); test.done(); + }, + + 'defaultChild': { + 'returns the child with id "Resource"'(test: Test) { + const root = new Root(); + new Construct(root, 'child1'); + const defaultChild = new Construct(root, 'Resource'); + new Construct(root, 'child2'); + + test.same(root.node.defaultChild, defaultChild); + test.done(); + }, + 'returns the child with id "Default"'(test: Test) { + const root = new Root(); + new Construct(root, 'child1'); + const defaultChild = new Construct(root, 'Default'); + new Construct(root, 'child2'); + + test.same(root.node.defaultChild, defaultChild); + test.done(); + }, + 'returns "undefined" if there is no default'(test: Test) { + const root = new Root(); + new Construct(root, 'child1'); + new Construct(root, 'child2'); + + test.equal(root.node.defaultChild, undefined); + test.done(); + }, + 'fails if there are both "Resource" and "Default"'(test: Test) { + const root = new Root(); + new Construct(root, 'child1'); + new Construct(root, 'Default'); + new Construct(root, 'child2'); + new Construct(root, 'Resource'); + + test.throws(() => root.node.defaultChild, + /Cannot determine default child for . There is both a child with id "Resource" and id "Default"/); + test.done(); + + } } }; diff --git a/packages/@aws-cdk/cdk/test/test.resource.ts b/packages/@aws-cdk/cdk/test/test.resource.ts index 2cdcc03509aad..976186301d319 100644 --- a/packages/@aws-cdk/cdk/test/test.resource.ts +++ b/packages/@aws-cdk/cdk/test/test.resource.ts @@ -549,6 +549,38 @@ export = { test.done(); }, + 'overrides are applied after render'(test: Test) { + // GIVEN + class MyResource extends CfnResource { + public renderProperties() { + return { Fixed: 123 }; + } + } + const stack = new Stack(); + const cfn = new MyResource(stack, 'rr', { type: 'AWS::Resource::Type' }); + + // WHEN + cfn.addPropertyOverride('Boom', 'Hi'); + cfn.addOverride('Properties.Foo.Bar', 'Bar'); + + // THEN + test.deepEqual(stack._toCloudFormation(), { + Resources: { + rr: { + Type: 'AWS::Resource::Type', + Properties: { + Fixed: 123, + Boom: 'Hi', + Foo: { + Bar: 'Bar' + } + } + } + } + }); + test.done(); + }, + 'untypedPropertyOverrides': { 'can be used by derived classes to specify overrides before render()'(test: Test) { diff --git a/packages/@aws-cdk/cdk/test/test.tag-manager.ts b/packages/@aws-cdk/cdk/test/test.tag-manager.ts index dd9b1cb86e51e..05d4ee7c132f5 100644 --- a/packages/@aws-cdk/cdk/test/test.tag-manager.ts +++ b/packages/@aws-cdk/cdk/test/test.tag-manager.ts @@ -41,17 +41,24 @@ export = { 'when there are no tags': { '#renderTags() returns undefined'(test: Test) { const mgr = new TagManager(TagType.Standard, 'AWS::Resource::Type'); - test.deepEqual(mgr.renderTags(), undefined ); + test.deepEqual(mgr.renderTags(), undefined); test.done(); }, + '#hasTags() returns false'(test: Test) { + const mgr = new TagManager(TagType.Standard, 'AWS::Resource::Type'); + test.equal(mgr.hasTags(), false); + test.done(); + } }, - '#renderTags() handles standard, map, and ASG tag formats'(test: Test) { + '#renderTags() handles standard, map, keyValue, and ASG tag formats'(test: Test) { const tagged: TagManager[] = []; const standard = new TagManager(TagType.Standard, 'AWS::Resource::Type'); const asg = new TagManager(TagType.AutoScalingGroup, 'AWS::Resource::Type'); + const keyValue = new TagManager(TagType.KeyValue, 'AWS::Resource::Type'); const mapper = new TagManager(TagType.Map, 'AWS::Resource::Type'); tagged.push(standard); tagged.push(asg); + tagged.push(keyValue); tagged.push(mapper); for (const res of tagged) { res.setTag('foo', 'bar'); @@ -65,12 +72,23 @@ export = { {key: 'foo', value: 'bar', propagateAtLaunch: true}, {key: 'asg', value: 'only', propagateAtLaunch: false}, ]); + test.deepEqual(keyValue.renderTags(), [ + { Key: 'foo', Value : 'bar' }, + { Key: 'asg', Value : 'only' } + ]); test.deepEqual(mapper.renderTags(), { foo: 'bar', asg: 'only', }); test.done(); }, + 'when there are tags it hasTags returns true'(test: Test) { + const mgr = new TagManager(TagType.Standard, 'AWS::Resource::Type'); + mgr.setTag('key', 'myVal', 2); + mgr.setTag('key', 'newVal', 1); + test.equal(mgr.hasTags(), true); + test.done(); + }, 'tags with higher or equal priority always take precedence'(test: Test) { const mgr = new TagManager(TagType.Standard, 'AWS::Resource::Type'); mgr.setTag('key', 'myVal', 2); diff --git a/packages/@aws-cdk/cdk/test/test.tokens.ts b/packages/@aws-cdk/cdk/test/test.tokens.ts index 1ea25183712e6..845d9f389806a 100644 --- a/packages/@aws-cdk/cdk/test/test.tokens.ts +++ b/packages/@aws-cdk/cdk/test/test.tokens.ts @@ -467,7 +467,6 @@ export = { 'can number-encode and resolve Token objects'(test: Test) { // GIVEN - const stack = new Stack(); const x = new Token(() => 123); // THEN @@ -475,7 +474,7 @@ export = { test.equal(true, Token.isToken(encoded), 'encoded number does not test as token'); // THEN - const resolved = stack.node.resolve({ value: encoded }); + const resolved = resolve({ value: encoded }); test.deepEqual(resolved, { value: 123 }); test.done(); @@ -522,6 +521,91 @@ export = { const token = fn1(); test.throws(() => token.throwError('message!'), /Token created:/); test.done(); + }, + + 'type coercion': (() => { + const tests: any = { }; + + const inputs = [ + () => 'lazy', + 'a string', + 1234, + { an_object: 1234 }, + [ 1, 2, 3 ], + false + ]; + + for (const input of inputs) { + // GIVEN + const stringToken = new Token(input).toString(); + const numberToken = new Token(input).toNumber(); + const listToken = new Token(input).toList(); + + // THEN + const expected = typeof(input) === 'function' ? input() : input; + + tests[`${input}.toNumber()`] = (test: Test) => { + test.deepEqual(resolve(new Token(stringToken).toNumber()), expected); + test.done(); + }; + + tests[`${input}.toNumber()`] = (test: Test) => { + test.deepEqual(resolve(new Token(listToken).toNumber()), expected); + test.done(); + }; + + tests[`${input}.toNumber()`] = (test: Test) => { + test.deepEqual(resolve(new Token(numberToken).toNumber()), expected); + test.done(); + }; + + tests[`${input}.toString()`] = (test: Test) => { + test.deepEqual(resolve(new Token(stringToken).toString()), expected); + test.done(); + }; + + tests[`${input}.toString()`] = (test: Test) => { + test.deepEqual(resolve(new Token(listToken).toString()), expected); + test.done(); + }; + + tests[`${input}.toString()`] = (test: Test) => { + test.deepEqual(resolve(new Token(numberToken).toString()), expected); + test.done(); + }; + + tests[`${input}.toList()`] = (test: Test) => { + test.deepEqual(resolve(new Token(stringToken).toList()), expected); + test.done(); + }; + + tests[`${input}.toList()`] = (test: Test) => { + test.deepEqual(resolve(new Token(listToken).toList()), expected); + test.done(); + }; + + tests[`${input}.toList()`] = (test: Test) => { + test.deepEqual(resolve(new Token(numberToken).toList()), expected); + test.done(); + }; + } + + return tests; + })(), + + 'toXxx short circuts if the input is of the same type': { + 'toNumber(number)'(test: Test) { + test.deepEqual(new Token(123).toNumber(), 123); + test.done(); + }, + 'toList(list)'(test: Test) { + test.deepEqual(new Token([1, 2, 3]).toList(), [1, 2, 3]); + test.done(); + }, + 'toString(string)'(test: Test) { + test.deepEqual(new Token('string').toString(), 'string'), + test.done(); + } } }; diff --git a/packages/@aws-cdk/cfnspec/lib/augmentations/AWS_RDS_DBInstance.json b/packages/@aws-cdk/cfnspec/lib/augmentations/AWS_RDS_DBInstance.json new file mode 100644 index 0000000000000..d4e695ec82665 --- /dev/null +++ b/packages/@aws-cdk/cfnspec/lib/augmentations/AWS_RDS_DBInstance.json @@ -0,0 +1,37 @@ +{ + "options": { + "classFile": "instance", + "class": "DatabaseInstanceBase", + "interface": "IDatabaseInstance" + }, + "metrics": { + "namespace": "AWS/RDS", + "dimensions": { "DBInstanceIdentifier": "this.instanceIdentifier" }, + "metrics": [ + { + "name": "CPUUtilization", + "documentation": "The percentage of CPU utilization." + }, + { + "name": "DatabaseConnections", + "documentation": "The number of database connections in use." + }, + { + "name": "FreeStorageSpace", + "documentation": "The amount of available storage space." + }, + { + "name": "FreeableMemory", + "documentation": "The amount of available random access memory." + }, + { + "name": "WriteIOPS", + "documentation": "The average number of disk read I/O operations per second." + }, + { + "name": "ReadIOPS", + "documentation": "The average number of disk write I/O operations per second." + } + ] + } +} diff --git a/packages/@aws-cdk/cfnspec/package-lock.json b/packages/@aws-cdk/cfnspec/package-lock.json index 132755774b4cc..a9194edd513ff 100644 --- a/packages/@aws-cdk/cfnspec/package-lock.json +++ b/packages/@aws-cdk/cfnspec/package-lock.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/cfnspec", - "version": "0.32.0", + "version": "0.33.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/@aws-cdk/cfnspec/package.json b/packages/@aws-cdk/cfnspec/package.json index 78686e1adb968..bad0de59d604e 100644 --- a/packages/@aws-cdk/cfnspec/package.json +++ b/packages/@aws-cdk/cfnspec/package.json @@ -1,7 +1,7 @@ { "name": "@aws-cdk/cfnspec", "description": "The CloudFormation resource specification used by @aws-cdk packages", - "version": "0.32.0", + "version": "0.33.0", "scripts": { "update": "cdk-build && /bin/bash build-tools/update.sh", "build": "cdk-build && node build-tools/build", @@ -25,11 +25,11 @@ "devDependencies": { "@types/fs-extra": "^5.0.5", "@types/md5": "^2.1.33", - "cdk-build-tools": "^0.32.0", + "cdk-build-tools": "^0.33.0", "fast-json-patch": "^2.1.0", "fs-extra": "^7.0.1", "json-diff": "^0.5.4", - "pkglint": "^0.32.0", + "pkglint": "^0.33.0", "sort-json": "^2.0.0" }, "dependencies": { diff --git a/packages/@aws-cdk/cloudformation-diff/package-lock.json b/packages/@aws-cdk/cloudformation-diff/package-lock.json index 39e17480044fb..172ab40bec423 100644 --- a/packages/@aws-cdk/cloudformation-diff/package-lock.json +++ b/packages/@aws-cdk/cloudformation-diff/package-lock.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/cloudformation-diff", - "version": "0.32.0", + "version": "0.33.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/@aws-cdk/cloudformation-diff/package.json b/packages/@aws-cdk/cloudformation-diff/package.json index e243cfeb7d700..b0c9a9ce58024 100644 --- a/packages/@aws-cdk/cloudformation-diff/package.json +++ b/packages/@aws-cdk/cloudformation-diff/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/cloudformation-diff", - "version": "0.32.0", + "version": "0.33.0", "description": "Utilities to diff CDK stacks against CloudFormation templates", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -26,8 +26,8 @@ }, "license": "Apache-2.0", "dependencies": { - "@aws-cdk/cfnspec": "^0.32.0", - "@aws-cdk/cx-api": "^0.32.0", + "@aws-cdk/cfnspec": "^0.33.0", + "@aws-cdk/cx-api": "^0.33.0", "colors": "^1.3.3", "diff": "^4.0.1", "fast-deep-equal": "^2.0.1", @@ -38,9 +38,9 @@ "devDependencies": { "@types/string-width": "^4.0.1", "@types/table": "^4.0.5", - "cdk-build-tools": "^0.32.0", + "cdk-build-tools": "^0.33.0", "fast-check": "^1.14.0", - "pkglint": "^0.32.0" + "pkglint": "^0.33.0" }, "repository": { "url": "https://github.com/awslabs/aws-cdk.git", diff --git a/packages/@aws-cdk/cx-api/lib/cxapi.ts b/packages/@aws-cdk/cx-api/lib/cxapi.ts index 2a71c151eb0f3..e918c087d9d17 100644 --- a/packages/@aws-cdk/cx-api/lib/cxapi.ts +++ b/packages/@aws-cdk/cx-api/lib/cxapi.ts @@ -31,6 +31,8 @@ export const DISABLE_VERSION_REPORTING = 'aws:cdk:disable-version-reporting'; export const DISABLE_ASSET_STAGING_CONTEXT = 'aws:cdk:disable-asset-staging'; /** + * If this context key is set, the CDK will stage assets under the specified + * directory. Otherwise, assets will not be staged. * Omits stack traces from construct metadata entries. */ export const DISABLE_METADATA_STACK_TRACE = 'aws:cdk:disable-stack-trace'; diff --git a/packages/@aws-cdk/cx-api/lib/metadata.ts b/packages/@aws-cdk/cx-api/lib/metadata.ts index 25e0f730105a4..49957c3d1403e 100644 --- a/packages/@aws-cdk/cx-api/lib/metadata.ts +++ b/packages/@aws-cdk/cx-api/lib/metadata.ts @@ -19,6 +19,11 @@ export const ERROR_METADATA_KEY = 'aws:cdk:error'; */ export const PATH_METADATA_KEY = 'aws:cdk:path'; +/** + * Tag metadata key. + */ +export const STACK_TAGS_METADATA_KEY = 'aws:cdk:stack-tags'; + export enum SynthesisMessageLevel { INFO = 'info', WARNING = 'warning', diff --git a/packages/@aws-cdk/cx-api/package-lock.json b/packages/@aws-cdk/cx-api/package-lock.json index 07a807238d5a5..2c115f48c3deb 100644 --- a/packages/@aws-cdk/cx-api/package-lock.json +++ b/packages/@aws-cdk/cx-api/package-lock.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/cx-api", - "version": "0.32.0", + "version": "0.33.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/@aws-cdk/cx-api/package.json b/packages/@aws-cdk/cx-api/package.json index a3ed181c6fecc..a83d665dcc411 100644 --- a/packages/@aws-cdk/cx-api/package.json +++ b/packages/@aws-cdk/cx-api/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/cx-api", - "version": "0.32.0", + "version": "0.33.0", "description": "Cloud executable protocol", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -58,11 +58,11 @@ }, "license": "Apache-2.0", "devDependencies": { - "cdk-build-tools": "^0.32.0", "@types/jest": "^24.0.11", "@types/semver": "^6.0.0", - "pkglint": "^0.32.0", - "jest": "^24.7.1" + "cdk-build-tools": "^0.33.0", + "jest": "^24.7.1", + "pkglint": "^0.33.0" }, "repository": { "url": "https://github.com/awslabs/aws-cdk.git", diff --git a/packages/@aws-cdk/region-info/package-lock.json b/packages/@aws-cdk/region-info/package-lock.json index 9ec348f7eb6f8..42be17e511514 100644 --- a/packages/@aws-cdk/region-info/package-lock.json +++ b/packages/@aws-cdk/region-info/package-lock.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/region-info", - "version": "0.32.0", + "version": "0.33.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/@aws-cdk/region-info/package.json b/packages/@aws-cdk/region-info/package.json index b7f7de8cf4bbb..07eeedb6b681a 100644 --- a/packages/@aws-cdk/region-info/package.json +++ b/packages/@aws-cdk/region-info/package.json @@ -1,6 +1,6 @@ { "name": "@aws-cdk/region-info", - "version": "0.32.0", + "version": "0.33.0", "description": "AWS region information, such as service principal names", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -50,9 +50,9 @@ "license": "Apache-2.0", "devDependencies": { "@types/fs-extra": "^5.0.5", - "cdk-build-tools": "^0.32.0", + "cdk-build-tools": "^0.33.0", "fs-extra": "^7.0.1", - "pkglint": "^0.32.0" + "pkglint": "^0.33.0" }, "jest": { "coverageReporters": [ diff --git a/packages/@aws-cdk/runtime-values/README.md b/packages/@aws-cdk/runtime-values/README.md index e572b79123624..0adc80ef796fe 100644 --- a/packages/@aws-cdk/runtime-values/README.md +++ b/packages/@aws-cdk/runtime-values/README.md @@ -1,54 +1,4 @@ ## Runtime Values -The CDK allows apps to advertise values from __construction time__ to __runtime -code__. For example, consider code in a Lambda function which needs to know the -URL of the SQS queue created as part of your CDK app. +This module has been deprecated. Use environment variables or SSM parameters to publish values to runtime code. -Runtime values are advertised as textual SSM parameters with the following key: - -``` -/rtv/// -``` - -Therefore, in order to advertise a value you will need to: - -1. Make the current stack name available as an environment variable to your - runtime code. The convention is to use `RTV_STACK_NAME`. -2. Use the `RuntimeValue` construct in order to create the SSM parameter and - specify least-privilege permissions. - -For example, say we want to publish a queue's URL to a lambda function. - -### Construction Code - -```ts -import { RuntimeValue } from '@aws-cdk/runtime-values' - -const queue = new Queue(this, 'MyQueue', { /* props.... */ }); -const fn = new Lambda(this, 'MyFunction', { /* props... */ }); -const fleet = new Fleet(this, 'MyFleet', { /* props... */ }); - -// this line defines an AWS::SSM::Parameter resource with the -// key "/rtv//com.myorg/MyQueueURL" and the actual queue URL as value -const queueUrlRtv = new RuntimeValue(this, 'QueueRTV', { - package: 'com.myorg', - name: 'MyQueueURL', - value: queue.queueUrl -}); - -// this line adds read permissions for this SSM parameter to the policies associated with -// the IAM roles of the Lambda function and the EC2 fleet -queueUrlRtv.grantRead(fn.role); -queueUrlRtv.grantRead(fleet.role); - -// adds the `RTV_STACK_NAME` to the environment of the lambda function -// and the fleet (via user-data) -fn.env(RuntimeValue.ENV_NAME, RuntimeValue.ENV_VALUE); -fleet.env(RuntimeValue.ENV_NAME, RuntimeValue.ENV_VALUE); -``` - -### Runtime Code - -Then, your runtime code will need to use the SSM Parameter Store AWS SDK in -order to format the SSM parameter key and read the value. In future releases, we -will provide runtime libraries to make this easy. diff --git a/packages/@aws-cdk/runtime-values/lib/index.ts b/packages/@aws-cdk/runtime-values/lib/index.ts index 9b879b15fee5c..305f9aaf4ccb1 100644 --- a/packages/@aws-cdk/runtime-values/lib/index.ts +++ b/packages/@aws-cdk/runtime-values/lib/index.ts @@ -1 +1,2 @@ -export * from './rtv'; +// tslint:disable-next-line:no-console +console.error(`ERROR: @aws-cdk/runtime-values is deprecated`); diff --git a/packages/@aws-cdk/runtime-values/lib/rtv.ts b/packages/@aws-cdk/runtime-values/lib/rtv.ts deleted file mode 100644 index 89584c5c72271..0000000000000 --- a/packages/@aws-cdk/runtime-values/lib/rtv.ts +++ /dev/null @@ -1,85 +0,0 @@ -import iam = require('@aws-cdk/aws-iam'); -import ssm = require('@aws-cdk/aws-ssm'); -import cdk = require('@aws-cdk/cdk'); - -export interface RuntimeValueProps { - /** - * A namespace for the runtime value. - * It is recommended to use the name of the library/package that advertises this value. - */ - readonly package: string; - - /** - * The value to advertise. Can be either a primitive value or a token. - */ - readonly value: any; -} - -/** - * Defines a value published from construction code which needs to be accessible - * by runtime code. - */ -export class RuntimeValue extends cdk.Construct { - - /** - * The recommended name of the environment variable to use to set the stack name - * from which the runtime value is published. - */ - public static readonly ENV_NAME = 'RTV_STACK_NAME'; - - /** - * IAM actions needed to read a value from an SSM parameter. - */ - private static readonly SSM_READ_ACTIONS = [ - 'ssm:DescribeParameters', - 'ssm:GetParameters', - 'ssm:GetParameter' - ]; - - /** - * The value to assign to the `RTV_STACK_NAME` environment variable. - */ - public readonly envValue: string; - - /** - * The name of the runtime parameter. - */ - public readonly parameterName: string; - - /** - * The ARN fo the SSM parameter used for this runtime value. - */ - public readonly parameterArn: string; - - constructor(scope: cdk.Construct, id: string, props: RuntimeValueProps) { - super(scope, id); - - this.parameterName = `/rtv/${this.node.stack.stackName}/${props.package}/${id}`; - this.envValue = this.node.stack.stackName; - - new ssm.CfnParameter(this, 'Parameter', { - name: this.parameterName, - type: 'String', - value: props.value, - }); - - this.parameterArn = this.node.stack.formatArn({ - service: 'ssm', - resource: 'parameter', - resourceName: this.parameterName - }); - } - - /** - * Grants a principal read permissions on this runtime value. - * @param grantee The principal (e.g. Role, User, Group) - */ - public grantRead(grantee: iam.IGrantable) { - return iam.Grant.addToPrincipal({ - grantee, - resourceArns: [this.parameterArn], - actions: RuntimeValue.SSM_READ_ACTIONS - - }); - } -} diff --git a/packages/@aws-cdk/runtime-values/package.json b/packages/@aws-cdk/runtime-values/package.json index 4ab2983f3aa99..93b218c56ef3a 100644 --- a/packages/@aws-cdk/runtime-values/package.json +++ b/packages/@aws-cdk/runtime-values/package.json @@ -1,7 +1,8 @@ { "name": "@aws-cdk/runtime-values", - "version": "0.32.0", + "version": "0.33.0", "description": "Runtime values support for the AWS CDK", + "deprecated": "This module has been deprecated. Use environment variables or SSM parameters to publish values to runtime code", "main": "lib/index.js", "types": "lib/index.d.ts", "jsii": { @@ -55,26 +56,16 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/assert": "^0.32.0", - "@aws-cdk/aws-ec2": "^0.32.0", - "@aws-cdk/aws-lambda": "^0.32.0", - "@aws-cdk/aws-sqs": "^0.32.0", - "cdk-build-tools": "^0.32.0", - "cdk-integ-tools": "^0.32.0", - "pkglint": "^0.32.0" - }, - "dependencies": { - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/aws-ssm": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0" + "cdk-build-tools": "^0.33.0", + "pkglint": "^0.33.0" }, "homepage": "https://github.com/awslabs/aws-cdk", - "peerDependencies": { - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/aws-ssm": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0" - }, "engines": { "node": ">= 8.10.0" + }, + "awslint": { + "exclude": [ + "props-no-any:@aws-cdk/runtime-values.RuntimeValueProps.value" + ] } -} +} \ No newline at end of file diff --git a/packages/@aws-cdk/runtime-values/test/integ.rtv.lambda.expected.json b/packages/@aws-cdk/runtime-values/test/integ.rtv.lambda.expected.json deleted file mode 100644 index 0875ed9d70338..0000000000000 --- a/packages/@aws-cdk/runtime-values/test/integ.rtv.lambda.expected.json +++ /dev/null @@ -1,144 +0,0 @@ -{ - "Resources": { - "MyQueueE6CA6235": { - "Type": "AWS::SQS::Queue" - }, - "MyFunctionServiceRole3C357FF2": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": "sts:AssumeRole", - "Effect": "Allow", - "Principal": { - "Service": { - "Fn::Join": [ - "", - [ - "lambda.", - { - "Ref": "AWS::URLSuffix" - } - ] - ] - } - } - } - ], - "Version": "2012-10-17" - }, - "ManagedPolicyArns": [ - { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" - ] - ] - } - ] - } - }, - "MyFunctionServiceRoleDefaultPolicyB705ABD4": { - "Type": "AWS::IAM::Policy", - "Properties": { - "PolicyDocument": { - "Statement": [ - { - "Action": [ - "ssm:DescribeParameters", - "ssm:GetParameters", - "ssm:GetParameter" - ], - "Effect": "Allow", - "Resource": { - "Fn::Join": [ - "", - [ - "arn:", - { - "Ref": "AWS::Partition" - }, - ":ssm:", - { - "Ref": "AWS::Region" - }, - ":", - { - "Ref": "AWS::AccountId" - }, - ":parameter//rtv/", - { - "Ref": "AWS::StackName" - }, - "/com.myorg/MyQueueURL" - ] - ] - } - } - ], - "Version": "2012-10-17" - }, - "PolicyName": "MyFunctionServiceRoleDefaultPolicyB705ABD4", - "Roles": [ - { - "Ref": "MyFunctionServiceRole3C357FF2" - } - ] - } - }, - "MyFunction3BAA72D1": { - "Type": "AWS::Lambda::Function", - "Properties": { - "Code": { - "ZipFile": "exports.handler = function runtimeCode(_event, _context, callback) {\n return callback();\n}" - }, - "Handler": "index.handler", - "Role": { - "Fn::GetAtt": [ - "MyFunctionServiceRole3C357FF2", - "Arn" - ] - }, - "Runtime": "nodejs8.10", - "Environment": { - "Variables": { - "RTV_STACK_NAME": { - "Ref": "AWS::StackName" - } - } - } - }, - "DependsOn": [ - "MyFunctionServiceRoleDefaultPolicyB705ABD4", - "MyFunctionServiceRole3C357FF2" - ] - }, - "MyQueueURLParameterA4918D6E": { - "Type": "AWS::SSM::Parameter", - "Properties": { - "Type": "String", - "Value": { - "Ref": "MyQueueE6CA6235" - }, - "Name": { - "Fn::Join": [ - "", - [ - "/rtv/", - { - "Ref": "AWS::StackName" - }, - "/com.myorg/MyQueueURL" - ] - ] - } - } - } - } -} \ No newline at end of file diff --git a/packages/@aws-cdk/runtime-values/test/integ.rtv.lambda.ts b/packages/@aws-cdk/runtime-values/test/integ.rtv.lambda.ts deleted file mode 100644 index 0475813b94228..0000000000000 --- a/packages/@aws-cdk/runtime-values/test/integ.rtv.lambda.ts +++ /dev/null @@ -1,42 +0,0 @@ -import lambda = require('@aws-cdk/aws-lambda'); -import sqs = require('@aws-cdk/aws-sqs'); -import cdk = require('@aws-cdk/cdk'); -import { RuntimeValue } from '../lib'; - -function runtimeCode(_event: any, _context: any, callback: any) { - return callback(); -} - -class TestStack extends cdk.Stack { - constructor(scope: cdk.App, id: string) { - super(scope, id); - - const queue = new sqs.Queue(this, 'MyQueue'); - const fn = new lambda.Function(this, 'MyFunction', { - code: lambda.Code.inline(`exports.handler = ${runtimeCode.toString()}`), - runtime: lambda.Runtime.NodeJS810, - handler: 'index.handler' - }); - - // this line defines an AWS::SSM::Parameter resource with the - // key "/rtv//com.myorg/MyQueueURL" and the actual queue URL as value - const queueUrlRtv = new RuntimeValue(this, 'MyQueueURL', { - package: 'com.myorg', - value: queue.queueUrl - }); - - // this line adds read permissions for this SSM parameter to the policies associated with - // the IAM roles of the Lambda function and the EC2 fleet - queueUrlRtv.grantRead(fn); - - // adds the `RTV_STACK_NAME` to the environment of the lambda function - // and the fleet (via user-data) - fn.addEnvironment(RuntimeValue.ENV_NAME, queueUrlRtv.envValue); - } -} - -const app = new cdk.App(); - -new TestStack(app, 'aws-cdk-rtv-lambda'); - -app.run(); diff --git a/packages/@aws-cdk/runtime-values/test/test.rtv.ts b/packages/@aws-cdk/runtime-values/test/test.rtv.ts deleted file mode 100644 index fedb2d533cff0..0000000000000 --- a/packages/@aws-cdk/runtime-values/test/test.rtv.ts +++ /dev/null @@ -1,59 +0,0 @@ -import iam = require('@aws-cdk/aws-iam'); -import lambda = require('@aws-cdk/aws-lambda'); -import sqs = require('@aws-cdk/aws-sqs'); -import cdk = require('@aws-cdk/cdk'); -import { Test } from 'nodeunit'; -import { RuntimeValue } from '../lib'; - -// tslint:disable:no-console - -export = { - 'RuntimeValue is awesome'(test: Test) { - const stack = new cdk.Stack(); - - new RuntimeValueTest(stack, 'RuntimeValue'); - - test.done(); - } -}; - -class RuntimeValueTest extends cdk.Construct { - - constructor(scope: cdk.Construct, id: string) { - super(scope, id); - - const queue = new sqs.CfnQueue(this, 'Queue', {}); - - const role = new iam.Role(this, 'Role', { - assumedBy: new iam.ServicePrincipal('lambda.amazonaws.com'), - }); - - new lambda.CfnFunction(this, 'Function', { - runtime: 'nodejs8.10', - handler: 'index.handler', - code: { - zipFile: ` - exports.handler = function(event, context, callback) { - callback(undefined, "success"); - } - ` - }, - role: role.roleArn, - environment: { - variables: { - [RuntimeValue.ENV_NAME]: this.node.stack.stackName, - } - } - }); - - // used as a namespace to avoid collisions - const RTV_PACKAGE = 'com.amazonaws.rtvtest'; - - const runtimeValues = [ - new RuntimeValue(this, 'MyQueueURL', { package: RTV_PACKAGE, value: queue.ref }), - new RuntimeValue(this, 'MyQueueName', { package: RTV_PACKAGE, value: queue.queueName }) - ]; - - runtimeValues.forEach(rtv => rtv.grantRead(role)); - } -} diff --git a/packages/aws-cdk/bin/cdk.ts b/packages/aws-cdk/bin/cdk.ts index 514ed9476de3f..dc65005ad76c3 100644 --- a/packages/aws-cdk/bin/cdk.ts +++ b/packages/aws-cdk/bin/cdk.ts @@ -45,7 +45,7 @@ async function parseCommandLineArguments() { .option('asset-metadata', { type: 'boolean', desc: 'Include "aws:asset:*" CloudFormation metadata for resources that user assets (enabled by default)', default: true }) .option('role-arn', { type: 'string', alias: 'r', desc: 'ARN of Role to use when invoking CloudFormation', default: undefined, requiresArg: true }) .option('toolkit-stack-name', { type: 'string', desc: 'The name of the CDK toolkit stack', requiresArg: true }) - .option('staging', { type: 'boolean', desc: 'copy assets to the output directory (use --no-staging to disable)', default: true }) + .option('staging', { type: 'boolean', desc: 'copy assets to the output directory (use --no-staging to disable, needed for local debugging the source files with SAM CLI)', default: true }) .option('output', { type: 'string', alias: 'o', desc: 'emits the synthesized cloud assembly into a directory (default: cdk.out)', requiresArg: true }) .command([ 'list', 'ls' ], 'Lists all stacks in the app', yargs => yargs .option('long', { type: 'boolean', default: false, alias: 'l', desc: 'display environment information for each stack' })) @@ -58,6 +58,7 @@ async function parseCommandLineArguments() { .option('exclusively', { type: 'boolean', alias: 'e', desc: 'only deploy requested stacks, don\'t include dependencies' }) .option('require-approval', { type: 'string', choices: [RequireApproval.Never, RequireApproval.AnyChange, RequireApproval.Broadening], desc: 'what security-sensitive changes need manual approval' })) .option('ci', { type: 'boolean', desc: 'Force CI detection. Use --no-ci to disable CI autodetection.', default: process.env.CI !== undefined }) + .option('tags', { type: 'array', alias: 't', desc: 'tags to add to the stack (KEY=VALUE)', nargs: 1, requiresArg: true }) .command('destroy [STACKS..]', 'Destroy the stack(s) named STACKS', yargs => yargs .option('exclusively', { type: 'boolean', alias: 'x', desc: 'only deploy requested stacks, don\'t include dependees' }) .option('force', { type: 'boolean', alias: 'f', desc: 'Do not ask for confirmation before destroying the stacks' })) @@ -99,7 +100,6 @@ async function initCommandLine() { proxyAddress: argv.proxy, ec2creds: argv.ec2creds, }); - const configuration = new Configuration(argv); await configuration.load(); @@ -198,7 +198,8 @@ async function initCommandLine() { roleArn: args.roleArn, requireApproval: configuration.settings.get(['requireApproval']), ci: args.ci, - reuseAssets: args['build-exclude'] + reuseAssets: args['build-exclude'], + tags: configuration.settings.get(['tags']) }); case 'destroy': diff --git a/packages/aws-cdk/lib/api/cxapp/exec.ts b/packages/aws-cdk/lib/api/cxapp/exec.ts index 642bf11c7fcf0..c0d987a65d4f6 100644 --- a/packages/aws-cdk/lib/api/cxapp/exec.ts +++ b/packages/aws-cdk/lib/api/cxapp/exec.ts @@ -147,14 +147,6 @@ function appToArray(app: any) { type CommandGenerator = (file: string) => string[]; -/** - * Direct execution of a YAML file, assume that we're deploying an Applet - */ -function executeApplet(appletFile: string): string[] { - const appletBinary = path.resolve(require.resolve('@aws-cdk/applet-js')); - return [process.execPath, appletBinary, appletFile]; -} - /** * Execute the given file with the same 'node' process as is running the current process */ @@ -166,8 +158,6 @@ function executeNode(scriptFile: string): string[] { * Mapping of extensions to command-line generators */ const EXTENSION_MAP = new Map([ - ['.yml', executeApplet], - ['.yaml', executeApplet], ['.js', executeNode], ]); diff --git a/packages/aws-cdk/lib/api/cxapp/stacks.ts b/packages/aws-cdk/lib/api/cxapp/stacks.ts index 5117240eff68e..f0691bc85edc9 100644 --- a/packages/aws-cdk/lib/api/cxapp/stacks.ts +++ b/packages/aws-cdk/lib/api/cxapp/stacks.ts @@ -62,6 +62,7 @@ export interface AppStacksProps { * In a class because it shares some global state */ export class AppStacks { + /** * Since app execution basically always synthesizes all the stacks, * we can invoke it once and cache the response for subsequent calls. @@ -233,6 +234,21 @@ export class AppStacks { } } + /** + * Returns and array with the tags available in the stack metadata. + */ + public getTagsFromStackMetadata(stack: cxapi.CloudFormationStackArtifact): Tag[] { + for (const id of Object.keys(stack.metadata)) { + const metadata = stack.metadata[id]; + for (const entry of metadata) { + if (entry.type === cxapi.STACK_TAGS_METADATA_KEY) { + return entry.data; + } + } + } + return []; + } + /** * Extracts 'aws:cdk:warning|info|error' metadata entries from the stack synthesis */ @@ -368,3 +384,15 @@ function includeUpstreamStacks( print('Including dependency stacks: %s', colors.bold(added.join(', '))); } } + +export interface SelectedStack extends cxapi.CloudFormationStackArtifact { + /** + * The original name of the stack before renaming + */ + originalName: string; +} + +export interface Tag { + readonly Key: string; + readonly Value: string; +} diff --git a/packages/aws-cdk/lib/api/deploy-stack.ts b/packages/aws-cdk/lib/api/deploy-stack.ts index b340606641531..c008bab26e036 100644 --- a/packages/aws-cdk/lib/api/deploy-stack.ts +++ b/packages/aws-cdk/lib/api/deploy-stack.ts @@ -2,6 +2,7 @@ import cxapi = require('@aws-cdk/cx-api'); import aws = require('aws-sdk'); import colors = require('colors/safe'); import uuid = require('uuid'); +import { Tag } from "../api/cxapp/stacks"; import { prepareAssets } from '../assets'; import { debug, error, print } from '../logging'; import { toYAML } from '../serialize'; @@ -32,6 +33,7 @@ export interface DeployStackOptions { quiet?: boolean; ci?: boolean; reuseAssets?: string[]; + tags?: Tag[]; } const LARGE_TEMPLATE_SIZE_KB = 50; @@ -73,7 +75,8 @@ export async function deployStack(options: DeployStackOptions): Promise { - return await getCLICompatibleDefaultRegion(this.profile); + return await getCLICompatibleDefaultRegionGetter(this.profile)(); } public defaultAccount(): Promise { @@ -226,7 +226,7 @@ class DefaultAWSAccount { constructor( private readonly defaultCredentialsProvider: Promise, - private readonly region: Promise) { + private readonly region: () => Promise) { } /** @@ -258,7 +258,7 @@ class DefaultAWSAccount { const accountId = await this.accountCache.fetch(creds.accessKeyId, async () => { // if we don't have one, resolve from STS and store in cache. debug('Looking up default account ID from STS'); - const result = await new AWS.STS({ credentials: creds, region: await this.region }).getCallerIdentity().promise(); + const result = await new AWS.STS({ credentials: creds, region: await this.region() }).getCallerIdentity().promise(); const aid = result.Account; if (!aid) { debug('STS didn\'t return an account ID'); @@ -333,31 +333,43 @@ async function makeCLICompatibleCredentialProvider(profile: string | undefined, * SDK does not allow us to specify a profile at runtime). * - AWS_DEFAULT_PROFILE and AWS_DEFAULT_REGION are also used as environment * variables to be used to determine the region. + * + * Returns a function that can be invoked to retrieve the actual region value + * (used to be just a promise, but that would lead to firing off a failing + * operation and if it was never awaited NodeJS would complain). */ -async function getCLICompatibleDefaultRegion(profile: string | undefined): Promise { - profile = profile || process.env.AWS_PROFILE || process.env.AWS_DEFAULT_PROFILE || 'default'; - - // Defaults inside constructor - const toCheck = [ - {filename: process.env.AWS_SHARED_CREDENTIALS_FILE }, - {isConfig: true, filename: process.env.AWS_CONFIG_FILE}, - ]; - - let region = process.env.AWS_REGION || process.env.AMAZON_REGION || - process.env.AWS_DEFAULT_REGION || process.env.AMAZON_DEFAULT_REGION; +function getCLICompatibleDefaultRegionGetter(profile: string | undefined): () => Promise { + let retrieved = false; + let region: string | undefined; + return async () => { + if (!retrieved) { + profile = profile || process.env.AWS_PROFILE || process.env.AWS_DEFAULT_PROFILE || 'default'; + + // Defaults inside constructor + const toCheck = [ + {filename: process.env.AWS_SHARED_CREDENTIALS_FILE }, + {isConfig: true, filename: process.env.AWS_CONFIG_FILE}, + ]; + + region = process.env.AWS_REGION || process.env.AMAZON_REGION || + process.env.AWS_DEFAULT_REGION || process.env.AMAZON_DEFAULT_REGION; + + while (!region && toCheck.length > 0) { + const configFile = new SharedIniFile(toCheck.shift()); + const section = await configFile.getProfile(profile); + region = section && section.region; + } - while (!region && toCheck.length > 0) { - const configFile = new SharedIniFile(toCheck.shift()); - const section = await configFile.getProfile(profile); - region = section && section.region; - } + if (!region) { + const usedProfile = !profile ? '' : ` (profile: "${profile}")`; + debug(`Unable to determine AWS region from environment or AWS configuration${usedProfile}`); + } - if (!region) { - const usedProfile = !profile ? '' : ` (profile: "${profile}")`; - throw new Error(`Unable to determine AWS region from environment or AWS configuration${usedProfile}`); - } + retrieved = true; + } - return region; + return region; + }; } /** diff --git a/packages/aws-cdk/lib/cdk-toolkit.ts b/packages/aws-cdk/lib/cdk-toolkit.ts index 3087ded295671..5ca800ed07690 100644 --- a/packages/aws-cdk/lib/cdk-toolkit.ts +++ b/packages/aws-cdk/lib/cdk-toolkit.ts @@ -1,7 +1,7 @@ import colors = require('colors/safe'); import fs = require('fs-extra'); import { format } from 'util'; -import { AppStacks, ExtendedStackSelection } from "./api/cxapp/stacks"; +import { AppStacks, ExtendedStackSelection, Tag } from "./api/cxapp/stacks"; import { IDeploymentTarget } from './api/deployment-target'; import { printSecurityDiff, printStackDiff, RequireApproval } from './diff'; import { data, error, highlight, print, success } from './logging'; @@ -108,6 +108,10 @@ export class CdkToolkit { print('%s: deploying...', colors.bold(stack.name)); } + if (!options.tags || options.tags.length === 0) { + options.tags = this.appStacks.getTagsFromStackMetadata(stack); + } + try { const result = await this.provisioner.deployStack({ stack, @@ -116,6 +120,7 @@ export class CdkToolkit { ci: options.ci, toolkitStackName: options.toolkitStackName, reuseAssets: options.reuseAssets, + tags: options.tags }); const message = result.noOp @@ -229,4 +234,9 @@ export interface DeployOptions { * Reuse the assets with the given asset IDs */ reuseAssets?: string[]; + + /** + * Tags to pass to CloudFormation for deployment + */ + tags?: Tag[]; } diff --git a/packages/aws-cdk/lib/init-templates/app/java/src/test/java/com/myorg/HelloStackTest.java b/packages/aws-cdk/lib/init-templates/app/java/src/test/java/com/myorg/HelloStackTest.java index 4241fcad3e84f..3cdae8f875eee 100644 --- a/packages/aws-cdk/lib/init-templates/app/java/src/test/java/com/myorg/HelloStackTest.java +++ b/packages/aws-cdk/lib/init-templates/app/java/src/test/java/com/myorg/HelloStackTest.java @@ -21,7 +21,7 @@ public void testStack() throws IOException { // synthesize the stack to a CloudFormation template and compare against // a checked-in JSON file. - JsonNode actual = JSON.valueToTree(app.synthesizeStack(stack.getName()).getTemplate()); + JsonNode actual = JSON.valueToTree(app.run().getStack(stack.getName()).getTemplate()); JsonNode expected = JSON.readTree(getClass().getResource("expected.cfn.json")); assertEquals(expected, actual); } diff --git a/packages/aws-cdk/lib/init-templates/app/typescript/tsconfig.json b/packages/aws-cdk/lib/init-templates/app/typescript/tsconfig.json index d9bfe5b88035e..361f1d43d0b81 100644 --- a/packages/aws-cdk/lib/init-templates/app/typescript/tsconfig.json +++ b/packages/aws-cdk/lib/init-templates/app/typescript/tsconfig.json @@ -17,5 +17,6 @@ "inlineSources": true, "experimentalDecorators": true, "strictPropertyInitialization":false - } + }, + "exclude": ["cdk.out"] } diff --git a/packages/aws-cdk/lib/init-templates/lib/typescript/tsconfig.json b/packages/aws-cdk/lib/init-templates/lib/typescript/tsconfig.json index b25d765385512..0e9917a82c78b 100644 --- a/packages/aws-cdk/lib/init-templates/lib/typescript/tsconfig.json +++ b/packages/aws-cdk/lib/init-templates/lib/typescript/tsconfig.json @@ -17,6 +17,7 @@ "inlineSources": true, "experimentalDecorators": true, "strictPropertyInitialization":false - } + }, + "exclude": ["cdk.out"] } diff --git a/packages/aws-cdk/lib/init-templates/sample-app/javascript/tsconfig.json b/packages/aws-cdk/lib/init-templates/sample-app/javascript/tsconfig.json index 394d006e36fa0..ed6d1dff27204 100644 --- a/packages/aws-cdk/lib/init-templates/sample-app/javascript/tsconfig.json +++ b/packages/aws-cdk/lib/init-templates/sample-app/javascript/tsconfig.json @@ -20,5 +20,6 @@ "allowJs": true, "checkJs": true, "noEmit": true - } + }, + "exclude": ["cdk.out"] } diff --git a/packages/aws-cdk/lib/init-templates/sample-app/typescript/tsconfig.json b/packages/aws-cdk/lib/init-templates/sample-app/typescript/tsconfig.json index d9bfe5b88035e..361f1d43d0b81 100644 --- a/packages/aws-cdk/lib/init-templates/sample-app/typescript/tsconfig.json +++ b/packages/aws-cdk/lib/init-templates/sample-app/typescript/tsconfig.json @@ -17,5 +17,6 @@ "inlineSources": true, "experimentalDecorators": true, "strictPropertyInitialization":false - } + }, + "exclude": ["cdk.out"] } diff --git a/packages/aws-cdk/lib/settings.ts b/packages/aws-cdk/lib/settings.ts index 90c72f714c861..640cc93cf04a7 100644 --- a/packages/aws-cdk/lib/settings.ts +++ b/packages/aws-cdk/lib/settings.ts @@ -2,6 +2,7 @@ import fs = require('fs-extra'); import os = require('os'); import fs_path = require('path'); import yargs = require('yargs'); +import { Tag } from './api/cxapp/stacks'; import { debug, warning } from './logging'; import util = require('./util'); @@ -184,32 +185,21 @@ export class Context { * A single bag of settings */ export class Settings { + /** * Parse Settings out of CLI arguments. * @param argv the received CLI arguments. * @returns a new Settings object. */ public static fromCommandLineArguments(argv: yargs.Arguments): Settings { - const context: any = {}; - - // Turn list of KEY=VALUE strings into an object - for (const assignment of ((argv as any).context || [])) { - const parts = assignment.split('=', 2); - if (parts.length === 2) { - debug('CLI argument context: %s=%s', parts[0], parts[1]); - if (parts[0].match(/^aws:.+/)) { - throw new Error(`User-provided context cannot use keys prefixed with 'aws:', but ${parts[0]} was provided.`); - } - context[parts[0]] = parts[1]; - } else { - warning('Context argument is not an assignment (key=value): %s', assignment); - } - } + const context = this.parseStringContextListToObject(argv); + const tags = this.parseStringTagsListToObject(argv); return new Settings({ app: argv.app, browser: argv.browser, context, + tags, language: argv.language, pathMetadata: argv.pathMetadata, assetMetadata: argv.assetMetadata, @@ -230,6 +220,42 @@ export class Settings { return ret; } + private static parseStringContextListToObject(argv: yargs.Arguments): any { + const context: any = {}; + + for (const assignment of ((argv as any).context || [])) { + const parts = assignment.split('=', 2); + if (parts.length === 2) { + debug('CLI argument context: %s=%s', parts[0], parts[1]); + if (parts[0].match(/^aws:.+/)) { + throw new Error(`User-provided context cannot use keys prefixed with 'aws:', but ${parts[0]} was provided.`); + } + context[parts[0]] = parts[1]; + } else { + warning('Context argument is not an assignment (key=value): %s', assignment); + } + } + return context; + } + + private static parseStringTagsListToObject(argv: yargs.Arguments): Tag[] { + const tags: Tag[] = []; + + for (const assignment of ((argv as any).tags || [])) { + const parts = assignment.split('=', 2); + if (parts.length === 2) { + debug('CLI argument tags: %s=%s', parts[0], parts[1]); + tags.push({ + Key: parts[0], + Value: parts[1] + }); + } else { + warning('Tags argument is not an assignment (key=value): %s', assignment); + } + } + return tags; + } + constructor(private settings: SettingsMap = {}, public readonly readOnly = false) {} public async load(fileName: string): Promise { diff --git a/packages/aws-cdk/package-lock.json b/packages/aws-cdk/package-lock.json index 88c292dcda87f..b7641bed923a8 100644 --- a/packages/aws-cdk/package-lock.json +++ b/packages/aws-cdk/package-lock.json @@ -1,9 +1,14 @@ { "name": "aws-cdk", - "version": "0.32.0", + "version": "0.33.0", "lockfileVersion": 1, "requires": true, "dependencies": { + "@aws-cdk/applet-js": { + "version": "0.33.0", + "resolved": "https://registry.npmjs.org/@aws-cdk/applet-js/-/applet-js-0.33.0.tgz", + "integrity": "sha512-E4r623FeMdTPwIqDpHRRIiVe8tlNkIYXneFHq9kknbpKgZYk7qVKgiM3Q0vapLjfUJkzcenChLvYKqbPHCNUlA==" + }, "@babel/runtime": { "version": "7.4.5", "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.4.5.tgz", diff --git a/packages/aws-cdk/package.json b/packages/aws-cdk/package.json index 228c21054d361..0f15cd7e587a5 100644 --- a/packages/aws-cdk/package.json +++ b/packages/aws-cdk/package.json @@ -1,7 +1,7 @@ { "name": "aws-cdk", "description": "CDK Toolkit, the command line tool for CDK apps", - "version": "0.32.0", + "version": "0.33.0", "main": "lib/index.js", "types": "lib/index.d.ts", "bin": { @@ -45,16 +45,15 @@ "@types/uuid": "^3.4.4", "@types/yaml": "^1.0.2", "@types/yargs": "^13.0.0", - "cdk-build-tools": "^0.32.0", + "cdk-build-tools": "^0.33.0", "mockery": "^2.1.0", - "pkglint": "^0.32.0", + "pkglint": "^0.33.0", "sinon": "^7.3.1" }, "dependencies": { - "@aws-cdk/applet-js": "^0.32.0", - "@aws-cdk/cloudformation-diff": "^0.32.0", - "@aws-cdk/cx-api": "^0.32.0", - "@aws-cdk/region-info": "^0.32.0", + "@aws-cdk/cloudformation-diff": "^0.33.0", + "@aws-cdk/cx-api": "^0.33.0", + "@aws-cdk/region-info": "^0.33.0", "archiver": "^3.0.0", "aws-sdk": "^2.438.0", "camelcase": "^5.3.1", diff --git a/packages/cdk-dasm/package-lock.json b/packages/cdk-dasm/package-lock.json index 63374278cef5c..12c673fc306db 100644 --- a/packages/cdk-dasm/package-lock.json +++ b/packages/cdk-dasm/package-lock.json @@ -1,6 +1,6 @@ { "name": "cdk-dasm", - "version": "0.32.0", + "version": "0.33.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/cdk-dasm/package.json b/packages/cdk-dasm/package.json index befa1a002acff..bb39882720051 100644 --- a/packages/cdk-dasm/package.json +++ b/packages/cdk-dasm/package.json @@ -1,6 +1,6 @@ { "name": "cdk-dasm", - "version": "0.32.0", + "version": "0.33.0", "description": "AWS CDK disassembler: convert CloudFormation to code", "main": "lib/index.js", "types": "lib/index.d.ts", diff --git a/packages/cdk/package.json b/packages/cdk/package.json index 81ab9ca823eb7..a6935b6feb6a0 100644 --- a/packages/cdk/package.json +++ b/packages/cdk/package.json @@ -1,12 +1,12 @@ { "name": "cdk", - "version": "0.32.0", + "version": "0.33.0", "description": "AWS CDK Toolkit", "bin": { "cdk": "bin/cdk" }, "dependencies": { - "aws-cdk": "^0.32.0" + "aws-cdk": "^0.33.0" }, "repository": { "type": "git", diff --git a/packages/decdk/package-lock.json b/packages/decdk/package-lock.json index aa4d2b94952a9..d725c548b5c3c 100644 --- a/packages/decdk/package-lock.json +++ b/packages/decdk/package-lock.json @@ -1,6 +1,6 @@ { "name": "decdk", - "version": "0.32.0", + "version": "0.33.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/decdk/package.json b/packages/decdk/package.json index ffa5946edb474..ab67e091af73d 100644 --- a/packages/decdk/package.json +++ b/packages/decdk/package.json @@ -1,6 +1,6 @@ { "name": "decdk", - "version": "0.32.0", + "version": "0.33.0", "description": "Declarative CDK: a CloudFormation-like syntax for defining CDK stacks", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -27,113 +27,111 @@ }, "license": "Apache-2.0", "dependencies": { - "@aws-cdk/alexa-ask": "^0.32.0", - "@aws-cdk/app-delivery": "^0.32.0", - "@aws-cdk/assets": "^0.32.0", - "@aws-cdk/assets-docker": "^0.32.0", - "@aws-cdk/aws-amazonmq": "^0.32.0", - "@aws-cdk/aws-apigateway": "^0.32.0", - "@aws-cdk/aws-applicationautoscaling": "^0.32.0", - "@aws-cdk/aws-appmesh": "^0.32.0", - "@aws-cdk/aws-appstream": "^0.32.0", - "@aws-cdk/aws-appsync": "^0.32.0", - "@aws-cdk/aws-athena": "^0.32.0", - "@aws-cdk/aws-autoscaling": "^0.32.0", - "@aws-cdk/aws-autoscaling-common": "^0.32.0", - "@aws-cdk/aws-autoscaling-hooktargets": "^0.32.0", - "@aws-cdk/aws-autoscalingplans": "^0.32.0", - "@aws-cdk/aws-batch": "^0.32.0", - "@aws-cdk/aws-budgets": "^0.32.0", - "@aws-cdk/aws-certificatemanager": "^0.32.0", - "@aws-cdk/aws-cloud9": "^0.32.0", - "@aws-cdk/aws-cloudformation": "^0.32.0", - "@aws-cdk/aws-cloudfront": "^0.32.0", - "@aws-cdk/aws-cloudtrail": "^0.32.0", - "@aws-cdk/aws-cloudwatch": "^0.32.0", - "@aws-cdk/aws-codebuild": "^0.32.0", - "@aws-cdk/aws-codecommit": "^0.32.0", - "@aws-cdk/aws-codedeploy": "^0.32.0", - "@aws-cdk/aws-codepipeline": "^0.32.0", - "@aws-cdk/aws-codepipeline-actions": "^0.32.0", - "@aws-cdk/aws-cognito": "^0.32.0", - "@aws-cdk/aws-config": "^0.32.0", - "@aws-cdk/aws-datapipeline": "^0.32.0", - "@aws-cdk/aws-dax": "^0.32.0", - "@aws-cdk/aws-directoryservice": "^0.32.0", - "@aws-cdk/aws-dlm": "^0.32.0", - "@aws-cdk/aws-docdb": "^0.32.0", - "@aws-cdk/aws-dms": "^0.32.0", - "@aws-cdk/aws-pinpointemail": "^0.32.0", - "@aws-cdk/aws-transfer": "^0.32.0", - "@aws-cdk/aws-dynamodb": "^0.32.0", - "@aws-cdk/aws-dynamodb-global": "^0.32.0", - "@aws-cdk/aws-ec2": "^0.32.0", - "@aws-cdk/aws-ecr": "^0.32.0", - "@aws-cdk/aws-ecs": "^0.32.0", - "@aws-cdk/aws-ecs-patterns": "^0.32.0", - "@aws-cdk/aws-efs": "^0.32.0", - "@aws-cdk/aws-eks": "^0.32.0", - "@aws-cdk/aws-elasticache": "^0.32.0", - "@aws-cdk/aws-elasticbeanstalk": "^0.32.0", - "@aws-cdk/aws-elasticloadbalancing": "^0.32.0", - "@aws-cdk/aws-elasticloadbalancingv2": "^0.32.0", - "@aws-cdk/aws-elasticsearch": "^0.32.0", - "@aws-cdk/aws-emr": "^0.32.0", - "@aws-cdk/aws-events": "^0.32.0", - "@aws-cdk/aws-events-targets": "^0.32.0", - "@aws-cdk/aws-fsx": "^0.32.0", - "@aws-cdk/aws-gamelift": "^0.32.0", - "@aws-cdk/aws-glue": "^0.32.0", - "@aws-cdk/aws-greengrass": "^0.32.0", - "@aws-cdk/aws-guardduty": "^0.32.0", - "@aws-cdk/aws-iam": "^0.32.0", - "@aws-cdk/aws-inspector": "^0.32.0", - "@aws-cdk/aws-iot": "^0.32.0", - "@aws-cdk/aws-iot1click": "^0.32.0", - "@aws-cdk/aws-iotanalytics": "^0.32.0", - "@aws-cdk/aws-kinesis": "^0.32.0", - "@aws-cdk/aws-kinesisanalytics": "^0.32.0", - "@aws-cdk/aws-kinesisfirehose": "^0.32.0", - "@aws-cdk/aws-kms": "^0.32.0", - "@aws-cdk/aws-lambda": "^0.32.0", - "@aws-cdk/aws-lambda-event-sources": "^0.32.0", - "@aws-cdk/aws-logs": "^0.32.0", - "@aws-cdk/aws-logs-destinations": "^0.32.0", - "@aws-cdk/aws-mediastore": "^0.32.0", - "@aws-cdk/aws-neptune": "^0.32.0", - "@aws-cdk/aws-opsworks": "^0.32.0", - "@aws-cdk/aws-opsworkscm": "^0.32.0", - "@aws-cdk/aws-quickstarts": "^0.32.0", - "@aws-cdk/aws-ram": "^0.32.0", - "@aws-cdk/aws-rds": "^0.32.0", - "@aws-cdk/aws-redshift": "^0.32.0", - "@aws-cdk/aws-robomaker": "^0.32.0", - "@aws-cdk/aws-route53": "^0.32.0", - "@aws-cdk/aws-route53-targets": "^0.32.0", - "@aws-cdk/aws-route53resolver": "^0.32.0", - "@aws-cdk/aws-s3": "^0.32.0", - "@aws-cdk/aws-s3-deployment": "^0.32.0", - "@aws-cdk/aws-s3-notifications": "^0.32.0", - "@aws-cdk/aws-sagemaker": "^0.32.0", - "@aws-cdk/aws-sam": "^0.32.0", - "@aws-cdk/aws-sdb": "^0.32.0", - "@aws-cdk/aws-secretsmanager": "^0.32.0", - "@aws-cdk/aws-servicecatalog": "^0.32.0", - "@aws-cdk/aws-servicediscovery": "^0.32.0", - "@aws-cdk/aws-ses": "^0.32.0", - "@aws-cdk/aws-sns": "^0.32.0", - "@aws-cdk/aws-sqs": "^0.32.0", - "@aws-cdk/aws-ssm": "^0.32.0", - "@aws-cdk/aws-stepfunctions": "^0.32.0", - "@aws-cdk/aws-stepfunctions-tasks": "^0.32.0", - "@aws-cdk/aws-waf": "^0.32.0", - "@aws-cdk/aws-wafregional": "^0.32.0", - "@aws-cdk/aws-workspaces": "^0.32.0", - "@aws-cdk/cdk": "^0.32.0", - "@aws-cdk/cfnspec": "^0.32.0", - "@aws-cdk/cx-api": "^0.32.0", - "@aws-cdk/region-info": "^0.32.0", - "@aws-cdk/runtime-values": "^0.32.0", + "@aws-cdk/alexa-ask": "^0.33.0", + "@aws-cdk/app-delivery": "^0.33.0", + "@aws-cdk/assets": "^0.33.0", + "@aws-cdk/assets-docker": "^0.33.0", + "@aws-cdk/aws-amazonmq": "^0.33.0", + "@aws-cdk/aws-apigateway": "^0.33.0", + "@aws-cdk/aws-applicationautoscaling": "^0.33.0", + "@aws-cdk/aws-appmesh": "^0.33.0", + "@aws-cdk/aws-appstream": "^0.33.0", + "@aws-cdk/aws-appsync": "^0.33.0", + "@aws-cdk/aws-athena": "^0.33.0", + "@aws-cdk/aws-autoscaling": "^0.33.0", + "@aws-cdk/aws-autoscaling-common": "^0.33.0", + "@aws-cdk/aws-autoscaling-hooktargets": "^0.33.0", + "@aws-cdk/aws-autoscalingplans": "^0.33.0", + "@aws-cdk/aws-batch": "^0.33.0", + "@aws-cdk/aws-budgets": "^0.33.0", + "@aws-cdk/aws-certificatemanager": "^0.33.0", + "@aws-cdk/aws-cloud9": "^0.33.0", + "@aws-cdk/aws-cloudformation": "^0.33.0", + "@aws-cdk/aws-cloudfront": "^0.33.0", + "@aws-cdk/aws-cloudtrail": "^0.33.0", + "@aws-cdk/aws-cloudwatch": "^0.33.0", + "@aws-cdk/aws-codebuild": "^0.33.0", + "@aws-cdk/aws-codecommit": "^0.33.0", + "@aws-cdk/aws-codedeploy": "^0.33.0", + "@aws-cdk/aws-codepipeline": "^0.33.0", + "@aws-cdk/aws-codepipeline-actions": "^0.33.0", + "@aws-cdk/aws-cognito": "^0.33.0", + "@aws-cdk/aws-config": "^0.33.0", + "@aws-cdk/aws-datapipeline": "^0.33.0", + "@aws-cdk/aws-dax": "^0.33.0", + "@aws-cdk/aws-directoryservice": "^0.33.0", + "@aws-cdk/aws-dlm": "^0.33.0", + "@aws-cdk/aws-dms": "^0.33.0", + "@aws-cdk/aws-docdb": "^0.33.0", + "@aws-cdk/aws-dynamodb": "^0.33.0", + "@aws-cdk/aws-dynamodb-global": "^0.33.0", + "@aws-cdk/aws-ec2": "^0.33.0", + "@aws-cdk/aws-ecr": "^0.33.0", + "@aws-cdk/aws-ecs": "^0.33.0", + "@aws-cdk/aws-ecs-patterns": "^0.33.0", + "@aws-cdk/aws-efs": "^0.33.0", + "@aws-cdk/aws-eks": "^0.33.0", + "@aws-cdk/aws-elasticache": "^0.33.0", + "@aws-cdk/aws-elasticbeanstalk": "^0.33.0", + "@aws-cdk/aws-elasticloadbalancing": "^0.33.0", + "@aws-cdk/aws-elasticloadbalancingv2": "^0.33.0", + "@aws-cdk/aws-elasticsearch": "^0.33.0", + "@aws-cdk/aws-emr": "^0.33.0", + "@aws-cdk/aws-events": "^0.33.0", + "@aws-cdk/aws-events-targets": "^0.33.0", + "@aws-cdk/aws-fsx": "^0.33.0", + "@aws-cdk/aws-gamelift": "^0.33.0", + "@aws-cdk/aws-glue": "^0.33.0", + "@aws-cdk/aws-greengrass": "^0.33.0", + "@aws-cdk/aws-guardduty": "^0.33.0", + "@aws-cdk/aws-iam": "^0.33.0", + "@aws-cdk/aws-inspector": "^0.33.0", + "@aws-cdk/aws-iot": "^0.33.0", + "@aws-cdk/aws-iot1click": "^0.33.0", + "@aws-cdk/aws-iotanalytics": "^0.33.0", + "@aws-cdk/aws-kinesis": "^0.33.0", + "@aws-cdk/aws-kinesisanalytics": "^0.33.0", + "@aws-cdk/aws-kinesisfirehose": "^0.33.0", + "@aws-cdk/aws-kms": "^0.33.0", + "@aws-cdk/aws-lambda": "^0.33.0", + "@aws-cdk/aws-lambda-event-sources": "^0.33.0", + "@aws-cdk/aws-logs": "^0.33.0", + "@aws-cdk/aws-logs-destinations": "^0.33.0", + "@aws-cdk/aws-mediastore": "^0.33.0", + "@aws-cdk/aws-neptune": "^0.33.0", + "@aws-cdk/aws-opsworks": "^0.33.0", + "@aws-cdk/aws-opsworkscm": "^0.33.0", + "@aws-cdk/aws-pinpointemail": "^0.33.0", + "@aws-cdk/aws-ram": "^0.33.0", + "@aws-cdk/aws-rds": "^0.33.0", + "@aws-cdk/aws-redshift": "^0.33.0", + "@aws-cdk/aws-robomaker": "^0.33.0", + "@aws-cdk/aws-route53": "^0.33.0", + "@aws-cdk/aws-route53-targets": "^0.33.0", + "@aws-cdk/aws-route53resolver": "^0.33.0", + "@aws-cdk/aws-s3": "^0.33.0", + "@aws-cdk/aws-s3-deployment": "^0.33.0", + "@aws-cdk/aws-s3-notifications": "^0.33.0", + "@aws-cdk/aws-sagemaker": "^0.33.0", + "@aws-cdk/aws-sam": "^0.33.0", + "@aws-cdk/aws-sdb": "^0.33.0", + "@aws-cdk/aws-secretsmanager": "^0.33.0", + "@aws-cdk/aws-servicecatalog": "^0.33.0", + "@aws-cdk/aws-servicediscovery": "^0.33.0", + "@aws-cdk/aws-ses": "^0.33.0", + "@aws-cdk/aws-sns": "^0.33.0", + "@aws-cdk/aws-sqs": "^0.33.0", + "@aws-cdk/aws-ssm": "^0.33.0", + "@aws-cdk/aws-stepfunctions": "^0.33.0", + "@aws-cdk/aws-stepfunctions-tasks": "^0.33.0", + "@aws-cdk/aws-transfer": "^0.33.0", + "@aws-cdk/aws-waf": "^0.33.0", + "@aws-cdk/aws-wafregional": "^0.33.0", + "@aws-cdk/aws-workspaces": "^0.33.0", + "@aws-cdk/cdk": "^0.33.0", + "@aws-cdk/cfnspec": "^0.33.0", + "@aws-cdk/cx-api": "^0.33.0", + "@aws-cdk/region-info": "^0.33.0", "fs-extra": "^7.0.1", "jsii-reflect": "^0.11.0", "jsonschema": "^1.2.4", @@ -156,4 +154,4 @@ "engines": { "node": ">= 8.10.0" } -} \ No newline at end of file +} diff --git a/packages/decdk/test/__snapshots__/synth.test.js.snap b/packages/decdk/test/__snapshots__/synth.test.js.snap index ffc700b178f15..4ff4e5d64b382 100644 --- a/packages/decdk/test/__snapshots__/synth.test.js.snap +++ b/packages/decdk/test/__snapshots__/synth.test.js.snap @@ -1787,6 +1787,21 @@ Object { }, ], }, + Object { + "Action": Array [ + "kms:Decrypt", + "kms:Encrypt", + "kms:ReEncrypt*", + "kms:GenerateDataKey*", + ], + "Effect": "Allow", + "Resource": Object { + "Fn::GetAtt": Array [ + "Key961B73FD", + "Arn", + ], + }, + }, Object { "Action": Array [ "s3:GetObject*", @@ -1889,6 +1904,24 @@ Object { }, "Resource": "*", }, + Object { + "Action": Array [ + "kms:Decrypt", + "kms:Encrypt", + "kms:ReEncrypt*", + "kms:GenerateDataKey*", + ], + "Effect": "Allow", + "Principal": Object { + "AWS": Object { + "Fn::GetAtt": Array [ + "BuildProjectRoleAA92C755", + "Arn", + ], + }, + }, + "Resource": "*", + }, ], "Version": "2012-10-17", }, diff --git a/packages/simple-resource-bundler/README.md b/packages/simple-resource-bundler/README.md index 7d5a46377c2d9..22fa1531a7ec3 100644 --- a/packages/simple-resource-bundler/README.md +++ b/packages/simple-resource-bundler/README.md @@ -1,18 +1,4 @@ -cdk-bundler -=========== +# simple-resource-bundler -Build tool to bundle static resources into the source of a NodeJS library. +This tool has been deprecated. Use @aws-cdk/assets instead. -Usage ------ - -Bundles all files in the `resources/` directory of an NPM package into a file named `resources.js`, -which exports the files as `Buffers` by name in the top-level exports. - -Use as follows: - - const resources = require('./resources'); - - const buffer = resources['myfile.txt']; - - console.log(buffer.toString('utf-8')); diff --git a/packages/simple-resource-bundler/bin/bundler.ts b/packages/simple-resource-bundler/bin/bundler.ts index 1b36b5bac09f5..8e5e0cff5aef2 100644 --- a/packages/simple-resource-bundler/bin/bundler.ts +++ b/packages/simple-resource-bundler/bin/bundler.ts @@ -1,49 +1,2 @@ #!/usr/bin/env node -import fs = require('fs-extra'); -import path = require('path'); -import 'source-map-support/register'; -import yargs = require('yargs'); - -const argv = yargs - .option('output', { type: 'string', alias: 'o', desc: 'Where to write resources.js' }) - .option('ts', { type: 'boolean', alias: 't', default: true, desc: 'Generate a .d.ts file in addition for TypeScript users' }) - .argv; - -const RESOURCE_DIR = "resources"; -const output = argv.output || '.'; - -async function main() { - if (!(await fs.pathExists(RESOURCE_DIR))) { return; } // Nothing to do - const files = await fs.readdir(RESOURCE_DIR); - - // Build the file - const fragments: string[] = []; - for (const file of files) { - const contentsBuffer = await fs.readFile(path.join(RESOURCE_DIR, file)); - fragments.push(`exports["${file}"] = Buffer.from("${contentsBuffer.toString("base64")}", "base64");`); - } - - // Write the file - await fs.mkdirp(output); - await fs.writeFile(path.join(output, 'resources.js'), fragments.join('\n')); - - // Write type definition file if requested - if (argv.ts) { - const fileDecls: string[] = files.map(file => ` "${file}": Buffer,`); - - const declContents = [ - 'declare const resources: {', - ...fileDecls, - '}', - 'export = resources;' - ]; - - await fs.writeFile(path.join(output, 'resources.d.ts'), declContents.join('\n')); - } -} - -main().catch(err => { - // tslint:disable-next-line:no-console - console.error(err); - process.exit(1); -}); +throw new Error('this module has been deprecated'); diff --git a/packages/simple-resource-bundler/package-lock.json b/packages/simple-resource-bundler/package-lock.json index a7c083792dbbc..038f6f52a2fc5 100644 --- a/packages/simple-resource-bundler/package-lock.json +++ b/packages/simple-resource-bundler/package-lock.json @@ -1,6 +1,6 @@ { "name": "simple-resource-bundler", - "version": "0.32.0", + "version": "0.33.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/packages/simple-resource-bundler/package.json b/packages/simple-resource-bundler/package.json index 9f34cf3358357..b49edda0bc454 100644 --- a/packages/simple-resource-bundler/package.json +++ b/packages/simple-resource-bundler/package.json @@ -1,7 +1,8 @@ { "name": "simple-resource-bundler", - "version": "0.32.0", + "version": "0.33.0", "description": "Command-line tool to embed resources into JS libraries", + "deprecated": "This tool has been deprecated. Use @aws-cdk/assets instead", "bin": { "simple-resource-bundler": "bin/simple-resource-bundler" }, @@ -22,15 +23,8 @@ }, "license": "Apache-2.0", "devDependencies": { - "@types/fs-extra": "^5.0.5", - "@types/yargs": "^13.0.0", - "cdk-build-tools": "^0.32.0", - "pkglint": "^0.32.0" - }, - "dependencies": { - "fs-extra": "^7.0.1", - "source-map-support": "^0.5.12", - "yargs": "^13.2.2" + "cdk-build-tools": "^0.33.0", + "pkglint": "^0.33.0" }, "repository": { "url": "https://github.com/awslabs/aws-cdk.git", diff --git a/tools/awslint/lib/rules/construct.ts b/tools/awslint/lib/rules/construct.ts index 6329ad133bb4d..341b005bdfa4b 100644 --- a/tools/awslint/lib/rules/construct.ts +++ b/tools/awslint/lib/rules/construct.ts @@ -189,12 +189,12 @@ constructLinter.add({ constructLinter.add({ code: 'props-no-unions', - message: 'props should not use TypeScript unions', + message: 'props must not use TypeScript unions', eval: e => { if (!e.ctx.propsType) { return; } if (!e.ctx.hasPropsArgument) { return; } - // this rule only applies to L2 constructs + // this rule does not apply to L1 constructs if (CoreTypes.isCfnResource(e.ctx.classType)) { return; } for (const property of e.ctx.propsType.ownProperties) { @@ -205,12 +205,12 @@ constructLinter.add({ constructLinter.add({ code: 'props-no-arn-refs', - message: 'props should use strong types instead of attributes. props should not have "arn" suffix', + message: 'props must use strong types instead of attributes. props should not have "arn" suffix', eval: e => { if (!e.ctx.propsType) { return; } if (!e.ctx.hasPropsArgument) { return; } - // this rule only applies to L2 constructs + // this rule does not apply to L1 constructs if (CoreTypes.isCfnResource(e.ctx.classType)) { return; } for (const property of e.ctx.propsType.ownProperties) { @@ -221,12 +221,12 @@ constructLinter.add({ constructLinter.add({ code: 'props-no-tokens', - message: 'props should not use the "Token" type', + message: 'props must not use the "Token" type', eval: e => { if (!e.ctx.propsType) { return; } if (!e.ctx.hasPropsArgument) { return; } - // this rule only applies to L2 constructs + // this rule does not apply to L1 constructs if (CoreTypes.isCfnResource(e.ctx.classType)) { return; } for (const property of e.ctx.propsType.allProperties) { @@ -242,12 +242,12 @@ constructLinter.add({ constructLinter.add({ code: 'props-no-cfn-types', - message: 'props should not expose L1 types (types which start with "Cfn")', + message: 'props must not expose L1 types (types which start with "Cfn")', eval: e => { if (!e.ctx.propsType) { return; } if (!e.ctx.hasPropsArgument) { return; } - // this rule only applies to L2 constructs + // this rule does not apply to L1 constructs if (CoreTypes.isCfnResource(e.ctx.classType)) { return; } for (const property of e.ctx.propsType.ownProperties) { @@ -263,12 +263,12 @@ constructLinter.add({ constructLinter.add({ code: 'props-default-doc', - message: 'All optional props should have @default documentation', + message: 'All optional props must have @default documentation', eval: e => { if (!e.ctx.propsType) { return; } if (!e.ctx.hasPropsArgument) { return; } - // this rule only applies to L2 constructs + // this rule does not apply to L1 constructs if (CoreTypes.isCfnResource(e.ctx.classType)) { return; } for (const property of e.ctx.propsType.allProperties) { @@ -276,4 +276,20 @@ constructLinter.add({ e.assert(property.docs.docs.default !== undefined, `${e.ctx.propsFqn}.${property.name}`); } } - }); \ No newline at end of file + }); + +constructLinter.add({ + code: 'props-no-any', + message: 'props must not use Typescript "any" type', + eval: e => { + if (!e.ctx.propsType) { return; } + if (!e.ctx.hasPropsArgument) { return; } + + // this rule does not apply to L1 constructs + if (CoreTypes.isCfnResource(e.ctx.classType)) { return; } + + for (const property of e.ctx.propsType.ownProperties) { + e.assert(!property.type.isAny, `${e.ctx.propsFqn}.${property.name}`); + } + } +}); \ No newline at end of file diff --git a/tools/awslint/package-lock.json b/tools/awslint/package-lock.json index d8094e3428aa5..f5969edf2ed04 100644 --- a/tools/awslint/package-lock.json +++ b/tools/awslint/package-lock.json @@ -1,6 +1,6 @@ { "name": "awslint", - "version": "0.32.0", + "version": "0.33.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/tools/awslint/package.json b/tools/awslint/package.json index b9280e1373411..7ba29374d0c2d 100644 --- a/tools/awslint/package.json +++ b/tools/awslint/package.json @@ -1,7 +1,7 @@ { "name": "awslint", "private": true, - "version": "0.32.0", + "version": "0.33.0", "description": "Enforces the AWS Construct Library guidelines", "main": "index.js", "scripts": { diff --git a/tools/cdk-build-tools/package-lock.json b/tools/cdk-build-tools/package-lock.json index 2f500bb093daf..b58db436a2188 100644 --- a/tools/cdk-build-tools/package-lock.json +++ b/tools/cdk-build-tools/package-lock.json @@ -1,6 +1,6 @@ { "name": "cdk-build-tools", - "version": "0.32.0", + "version": "0.33.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/tools/cdk-build-tools/package.json b/tools/cdk-build-tools/package.json index 3473bb5868c6a..47e6183fb422d 100644 --- a/tools/cdk-build-tools/package.json +++ b/tools/cdk-build-tools/package.json @@ -1,7 +1,7 @@ { "name": "cdk-build-tools", "private": true, - "version": "0.32.0", + "version": "0.33.0", "description": "Tools package with shared build scripts for CDK packages", "main": "lib/index.js", "repository": { @@ -33,10 +33,10 @@ "@types/fs-extra": "^5.0.5", "@types/jest": "^24.0.11", "@types/yargs": "^13.0.0", - "pkglint": "^0.32.0" + "pkglint": "^0.33.0" }, "dependencies": { - "awslint": "^0.32.0", + "awslint": "^0.33.0", "colors": "^1.3.3", "fs-extra": "^7.0.1", "jest": "^24.7.1", @@ -45,7 +45,6 @@ "jsii-pacmak": "^0.11.0", "nodeunit": "^0.11.3", "nyc": "^14.0.0", - "pkglint": "^0.32.0", "ts-jest": "^24.0.2", "tslint": "^5.16.0", "typescript": "^3.4.5", diff --git a/tools/cdk-integ-tools/package-lock.json b/tools/cdk-integ-tools/package-lock.json index 281e27ea26e99..7c6dbe79d8115 100644 --- a/tools/cdk-integ-tools/package-lock.json +++ b/tools/cdk-integ-tools/package-lock.json @@ -1,6 +1,6 @@ { "name": "cdk-integ-tools", - "version": "0.32.0", + "version": "0.33.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/tools/cdk-integ-tools/package.json b/tools/cdk-integ-tools/package.json index 3410191c51153..cf7c77902571a 100644 --- a/tools/cdk-integ-tools/package.json +++ b/tools/cdk-integ-tools/package.json @@ -1,7 +1,7 @@ { "name": "cdk-integ-tools", "private": true, - "version": "0.32.0", + "version": "0.33.0", "description": "Package with integration test scripts for CDK packages", "main": "index.js", "repository": { @@ -30,13 +30,13 @@ "license": "Apache-2.0", "devDependencies": { "@types/yargs": "^13.0.0", - "cdk-build-tools": "^0.32.0", - "pkglint": "^0.32.0" + "cdk-build-tools": "^0.33.0", + "pkglint": "^0.33.0" }, "dependencies": { - "@aws-cdk/cloudformation-diff": "^0.32.0", - "@aws-cdk/cx-api": "^0.32.0", - "aws-cdk": "^0.32.0", + "@aws-cdk/cloudformation-diff": "^0.33.0", + "@aws-cdk/cx-api": "^0.33.0", + "aws-cdk": "^0.33.0", "yargs": "^13.2.2" }, "keywords": [ diff --git a/tools/cfn2ts/package-lock.json b/tools/cfn2ts/package-lock.json index 6c690ae200ef0..84b224db1669c 100644 --- a/tools/cfn2ts/package-lock.json +++ b/tools/cfn2ts/package-lock.json @@ -1,6 +1,6 @@ { "name": "cfn2ts", - "version": "0.32.0", + "version": "0.33.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/tools/cfn2ts/package.json b/tools/cfn2ts/package.json index ebb4ba79d18b6..c67e6c164a64d 100644 --- a/tools/cfn2ts/package.json +++ b/tools/cfn2ts/package.json @@ -1,7 +1,7 @@ { "name": "cfn2ts", "private": true, - "version": "0.32.0", + "version": "0.33.0", "description": "Generates typescript types from CloudFormation spec, with support for enrichments", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -34,7 +34,7 @@ }, "license": "Apache-2.0", "dependencies": { - "@aws-cdk/cfnspec": "^0.32.0", + "@aws-cdk/cfnspec": "^0.33.0", "codemaker": "^0.10.0", "fast-json-patch": "^2.1.0", "fs-extra": "^7.0.1", @@ -43,8 +43,8 @@ "devDependencies": { "@types/fs-extra": "^5.0.5", "@types/yargs": "^13.0.0", - "cdk-build-tools": "^0.32.0", - "pkglint": "^0.32.0" + "cdk-build-tools": "^0.33.0", + "pkglint": "^0.33.0" }, "keywords": [ "aws", diff --git a/tools/pkglint/package-lock.json b/tools/pkglint/package-lock.json index 92ce0aca2da28..aa609862c0138 100644 --- a/tools/pkglint/package-lock.json +++ b/tools/pkglint/package-lock.json @@ -1,6 +1,6 @@ { "name": "pkglint", - "version": "0.32.0", + "version": "0.33.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/tools/pkglint/package.json b/tools/pkglint/package.json index 0cac47b9da745..3928b8770c289 100644 --- a/tools/pkglint/package.json +++ b/tools/pkglint/package.json @@ -1,6 +1,6 @@ { "name": "pkglint", - "version": "0.32.0", + "version": "0.33.0", "private": true, "description": "Validate and fix package.json files", "main": "lib/index.js", diff --git a/tools/pkgtools/package-lock.json b/tools/pkgtools/package-lock.json index 0a1e15920c49a..b40fee8444d8d 100644 --- a/tools/pkgtools/package-lock.json +++ b/tools/pkgtools/package-lock.json @@ -1,6 +1,6 @@ { "name": "pkgtools", - "version": "0.32.0", + "version": "0.33.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/tools/pkgtools/package.json b/tools/pkgtools/package.json index 2d144d00d8678..3ccde068eb606 100644 --- a/tools/pkgtools/package.json +++ b/tools/pkgtools/package.json @@ -1,7 +1,7 @@ { "name": "pkgtools", "private": true, - "version": "0.32.0", + "version": "0.33.0", "description": "Tools for generating cross-package artifacts", "main": "index.js", "repository": { @@ -31,8 +31,8 @@ "devDependencies": { "@types/fs-extra": "^5.0.5", "@types/yargs": "^13.0.0", - "cdk-build-tools": "^0.32.0", - "pkglint": "^0.32.0" + "cdk-build-tools": "^0.33.0", + "pkglint": "^0.33.0" }, "dependencies": { "fs-extra": "^7.0.1",