diff --git a/.github/workflows/auto-approve.yml b/.github/workflows/auto-approve.yml index f6ffd77c8e73e..42acd8437bc92 100644 --- a/.github/workflows/auto-approve.yml +++ b/.github/workflows/auto-approve.yml @@ -12,6 +12,6 @@ jobs: permissions: pull-requests: write steps: - - uses: hmarr/auto-approve-action@v2.4.0 + - uses: hmarr/auto-approve-action@v3.0.0 with: github-token: "${{ secrets.GITHUB_TOKEN }}" diff --git a/packages/@aws-cdk/aws-apigateway/README.md b/packages/@aws-cdk/aws-apigateway/README.md index 69c074590dc1c..5a596f5a6da11 100644 --- a/packages/@aws-cdk/aws-apigateway/README.md +++ b/packages/@aws-cdk/aws-apigateway/README.md @@ -1083,6 +1083,45 @@ new route53.ARecord(this, 'CustomDomainAliasRecord', { }); ``` +### Custom Domains with multi-level api mapping + +Additional requirements for creating multi-level path mappings for RestApis: + +(both are defaults) + +- Must use `SecurityPolicy.TLS_1_2` +- DomainNames must be `EndpointType.REGIONAL` + +```ts +declare const acmCertificateForExampleCom: any; +declare const restApi: apigateway.RestApi; + +new apigateway.DomainName(this, 'custom-domain', { + domainName: 'example.com', + certificate: acmCertificateForExampleCom, + mapping: restApi, + basePath: 'orders/v1/api', +}); +``` + +To then add additional mappings to a domain you can use the `addApiMapping` method. + +```ts +declare const acmCertificateForExampleCom: any; +declare const restApi: apigateway.RestApi; +declare const secondRestApi: apigateway.RestApi; + +const domain = new apigateway.DomainName(this, 'custom-domain', { + domainName: 'example.com', + certificate: acmCertificateForExampleCom, + mapping: restApi, +}); + +domain.addApiMapping(secondRestApi.deploymentStage, { + basePath: 'orders/v2/api', +}); +``` + ## Access Logging Access logging creates logs every time an API method is accessed. Access logs can have information on diff --git a/packages/@aws-cdk/aws-apigateway/lib/authorizers/lambda.ts b/packages/@aws-cdk/aws-apigateway/lib/authorizers/lambda.ts index 85ac3c901f3a5..540528cdaf3da 100644 --- a/packages/@aws-cdk/aws-apigateway/lib/authorizers/lambda.ts +++ b/packages/@aws-cdk/aws-apigateway/lib/authorizers/lambda.ts @@ -13,7 +13,7 @@ export interface LambdaAuthorizerProps { /** * An optional human friendly name for the authorizer. Note that, this is not the primary identifier of the authorizer. * - * @default - the unique construcrt ID + * @default - the unique construct ID */ readonly authorizerName?: string; diff --git a/packages/@aws-cdk/aws-apigateway/lib/domain-name.ts b/packages/@aws-cdk/aws-apigateway/lib/domain-name.ts index d4e1326a980d4..8bc3f6ea1301f 100644 --- a/packages/@aws-cdk/aws-apigateway/lib/domain-name.ts +++ b/packages/@aws-cdk/aws-apigateway/lib/domain-name.ts @@ -1,3 +1,4 @@ +import * as apigwv2 from '@aws-cdk/aws-apigatewayv2'; import * as acm from '@aws-cdk/aws-certificatemanager'; import { IBucket } from '@aws-cdk/aws-s3'; import { IResource, Names, Resource, Token } from '@aws-cdk/core'; @@ -5,6 +6,25 @@ import { Construct } from 'constructs'; import { CfnDomainName } from './apigateway.generated'; import { BasePathMapping, BasePathMappingOptions } from './base-path-mapping'; import { EndpointType, IRestApi } from './restapi'; +import { IStage } from './stage'; + +/** + * Options for creating an api mapping + */ +export interface ApiMappingOptions { + /** + * The api path name that callers of the API must provide in the URL after + * the domain name (e.g. `example.com/base-path`). If you specify this + * property, it can't be an empty string. + * + * If this is undefined, a mapping will be added for the empty path. Any request + * that does not match a mapping will get sent to the API that has been mapped + * to the empty path. + * + * @default - map requests from the domain root (e.g. `example.com`). + */ + readonly basePath?: string; +} /** * The minimum version of the SSL protocol that you want API Gateway to use for HTTPS connections. @@ -54,8 +74,7 @@ export interface DomainNameOptions { * the domain name (e.g. `example.com/base-path`). If you specify this * property, it can't be an empty string. * - * @default - map requests from the domain root (e.g. `example.com`). If this - * is undefined, no additional mappings will be allowed on this domain name. + * @default - map requests from the domain root (e.g. `example.com`). */ readonly basePath?: string; } @@ -64,8 +83,7 @@ export interface DomainNameProps extends DomainNameOptions { /** * If specified, all requests to this domain will be mapped to the production * deployment of this API. If you wish to map this domain to multiple APIs - * with different base paths, don't specify this option and use - * `addBasePathMapping`. + * with different base paths, use `addBasePathMapping` or `addApiMapping`. * * @default - you will have to call `addBasePathMapping` to map this domain to * API endpoints. @@ -115,12 +133,15 @@ export class DomainName extends Resource implements IDomainName { public readonly domainNameAliasDomainName: string; public readonly domainNameAliasHostedZoneId: string; private readonly basePaths = new Set(); + private readonly securityPolicy?: SecurityPolicy; + private readonly endpointType: EndpointType; constructor(scope: Construct, id: string, props: DomainNameProps) { super(scope, id); - const endpointType = props.endpointType || EndpointType.REGIONAL; - const edge = endpointType === EndpointType.EDGE; + this.endpointType = props.endpointType || EndpointType.REGIONAL; + const edge = this.endpointType === EndpointType.EDGE; + this.securityPolicy = props.securityPolicy; if (!Token.isUnresolved(props.domainName) && /[A-Z]/.test(props.domainName)) { throw new Error(`Domain name does not support uppercase letters. Got: ${props.domainName}`); @@ -131,7 +152,7 @@ export class DomainName extends Resource implements IDomainName { domainName: props.domainName, certificateArn: edge ? props.certificate.certificateArn : undefined, regionalCertificateArn: edge ? undefined : props.certificate.certificateArn, - endpointConfiguration: { types: [endpointType] }, + endpointConfiguration: { types: [this.endpointType] }, mutualTlsAuthentication: mtlsConfig, securityPolicy: props.securityPolicy, }); @@ -146,22 +167,54 @@ export class DomainName extends Resource implements IDomainName { ? resource.attrDistributionHostedZoneId : resource.attrRegionalHostedZoneId; - if (props.mapping) { + + const multiLevel = this.validateBasePath(props.basePath); + if (props.mapping && !multiLevel) { this.addBasePathMapping(props.mapping, { basePath: props.basePath, }); + } else if (props.mapping && multiLevel) { + this.addApiMapping(props.mapping.deploymentStage, { + basePath: props.basePath, + }); + } + } + + private validateBasePath(path?: string): boolean { + if (this.isMultiLevel(path)) { + if (this.endpointType === EndpointType.EDGE) { + throw new Error('multi-level basePath is only supported when endpointType is EndpointType.REGIONAL'); + } + if (this.securityPolicy && this.securityPolicy !== SecurityPolicy.TLS_1_2) { + throw new Error('securityPolicy must be set to TLS_1_2 if multi-level basePath is provided'); + } + return true; } + return false; + } + + private isMultiLevel(path?: string): boolean { + return (path?.split('/').filter(x => !!x) ?? []).length >= 2; } /** * Maps this domain to an API endpoint. + * + * This uses the BasePathMapping from ApiGateway v1 which does not support multi-level paths. + * + * If you need to create a mapping for a multi-level path use `addApiMapping` instead. + * * @param targetApi That target API endpoint, requests will be mapped to the deployment stage. * @param options Options for mapping to base path with or without a stage */ - public addBasePathMapping(targetApi: IRestApi, options: BasePathMappingOptions = { }) { - if (this.basePaths.has(undefined)) { - throw new Error('This domain name already has an empty base path. No additional base paths are allowed.'); + public addBasePathMapping(targetApi: IRestApi, options: BasePathMappingOptions = { }): BasePathMapping { + if (this.basePaths.has(options.basePath)) { + throw new Error(`DomainName ${this.node.id} already has a mapping for path ${options.basePath}`); } + if (this.isMultiLevel(options.basePath)) { + throw new Error('BasePathMapping does not support multi-level paths. Use "addApiMapping instead.'); + } + this.basePaths.add(options.basePath); const basePath = options.basePath || '/'; const id = `Map:${basePath}=>${Names.nodeUniqueId(targetApi.node)}`; @@ -172,6 +225,32 @@ export class DomainName extends Resource implements IDomainName { }); } + /** + * Maps this domain to an API endpoint. + * + * This uses the ApiMapping from ApiGatewayV2 which supports multi-level paths, but + * also only supports: + * - SecurityPolicy.TLS_1_2 + * - EndpointType.REGIONAL + * + * @param targetStage the target API stage. + * @param options Options for mapping to a stage + */ + public addApiMapping(targetStage: IStage, options: ApiMappingOptions = {}): void { + if (this.basePaths.has(options.basePath)) { + throw new Error(`DomainName ${this.node.id} already has a mapping for path ${options.basePath}`); + } + this.validateBasePath(options.basePath); + this.basePaths.add(options.basePath); + const id = `Map:${options.basePath ?? 'none'}=>${Names.nodeUniqueId(targetStage.node)}`; + new apigwv2.CfnApiMapping(this, id, { + apiId: targetStage.restApi.restApiId, + stage: targetStage.stageName, + domainName: this.domainName, + apiMappingKey: options.basePath, + }); + } + private configureMTLS(mtlsConfig?: MTLSConfig): CfnDomainName.MutualTlsAuthenticationProperty | undefined { if (!mtlsConfig) return undefined; return { diff --git a/packages/@aws-cdk/aws-apigateway/package.json b/packages/@aws-cdk/aws-apigateway/package.json index b6f3c28297160..0b642868750ad 100644 --- a/packages/@aws-cdk/aws-apigateway/package.json +++ b/packages/@aws-cdk/aws-apigateway/package.json @@ -84,6 +84,7 @@ "@aws-cdk/assertions": "0.0.0", "@aws-cdk/cdk-build-tools": "0.0.0", "@aws-cdk/integ-runner": "0.0.0", + "@aws-cdk/aws-route53": "0.0.0", "@aws-cdk/cfn2ts": "0.0.0", "@aws-cdk/pkglint": "0.0.0", "@types/jest": "^27.5.2" @@ -100,6 +101,7 @@ "@aws-cdk/aws-s3": "0.0.0", "@aws-cdk/aws-s3-assets": "0.0.0", "@aws-cdk/aws-stepfunctions": "0.0.0", + "@aws-cdk/aws-apigatewayv2": "0.0.0", "@aws-cdk/core": "0.0.0", "@aws-cdk/cx-api": "0.0.0", "constructs": "^10.0.0" @@ -117,6 +119,7 @@ "@aws-cdk/aws-s3": "0.0.0", "@aws-cdk/aws-s3-assets": "0.0.0", "@aws-cdk/aws-stepfunctions": "0.0.0", + "@aws-cdk/aws-apigatewayv2": "0.0.0", "@aws-cdk/core": "0.0.0", "@aws-cdk/cx-api": "0.0.0", "constructs": "^10.0.0" @@ -132,6 +135,11 @@ "lib/apigatewayv2.js" ] }, + "pkglint": { + "exclude": [ + "no-experimental-dependencies" + ] + }, "awslint": { "exclude": [ "from-method:@aws-cdk/aws-apigateway.Resource", diff --git a/packages/@aws-cdk/aws-apigateway/test/domain-name.integ.snapshot/asset.456da4984f762c1c25e94bd5f2df6758d2b0884d0dae8ca59bb8f4e3de7c2136.bundle/index.js b/packages/@aws-cdk/aws-apigateway/test/domain-name.integ.snapshot/asset.456da4984f762c1c25e94bd5f2df6758d2b0884d0dae8ca59bb8f4e3de7c2136.bundle/index.js new file mode 100644 index 0000000000000..afcb0cbcfe30a --- /dev/null +++ b/packages/@aws-cdk/aws-apigateway/test/domain-name.integ.snapshot/asset.456da4984f762c1c25e94bd5f2df6758d2b0884d0dae8ca59bb8f4e3de7c2136.bundle/index.js @@ -0,0 +1,668 @@ +var __create = Object.create; +var __defProp = Object.defineProperty; +var __getOwnPropDesc = Object.getOwnPropertyDescriptor; +var __getOwnPropNames = Object.getOwnPropertyNames; +var __getProtoOf = Object.getPrototypeOf; +var __hasOwnProp = Object.prototype.hasOwnProperty; +var __export = (target, all) => { + for (var name in all) + __defProp(target, name, { get: all[name], enumerable: true }); +}; +var __copyProps = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames(from)) + if (!__hasOwnProp.call(to, key) && key !== except) + __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); + } + return to; +}; +var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( + isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, + mod +)); +var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); + +// lib/assertions/providers/lambda-handler/index.ts +var lambda_handler_exports = {}; +__export(lambda_handler_exports, { + handler: () => handler +}); +module.exports = __toCommonJS(lambda_handler_exports); + +// ../assertions/lib/matcher.ts +var Matcher = class { + static isMatcher(x) { + return x && x instanceof Matcher; + } +}; +var MatchResult = class { + constructor(target) { + this.failures = []; + this.captures = /* @__PURE__ */ new Map(); + this.finalized = false; + this.target = target; + } + push(matcher, path, message) { + return this.recordFailure({ matcher, path, message }); + } + recordFailure(failure) { + this.failures.push(failure); + return this; + } + hasFailed() { + return this.failures.length !== 0; + } + get failCount() { + return this.failures.length; + } + compose(id, inner) { + const innerF = inner.failures; + this.failures.push(...innerF.map((f) => { + return { path: [id, ...f.path], message: f.message, matcher: f.matcher }; + })); + inner.captures.forEach((vals, capture) => { + vals.forEach((value) => this.recordCapture({ capture, value })); + }); + return this; + } + finished() { + if (this.finalized) { + return this; + } + if (this.failCount === 0) { + this.captures.forEach((vals, cap) => cap._captured.push(...vals)); + } + this.finalized = true; + return this; + } + toHumanStrings() { + return this.failures.map((r) => { + const loc = r.path.length === 0 ? "" : ` at ${r.path.join("")}`; + return "" + r.message + loc + ` (using ${r.matcher.name} matcher)`; + }); + } + recordCapture(options) { + let values = this.captures.get(options.capture); + if (values === void 0) { + values = []; + } + values.push(options.value); + this.captures.set(options.capture, values); + } +}; + +// ../assertions/lib/private/matchers/absent.ts +var AbsentMatch = class extends Matcher { + constructor(name) { + super(); + this.name = name; + } + test(actual) { + const result = new MatchResult(actual); + if (actual !== void 0) { + result.recordFailure({ + matcher: this, + path: [], + message: `Received ${actual}, but key should be absent` + }); + } + return result; + } +}; + +// ../assertions/lib/private/type.ts +function getType(obj) { + return Array.isArray(obj) ? "array" : typeof obj; +} + +// ../assertions/lib/match.ts +var Match = class { + static absent() { + return new AbsentMatch("absent"); + } + static arrayWith(pattern) { + return new ArrayMatch("arrayWith", pattern); + } + static arrayEquals(pattern) { + return new ArrayMatch("arrayEquals", pattern, { subsequence: false }); + } + static exact(pattern) { + return new LiteralMatch("exact", pattern, { partialObjects: false }); + } + static objectLike(pattern) { + return new ObjectMatch("objectLike", pattern); + } + static objectEquals(pattern) { + return new ObjectMatch("objectEquals", pattern, { partial: false }); + } + static not(pattern) { + return new NotMatch("not", pattern); + } + static serializedJson(pattern) { + return new SerializedJson("serializedJson", pattern); + } + static anyValue() { + return new AnyMatch("anyValue"); + } + static stringLikeRegexp(pattern) { + return new StringLikeRegexpMatch("stringLikeRegexp", pattern); + } +}; +var LiteralMatch = class extends Matcher { + constructor(name, pattern, options = {}) { + super(); + this.name = name; + this.pattern = pattern; + this.partialObjects = options.partialObjects ?? false; + if (Matcher.isMatcher(this.pattern)) { + throw new Error("LiteralMatch cannot directly contain another matcher. Remove the top-level matcher or nest it more deeply."); + } + } + test(actual) { + if (Array.isArray(this.pattern)) { + return new ArrayMatch(this.name, this.pattern, { subsequence: false, partialObjects: this.partialObjects }).test(actual); + } + if (typeof this.pattern === "object") { + return new ObjectMatch(this.name, this.pattern, { partial: this.partialObjects }).test(actual); + } + const result = new MatchResult(actual); + if (typeof this.pattern !== typeof actual) { + result.recordFailure({ + matcher: this, + path: [], + message: `Expected type ${typeof this.pattern} but received ${getType(actual)}` + }); + return result; + } + if (actual !== this.pattern) { + result.recordFailure({ + matcher: this, + path: [], + message: `Expected ${this.pattern} but received ${actual}` + }); + } + return result; + } +}; +var ArrayMatch = class extends Matcher { + constructor(name, pattern, options = {}) { + super(); + this.name = name; + this.pattern = pattern; + this.subsequence = options.subsequence ?? true; + this.partialObjects = options.partialObjects ?? false; + } + test(actual) { + if (!Array.isArray(actual)) { + return new MatchResult(actual).recordFailure({ + matcher: this, + path: [], + message: `Expected type array but received ${getType(actual)}` + }); + } + if (!this.subsequence && this.pattern.length !== actual.length) { + return new MatchResult(actual).recordFailure({ + matcher: this, + path: [], + message: `Expected array of length ${this.pattern.length} but received ${actual.length}` + }); + } + let patternIdx = 0; + let actualIdx = 0; + const result = new MatchResult(actual); + while (patternIdx < this.pattern.length && actualIdx < actual.length) { + const patternElement = this.pattern[patternIdx]; + const matcher = Matcher.isMatcher(patternElement) ? patternElement : new LiteralMatch(this.name, patternElement, { partialObjects: this.partialObjects }); + const matcherName = matcher.name; + if (this.subsequence && (matcherName == "absent" || matcherName == "anyValue")) { + throw new Error(`The Matcher ${matcherName}() cannot be nested within arrayWith()`); + } + const innerResult = matcher.test(actual[actualIdx]); + if (!this.subsequence || !innerResult.hasFailed()) { + result.compose(`[${actualIdx}]`, innerResult); + patternIdx++; + actualIdx++; + } else { + actualIdx++; + } + } + for (; patternIdx < this.pattern.length; patternIdx++) { + const pattern = this.pattern[patternIdx]; + const element = Matcher.isMatcher(pattern) || typeof pattern === "object" ? " " : ` [${pattern}] `; + result.recordFailure({ + matcher: this, + path: [], + message: `Missing element${element}at pattern index ${patternIdx}` + }); + } + return result; + } +}; +var ObjectMatch = class extends Matcher { + constructor(name, pattern, options = {}) { + super(); + this.name = name; + this.pattern = pattern; + this.partial = options.partial ?? true; + } + test(actual) { + if (typeof actual !== "object" || Array.isArray(actual)) { + return new MatchResult(actual).recordFailure({ + matcher: this, + path: [], + message: `Expected type object but received ${getType(actual)}` + }); + } + const result = new MatchResult(actual); + if (!this.partial) { + for (const a of Object.keys(actual)) { + if (!(a in this.pattern)) { + result.recordFailure({ + matcher: this, + path: [`/${a}`], + message: "Unexpected key" + }); + } + } + } + for (const [patternKey, patternVal] of Object.entries(this.pattern)) { + if (!(patternKey in actual) && !(patternVal instanceof AbsentMatch)) { + result.recordFailure({ + matcher: this, + path: [`/${patternKey}`], + message: `Missing key '${patternKey}' among {${Object.keys(actual).join(",")}}` + }); + continue; + } + const matcher = Matcher.isMatcher(patternVal) ? patternVal : new LiteralMatch(this.name, patternVal, { partialObjects: this.partial }); + const inner = matcher.test(actual[patternKey]); + result.compose(`/${patternKey}`, inner); + } + return result; + } +}; +var SerializedJson = class extends Matcher { + constructor(name, pattern) { + super(); + this.name = name; + this.pattern = pattern; + } + test(actual) { + const result = new MatchResult(actual); + if (getType(actual) !== "string") { + result.recordFailure({ + matcher: this, + path: [], + message: `Expected JSON as a string but found ${getType(actual)}` + }); + return result; + } + let parsed; + try { + parsed = JSON.parse(actual); + } catch (err) { + if (err instanceof SyntaxError) { + result.recordFailure({ + matcher: this, + path: [], + message: `Invalid JSON string: ${actual}` + }); + return result; + } else { + throw err; + } + } + const matcher = Matcher.isMatcher(this.pattern) ? this.pattern : new LiteralMatch(this.name, this.pattern); + const innerResult = matcher.test(parsed); + result.compose(`(${this.name})`, innerResult); + return result; + } +}; +var NotMatch = class extends Matcher { + constructor(name, pattern) { + super(); + this.name = name; + this.pattern = pattern; + } + test(actual) { + const matcher = Matcher.isMatcher(this.pattern) ? this.pattern : new LiteralMatch(this.name, this.pattern); + const innerResult = matcher.test(actual); + const result = new MatchResult(actual); + if (innerResult.failCount === 0) { + result.recordFailure({ + matcher: this, + path: [], + message: `Found unexpected match: ${JSON.stringify(actual, void 0, 2)}` + }); + } + return result; + } +}; +var AnyMatch = class extends Matcher { + constructor(name) { + super(); + this.name = name; + } + test(actual) { + const result = new MatchResult(actual); + if (actual == null) { + result.recordFailure({ + matcher: this, + path: [], + message: "Expected a value but found none" + }); + } + return result; + } +}; +var StringLikeRegexpMatch = class extends Matcher { + constructor(name, pattern) { + super(); + this.name = name; + this.pattern = pattern; + } + test(actual) { + const result = new MatchResult(actual); + const regex = new RegExp(this.pattern, "gm"); + if (typeof actual !== "string") { + result.recordFailure({ + matcher: this, + path: [], + message: `Expected a string, but got '${typeof actual}'` + }); + } + if (!regex.test(actual)) { + result.recordFailure({ + matcher: this, + path: [], + message: `String '${actual}' did not match pattern '${this.pattern}'` + }); + } + return result; + } +}; + +// lib/assertions/providers/lambda-handler/base.ts +var https = __toESM(require("https")); +var url = __toESM(require("url")); +var CustomResourceHandler = class { + constructor(event, context) { + this.event = event; + this.context = context; + this.timedOut = false; + this.timeout = setTimeout(async () => { + await this.respond({ + status: "FAILED", + reason: "Lambda Function Timeout", + data: this.context.logStreamName + }); + this.timedOut = true; + }, context.getRemainingTimeInMillis() - 1200); + this.event = event; + this.physicalResourceId = extractPhysicalResourceId(event); + } + async handle() { + try { + const response = await this.processEvent(this.event.ResourceProperties); + return response; + } catch (e) { + console.log(e); + throw e; + } finally { + clearTimeout(this.timeout); + } + } + respond(response) { + if (this.timedOut) { + return; + } + const cfResponse = { + Status: response.status, + Reason: response.reason, + PhysicalResourceId: this.physicalResourceId, + StackId: this.event.StackId, + RequestId: this.event.RequestId, + LogicalResourceId: this.event.LogicalResourceId, + NoEcho: false, + Data: response.data + }; + const responseBody = JSON.stringify(cfResponse); + console.log("Responding to CloudFormation", responseBody); + const parsedUrl = url.parse(this.event.ResponseURL); + const requestOptions = { + hostname: parsedUrl.hostname, + path: parsedUrl.path, + method: "PUT", + headers: { "content-type": "", "content-length": responseBody.length } + }; + return new Promise((resolve, reject) => { + try { + const request2 = https.request(requestOptions, resolve); + request2.on("error", reject); + request2.write(responseBody); + request2.end(); + } catch (e) { + reject(e); + } + }); + } +}; +function extractPhysicalResourceId(event) { + switch (event.RequestType) { + case "Create": + return event.LogicalResourceId; + case "Update": + case "Delete": + return event.PhysicalResourceId; + } +} + +// lib/assertions/providers/lambda-handler/assertion.ts +var AssertionHandler = class extends CustomResourceHandler { + async processEvent(request2) { + let actual = decodeCall(request2.actual); + const expected = decodeCall(request2.expected); + let result; + const matcher = new MatchCreator(expected).getMatcher(); + console.log(`Testing equality between ${JSON.stringify(request2.actual)} and ${JSON.stringify(request2.expected)}`); + const matchResult = matcher.test(actual); + matchResult.finished(); + if (matchResult.hasFailed()) { + result = { + failed: true, + assertion: JSON.stringify({ + status: "fail", + message: [ + ...matchResult.toHumanStrings(), + JSON.stringify(matchResult.target, void 0, 2) + ].join("\n") + }) + }; + if (request2.failDeployment) { + throw new Error(result.assertion); + } + } else { + result = { + assertion: JSON.stringify({ + status: "success" + }) + }; + } + return result; + } +}; +var MatchCreator = class { + constructor(obj) { + this.parsedObj = { + matcher: obj + }; + } + getMatcher() { + try { + const final = JSON.parse(JSON.stringify(this.parsedObj), function(_k, v) { + const nested = Object.keys(v)[0]; + switch (nested) { + case "$ArrayWith": + return Match.arrayWith(v[nested]); + case "$ObjectLike": + return Match.objectLike(v[nested]); + case "$StringLike": + return Match.stringLikeRegexp(v[nested]); + default: + return v; + } + }); + if (Matcher.isMatcher(final.matcher)) { + return final.matcher; + } + return Match.exact(final.matcher); + } catch { + return Match.exact(this.parsedObj.matcher); + } + } +}; +function decodeCall(call) { + if (!call) { + return void 0; + } + try { + const parsed = JSON.parse(call); + return parsed; + } catch (e) { + return call; + } +} + +// lib/assertions/providers/lambda-handler/utils.ts +function decode(object) { + return JSON.parse(JSON.stringify(object), (_k, v) => { + switch (v) { + case "TRUE:BOOLEAN": + return true; + case "FALSE:BOOLEAN": + return false; + default: + return v; + } + }); +} + +// lib/assertions/providers/lambda-handler/sdk.ts +function flatten(object) { + return Object.assign( + {}, + ...function _flatten(child, path = []) { + return [].concat(...Object.keys(child).map((key) => { + let childKey = Buffer.isBuffer(child[key]) ? child[key].toString("utf8") : child[key]; + if (typeof childKey === "string") { + childKey = isJsonString(childKey); + } + return typeof childKey === "object" && childKey !== null ? _flatten(childKey, path.concat([key])) : { [path.concat([key]).join(".")]: childKey }; + })); + }(object) + ); +} +var AwsApiCallHandler = class extends CustomResourceHandler { + async processEvent(request2) { + const AWS = require("aws-sdk"); + console.log(`AWS SDK VERSION: ${AWS.VERSION}`); + if (!Object.prototype.hasOwnProperty.call(AWS, request2.service)) { + throw Error(`Service ${request2.service} does not exist in AWS SDK version ${AWS.VERSION}.`); + } + const service = new AWS[request2.service](); + const response = await service[request2.api](request2.parameters && decode(request2.parameters)).promise(); + console.log(`SDK response received ${JSON.stringify(response)}`); + delete response.ResponseMetadata; + const respond = { + apiCallResponse: response + }; + const flatData = { + ...flatten(respond) + }; + const resp = request2.flattenResponse === "true" ? flatData : respond; + console.log(`Returning result ${JSON.stringify(resp)}`); + return resp; + } +}; +function isJsonString(value) { + try { + return JSON.parse(value); + } catch { + return value; + } +} + +// lib/assertions/providers/lambda-handler/types.ts +var ASSERT_RESOURCE_TYPE = "Custom::DeployAssert@AssertEquals"; +var SDK_RESOURCE_TYPE_PREFIX = "Custom::DeployAssert@SdkCall"; + +// lib/assertions/providers/lambda-handler/index.ts +async function handler(event, context) { + console.log(`Event: ${JSON.stringify({ ...event, ResponseURL: "..." })}`); + const provider = createResourceHandler(event, context); + try { + if (event.RequestType === "Delete") { + await provider.respond({ + status: "SUCCESS", + reason: "OK" + }); + return; + } + const result = await provider.handle(); + const actualPath = event.ResourceProperties.actualPath; + const actual = actualPath ? result[`apiCallResponse.${actualPath}`] : result.apiCallResponse; + if ("expected" in event.ResourceProperties) { + const assertion = new AssertionHandler({ + ...event, + ResourceProperties: { + ServiceToken: event.ServiceToken, + actual, + expected: event.ResourceProperties.expected + } + }, context); + try { + const assertionResult = await assertion.handle(); + await provider.respond({ + status: "SUCCESS", + reason: "OK", + data: { + ...assertionResult, + ...result + } + }); + return; + } catch (e) { + await provider.respond({ + status: "FAILED", + reason: e.message ?? "Internal Error" + }); + return; + } + } + await provider.respond({ + status: "SUCCESS", + reason: "OK", + data: result + }); + } catch (e) { + await provider.respond({ + status: "FAILED", + reason: e.message ?? "Internal Error" + }); + return; + } + return; +} +function createResourceHandler(event, context) { + if (event.ResourceType.startsWith(SDK_RESOURCE_TYPE_PREFIX)) { + return new AwsApiCallHandler(event, context); + } else if (event.ResourceType.startsWith(ASSERT_RESOURCE_TYPE)) { + return new AssertionHandler(event, context); + } else { + throw new Error(`Unsupported resource type "${event.ResourceType}`); + } +} +// Annotate the CommonJS export names for ESM import in node: +0 && (module.exports = { + handler +}); diff --git a/packages/@aws-cdk/aws-apigateway/test/domain-name.integ.snapshot/cdk.out b/packages/@aws-cdk/aws-apigateway/test/domain-name.integ.snapshot/cdk.out new file mode 100644 index 0000000000000..8ecc185e9dbee --- /dev/null +++ b/packages/@aws-cdk/aws-apigateway/test/domain-name.integ.snapshot/cdk.out @@ -0,0 +1 @@ +{"version":"21.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/domain-name.integ.snapshot/domainnamemappingtestDefaultTestDeployAssert4FFC8047.assets.json b/packages/@aws-cdk/aws-apigateway/test/domain-name.integ.snapshot/domainnamemappingtestDefaultTestDeployAssert4FFC8047.assets.json new file mode 100644 index 0000000000000..298b64e0e3328 --- /dev/null +++ b/packages/@aws-cdk/aws-apigateway/test/domain-name.integ.snapshot/domainnamemappingtestDefaultTestDeployAssert4FFC8047.assets.json @@ -0,0 +1,32 @@ +{ + "version": "21.0.0", + "files": { + "456da4984f762c1c25e94bd5f2df6758d2b0884d0dae8ca59bb8f4e3de7c2136": { + "source": { + "path": "asset.456da4984f762c1c25e94bd5f2df6758d2b0884d0dae8ca59bb8f4e3de7c2136.bundle", + "packaging": "zip" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "456da4984f762c1c25e94bd5f2df6758d2b0884d0dae8ca59bb8f4e3de7c2136.zip", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + }, + "ca221fe7d8415bb5d7851fa5f77af9fa55569243f4832c489ac239a1a9ccf4ca": { + "source": { + "path": "domainnamemappingtestDefaultTestDeployAssert4FFC8047.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "ca221fe7d8415bb5d7851fa5f77af9fa55569243f4832c489ac239a1a9ccf4ca.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/domain-name.integ.snapshot/domainnamemappingtestDefaultTestDeployAssert4FFC8047.template.json b/packages/@aws-cdk/aws-apigateway/test/domain-name.integ.snapshot/domainnamemappingtestDefaultTestDeployAssert4FFC8047.template.json new file mode 100644 index 0000000000000..2c342b9a4c8b9 --- /dev/null +++ b/packages/@aws-cdk/aws-apigateway/test/domain-name.integ.snapshot/domainnamemappingtestDefaultTestDeployAssert4FFC8047.template.json @@ -0,0 +1,484 @@ +{ + "Resources": { + "LambdaInvoke6c82f4296e4da69e1d6905e3d20f761a": { + "Type": "Custom::DeployAssert@SdkCallLambdainvoke", + "Properties": { + "ServiceToken": { + "Fn::GetAtt": [ + "SingletonFunction1488541a7b23466481b69b4408076b81HandlerCD40AE9F", + "Arn" + ] + }, + "service": "Lambda", + "api": "invoke", + "expected": "{\"$ObjectLike\":{\"Payload\":{\"$StringLike\":\"201\"}}}", + "parameters": { + "FunctionName": { + "Fn::ImportValue": "integ-apigw-domain-name-mapping:ExportsOutputRefInvokeApi313C8B4949AC2AFC" + }, + "Payload": { + "Fn::Join": [ + "", + [ + "{\"hostname\":\"", + { + "Fn::ImportValue": "integ-apigw-domain-name-mapping:ExportsOutputRefIntegDomain624DF323D17B7540" + }, + "\",\"path\":\"/orders/v1/items\"}" + ] + ] + } + }, + "flattenResponse": "false", + "salt": "1665514871380" + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "LambdaInvoke6c82f4296e4da69e1d6905e3d20f761aInvokeF34C6427": { + "Type": "AWS::Lambda::Permission", + "Properties": { + "Action": "lambda:InvokeFunction", + "FunctionName": { + "Fn::ImportValue": "integ-apigw-domain-name-mapping:ExportsOutputRefInvokeApi313C8B4949AC2AFC" + }, + "Principal": { + "Fn::GetAtt": [ + "SingletonFunction1488541a7b23466481b69b4408076b81Role37ABCE73", + "Arn" + ] + } + } + }, + "SingletonFunction1488541a7b23466481b69b4408076b81Role37ABCE73": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ] + }, + "ManagedPolicyArns": [ + { + "Fn::Sub": "arn:${AWS::Partition}:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + } + ], + "Policies": [ + { + "PolicyName": "Inline", + "PolicyDocument": { + "Version": "2012-10-17", + "Statement": [ + { + "Action": [ + "lambda:Invoke" + ], + "Effect": "Allow", + "Resource": [ + "*" + ] + }, + { + "Action": [ + "lambda:InvokeFunction" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":lambda:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":function:", + { + "Fn::ImportValue": "integ-apigw-domain-name-mapping:ExportsOutputRefInvokeApi313C8B4949AC2AFC" + } + ] + ] + } + ] + }, + { + "Action": [ + "lambda:Invoke" + ], + "Effect": "Allow", + "Resource": [ + "*" + ] + }, + { + "Action": [ + "lambda:InvokeFunction" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":lambda:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":function:", + { + "Fn::ImportValue": "integ-apigw-domain-name-mapping:ExportsOutputRefInvokeApi313C8B4949AC2AFC" + } + ] + ] + } + ] + }, + { + "Action": [ + "lambda:Invoke" + ], + "Effect": "Allow", + "Resource": [ + "*" + ] + }, + { + "Action": [ + "lambda:InvokeFunction" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":lambda:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":function:", + { + "Fn::ImportValue": "integ-apigw-domain-name-mapping:ExportsOutputRefInvokeApi313C8B4949AC2AFC" + } + ] + ] + } + ] + }, + { + "Action": [ + "lambda:Invoke" + ], + "Effect": "Allow", + "Resource": [ + "*" + ] + }, + { + "Action": [ + "lambda:InvokeFunction" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":lambda:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":function:", + { + "Fn::ImportValue": "integ-apigw-domain-name-mapping:ExportsOutputRefInvokeApi313C8B4949AC2AFC" + } + ] + ] + } + ] + } + ] + } + } + ] + } + }, + "SingletonFunction1488541a7b23466481b69b4408076b81HandlerCD40AE9F": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Runtime": "nodejs14.x", + "Code": { + "S3Bucket": { + "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" + }, + "S3Key": "456da4984f762c1c25e94bd5f2df6758d2b0884d0dae8ca59bb8f4e3de7c2136.zip" + }, + "Timeout": 120, + "Handler": "index.handler", + "Role": { + "Fn::GetAtt": [ + "SingletonFunction1488541a7b23466481b69b4408076b81Role37ABCE73", + "Arn" + ] + } + } + }, + "LambdaInvoke4f2bfb0cc64af0ccca4a6e7b6c3de320": { + "Type": "Custom::DeployAssert@SdkCallLambdainvoke", + "Properties": { + "ServiceToken": { + "Fn::GetAtt": [ + "SingletonFunction1488541a7b23466481b69b4408076b81HandlerCD40AE9F", + "Arn" + ] + }, + "service": "Lambda", + "api": "invoke", + "expected": "{\"$ObjectLike\":{\"Payload\":{\"$StringLike\":\"202\"}}}", + "parameters": { + "FunctionName": { + "Fn::ImportValue": "integ-apigw-domain-name-mapping:ExportsOutputRefInvokeApi313C8B4949AC2AFC" + }, + "Payload": { + "Fn::Join": [ + "", + [ + "{\"hostname\":\"", + { + "Fn::ImportValue": "integ-apigw-domain-name-mapping:ExportsOutputRefIntegDomain624DF323D17B7540" + }, + "\",\"path\":\"/orders/v2/items\"}" + ] + ] + } + }, + "flattenResponse": "false", + "salt": "1665514871381" + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "LambdaInvoke4f2bfb0cc64af0ccca4a6e7b6c3de320InvokeC08B85F1": { + "Type": "AWS::Lambda::Permission", + "Properties": { + "Action": "lambda:InvokeFunction", + "FunctionName": { + "Fn::ImportValue": "integ-apigw-domain-name-mapping:ExportsOutputRefInvokeApi313C8B4949AC2AFC" + }, + "Principal": { + "Fn::GetAtt": [ + "SingletonFunction1488541a7b23466481b69b4408076b81Role37ABCE73", + "Arn" + ] + } + } + }, + "LambdaInvokef718aff12f12e7e6e6dd823f91dfce23": { + "Type": "Custom::DeployAssert@SdkCallLambdainvoke", + "Properties": { + "ServiceToken": { + "Fn::GetAtt": [ + "SingletonFunction1488541a7b23466481b69b4408076b81HandlerCD40AE9F", + "Arn" + ] + }, + "service": "Lambda", + "api": "invoke", + "expected": "{\"$ObjectLike\":{\"Payload\":{\"$StringLike\":\"201\"}}}", + "parameters": { + "FunctionName": { + "Fn::ImportValue": "integ-apigw-domain-name-mapping:ExportsOutputRefInvokeApi313C8B4949AC2AFC" + }, + "Payload": { + "Fn::Join": [ + "", + [ + "{\"hostname\":\"", + { + "Fn::ImportValue": "integ-apigw-domain-name-mapping:ExportsOutputRefInteg2Domain70CCEA688A08551F" + }, + "\",\"path\":\"/orders/items\"}" + ] + ] + } + }, + "flattenResponse": "false", + "salt": "1665514871382" + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "LambdaInvokef718aff12f12e7e6e6dd823f91dfce23Invoke0C7CC2F4": { + "Type": "AWS::Lambda::Permission", + "Properties": { + "Action": "lambda:InvokeFunction", + "FunctionName": { + "Fn::ImportValue": "integ-apigw-domain-name-mapping:ExportsOutputRefInvokeApi313C8B4949AC2AFC" + }, + "Principal": { + "Fn::GetAtt": [ + "SingletonFunction1488541a7b23466481b69b4408076b81Role37ABCE73", + "Arn" + ] + } + } + }, + "LambdaInvoke2025c0c4c97e10064ec08312531cb316": { + "Type": "Custom::DeployAssert@SdkCallLambdainvoke", + "Properties": { + "ServiceToken": { + "Fn::GetAtt": [ + "SingletonFunction1488541a7b23466481b69b4408076b81HandlerCD40AE9F", + "Arn" + ] + }, + "service": "Lambda", + "api": "invoke", + "expected": "{\"$ObjectLike\":{\"Payload\":{\"$StringLike\":\"202\"}}}", + "parameters": { + "FunctionName": { + "Fn::ImportValue": "integ-apigw-domain-name-mapping:ExportsOutputRefInvokeApi313C8B4949AC2AFC" + }, + "Payload": { + "Fn::Join": [ + "", + [ + "{\"hostname\":\"", + { + "Fn::ImportValue": "integ-apigw-domain-name-mapping:ExportsOutputRefInteg2Domain70CCEA688A08551F" + }, + "\",\"path\":\"/orders/v2/items\"}" + ] + ] + } + }, + "flattenResponse": "false", + "salt": "1665514871382" + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "LambdaInvoke2025c0c4c97e10064ec08312531cb316Invoke5ACCC8A3": { + "Type": "AWS::Lambda::Permission", + "Properties": { + "Action": "lambda:InvokeFunction", + "FunctionName": { + "Fn::ImportValue": "integ-apigw-domain-name-mapping:ExportsOutputRefInvokeApi313C8B4949AC2AFC" + }, + "Principal": { + "Fn::GetAtt": [ + "SingletonFunction1488541a7b23466481b69b4408076b81Role37ABCE73", + "Arn" + ] + } + } + } + }, + "Outputs": { + "AssertionResultsLambdaInvoke6c82f4296e4da69e1d6905e3d20f761a": { + "Value": { + "Fn::GetAtt": [ + "LambdaInvoke6c82f4296e4da69e1d6905e3d20f761a", + "assertion" + ] + } + }, + "AssertionResultsLambdaInvoke4f2bfb0cc64af0ccca4a6e7b6c3de320": { + "Value": { + "Fn::GetAtt": [ + "LambdaInvoke4f2bfb0cc64af0ccca4a6e7b6c3de320", + "assertion" + ] + } + }, + "AssertionResultsLambdaInvokef718aff12f12e7e6e6dd823f91dfce23": { + "Value": { + "Fn::GetAtt": [ + "LambdaInvokef718aff12f12e7e6e6dd823f91dfce23", + "assertion" + ] + } + }, + "AssertionResultsLambdaInvoke2025c0c4c97e10064ec08312531cb316": { + "Value": { + "Fn::GetAtt": [ + "LambdaInvoke2025c0c4c97e10064ec08312531cb316", + "assertion" + ] + } + } + }, + "Parameters": { + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" + } + }, + "Rules": { + "CheckBootstrapVersion": { + "Assertions": [ + { + "Assert": { + "Fn::Not": [ + { + "Fn::Contains": [ + [ + "1", + "2", + "3", + "4", + "5" + ], + { + "Ref": "BootstrapVersion" + } + ] + } + ] + }, + "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." + } + ] + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/domain-name.integ.snapshot/integ-apigw-domain-name-mapping.assets.json b/packages/@aws-cdk/aws-apigateway/test/domain-name.integ.snapshot/integ-apigw-domain-name-mapping.assets.json new file mode 100644 index 0000000000000..4d6328721dcd0 --- /dev/null +++ b/packages/@aws-cdk/aws-apigateway/test/domain-name.integ.snapshot/integ-apigw-domain-name-mapping.assets.json @@ -0,0 +1,19 @@ +{ + "version": "21.0.0", + "files": { + "732ce16bf00b2654f30bf4b983582705a052dc86d86378d872853ac7af91ba90": { + "source": { + "path": "integ-apigw-domain-name-mapping.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "732ce16bf00b2654f30bf4b983582705a052dc86d86378d872853ac7af91ba90.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/domain-name.integ.snapshot/integ-apigw-domain-name-mapping.template.json b/packages/@aws-cdk/aws-apigateway/test/domain-name.integ.snapshot/integ-apigw-domain-name-mapping.template.json new file mode 100644 index 0000000000000..06810e9960993 --- /dev/null +++ b/packages/@aws-cdk/aws-apigateway/test/domain-name.integ.snapshot/integ-apigw-domain-name-mapping.template.json @@ -0,0 +1,627 @@ +{ + "Resources": { + "IntegApi1IntegApi2018FAD77E9": { + "Type": "AWS::ApiGateway::RestApi", + "Properties": { + "EndpointConfiguration": { + "Types": [ + "REGIONAL" + ] + }, + "Name": "IntegApi201" + } + }, + "IntegApi1IntegApi201DeploymentF1012E35e3d8f8929b682e11ef294dd954cc0999": { + "Type": "AWS::ApiGateway::Deployment", + "Properties": { + "RestApiId": { + "Ref": "IntegApi1IntegApi2018FAD77E9" + }, + "Description": "Automatically created by the RestApi construct" + }, + "DependsOn": [ + "IntegApi1IntegApi201GET725FD00E", + "IntegApi1IntegApi201itemsGET28ED9C03", + "IntegApi1IntegApi201itemsE127EEB1" + ] + }, + "IntegApi1IntegApi201DeploymentStageprod42C7F5CE": { + "Type": "AWS::ApiGateway::Stage", + "Properties": { + "RestApiId": { + "Ref": "IntegApi1IntegApi2018FAD77E9" + }, + "DeploymentId": { + "Ref": "IntegApi1IntegApi201DeploymentF1012E35e3d8f8929b682e11ef294dd954cc0999" + }, + "StageName": "prod" + } + }, + "IntegApi1IntegApi201itemsE127EEB1": { + "Type": "AWS::ApiGateway::Resource", + "Properties": { + "ParentId": { + "Fn::GetAtt": [ + "IntegApi1IntegApi2018FAD77E9", + "RootResourceId" + ] + }, + "PathPart": "items", + "RestApiId": { + "Ref": "IntegApi1IntegApi2018FAD77E9" + } + } + }, + "IntegApi1IntegApi201itemsGET28ED9C03": { + "Type": "AWS::ApiGateway::Method", + "Properties": { + "HttpMethod": "GET", + "ResourceId": { + "Ref": "IntegApi1IntegApi201itemsE127EEB1" + }, + "RestApiId": { + "Ref": "IntegApi1IntegApi2018FAD77E9" + }, + "AuthorizationType": "NONE", + "Integration": { + "IntegrationResponses": [ + { + "ResponseTemplates": { + "application/json": "{\"message\":\"Hello, world\"}" + }, + "StatusCode": "201" + } + ], + "RequestTemplates": { + "application/json": "{ statusCode: 201 }" + }, + "Type": "MOCK" + }, + "MethodResponses": [ + { + "StatusCode": "201" + } + ] + } + }, + "IntegApi1IntegApi201GET725FD00E": { + "Type": "AWS::ApiGateway::Method", + "Properties": { + "HttpMethod": "GET", + "ResourceId": { + "Fn::GetAtt": [ + "IntegApi1IntegApi2018FAD77E9", + "RootResourceId" + ] + }, + "RestApiId": { + "Ref": "IntegApi1IntegApi2018FAD77E9" + }, + "AuthorizationType": "NONE", + "Integration": { + "IntegrationResponses": [ + { + "ResponseTemplates": { + "application/json": "{\"message\":\"Hello, world\"}" + }, + "StatusCode": "201" + } + ], + "RequestTemplates": { + "application/json": "{ statusCode: 201 }" + }, + "Type": "MOCK" + }, + "MethodResponses": [ + { + "StatusCode": "201" + } + ] + } + }, + "IntegDomain624DF323": { + "Type": "AWS::ApiGateway::DomainName", + "Properties": { + "DomainName": "*.example.com", + "EndpointConfiguration": { + "Types": [ + "REGIONAL" + ] + }, + "RegionalCertificateArn": "arn:aws:acm:test-region:12345678:certificate/86468209-a272-595d-b831-0efb6421265z", + "SecurityPolicy": "TLS_1_2" + } + }, + "IntegDomainMapintegapigwdomainnamemappingIntegApi1IntegApi201817D4F3E86701596": { + "Type": "AWS::ApiGateway::BasePathMapping", + "Properties": { + "DomainName": { + "Ref": "IntegDomain624DF323" + }, + "RestApiId": { + "Ref": "IntegApi1IntegApi2018FAD77E9" + }, + "Stage": { + "Ref": "IntegApi1IntegApi201DeploymentStageprod42C7F5CE" + } + } + }, + "IntegDomainMapordersintegapigwdomainnamemappingIntegApi1IntegApi201817D4F3E1F08DBEE": { + "Type": "AWS::ApiGateway::BasePathMapping", + "Properties": { + "DomainName": { + "Ref": "IntegDomain624DF323" + }, + "BasePath": "orders", + "RestApiId": { + "Ref": "IntegApi1IntegApi2018FAD77E9" + }, + "Stage": { + "Ref": "IntegApi1IntegApi201DeploymentStageprod42C7F5CE" + } + } + }, + "IntegDomainMapordersv2integapigwdomainnamemappingIntegApi2IntegApi202DeploymentStageprodDA7FC3FE3C3CDD8F": { + "Type": "AWS::ApiGatewayV2::ApiMapping", + "Properties": { + "ApiId": { + "Ref": "IntegApi2IntegApi202F39817F4" + }, + "DomainName": { + "Ref": "IntegDomain624DF323" + }, + "Stage": { + "Ref": "IntegApi2IntegApi202DeploymentStageprod9500285C" + }, + "ApiMappingKey": "orders/v2" + } + }, + "IntegDomainMapordersv1integapigwdomainnamemappingIntegApi1IntegApi201DeploymentStageprod556D59765598DA9A": { + "Type": "AWS::ApiGatewayV2::ApiMapping", + "Properties": { + "ApiId": { + "Ref": "IntegApi1IntegApi2018FAD77E9" + }, + "DomainName": { + "Ref": "IntegDomain624DF323" + }, + "Stage": { + "Ref": "IntegApi1IntegApi201DeploymentStageprod42C7F5CE" + }, + "ApiMappingKey": "orders/v1" + } + }, + "Integ2Domain70CCEA68": { + "Type": "AWS::ApiGateway::DomainName", + "Properties": { + "DomainName": "another-*.example.com", + "EndpointConfiguration": { + "Types": [ + "REGIONAL" + ] + }, + "RegionalCertificateArn": "arn:aws:acm:test-region:12345678:certificate/86468209-a272-595d-b831-0efb6421265z", + "SecurityPolicy": "TLS_1_2" + } + }, + "Integ2DomainMapordersintegapigwdomainnamemappingIntegApi1IntegApi201817D4F3E604CCBD9": { + "Type": "AWS::ApiGateway::BasePathMapping", + "Properties": { + "DomainName": { + "Ref": "Integ2Domain70CCEA68" + }, + "BasePath": "orders", + "RestApiId": { + "Ref": "IntegApi1IntegApi2018FAD77E9" + }, + "Stage": { + "Ref": "IntegApi1IntegApi201DeploymentStageprod42C7F5CE" + } + } + }, + "Integ2DomainMapordersv2integapigwdomainnamemappingIntegApi2IntegApi202DeploymentStageprodDA7FC3FECE78C5AD": { + "Type": "AWS::ApiGatewayV2::ApiMapping", + "Properties": { + "ApiId": { + "Ref": "IntegApi2IntegApi202F39817F4" + }, + "DomainName": { + "Ref": "Integ2Domain70CCEA68" + }, + "Stage": { + "Ref": "IntegApi2IntegApi202DeploymentStageprod9500285C" + }, + "ApiMappingKey": "orders/v2" + } + }, + "Integ3DomainE531FBAB": { + "Type": "AWS::ApiGateway::DomainName", + "Properties": { + "DomainName": "yet-another-*.example.com", + "EndpointConfiguration": { + "Types": [ + "REGIONAL" + ] + }, + "RegionalCertificateArn": "arn:aws:acm:test-region:12345678:certificate/86468209-a272-595d-b831-0efb6421265z", + "SecurityPolicy": "TLS_1_2" + } + }, + "Integ3DomainMapintegapigwdomainnamemappingIntegApi1IntegApi201817D4F3EC2A223F3": { + "Type": "AWS::ApiGateway::BasePathMapping", + "Properties": { + "DomainName": { + "Ref": "Integ3DomainE531FBAB" + }, + "RestApiId": { + "Ref": "IntegApi1IntegApi2018FAD77E9" + }, + "Stage": { + "Ref": "IntegApi1IntegApi201DeploymentStageprod42C7F5CE" + } + } + }, + "Integ3DomainMapv2integapigwdomainnamemappingIntegApi2IntegApi20289438F2BD839069D": { + "Type": "AWS::ApiGateway::BasePathMapping", + "Properties": { + "DomainName": { + "Ref": "Integ3DomainE531FBAB" + }, + "BasePath": "v2", + "RestApiId": { + "Ref": "IntegApi2IntegApi202F39817F4" + }, + "Stage": { + "Ref": "IntegApi2IntegApi202DeploymentStageprod9500285C" + } + } + }, + "IntegDomainRecord": { + "Type": "AWS::Route53::RecordSet", + "Properties": { + "Name": "*.example.com", + "Type": "A", + "AliasTarget": { + "DNSName": { + "Fn::GetAtt": [ + "IntegDomain624DF323", + "RegionalDomainName" + ] + }, + "HostedZoneId": { + "Fn::GetAtt": [ + "IntegDomain624DF323", + "RegionalHostedZoneId" + ] + } + }, + "HostedZoneId": "Z23ABC4XYZL05B" + } + }, + "Integ2DomainRecord": { + "Type": "AWS::Route53::RecordSet", + "Properties": { + "Name": "another-*.example.com", + "Type": "A", + "AliasTarget": { + "DNSName": { + "Fn::GetAtt": [ + "Integ2Domain70CCEA68", + "RegionalDomainName" + ] + }, + "HostedZoneId": { + "Fn::GetAtt": [ + "Integ2Domain70CCEA68", + "RegionalHostedZoneId" + ] + } + }, + "HostedZoneId": "Z23ABC4XYZL05B" + } + }, + "Integ3DomainRecord": { + "Type": "AWS::Route53::RecordSet", + "Properties": { + "Name": "yet-another-*.example.com", + "Type": "A", + "AliasTarget": { + "DNSName": { + "Fn::GetAtt": [ + "Integ3DomainE531FBAB", + "RegionalDomainName" + ] + }, + "HostedZoneId": { + "Fn::GetAtt": [ + "Integ3DomainE531FBAB", + "RegionalHostedZoneId" + ] + } + }, + "HostedZoneId": "Z23ABC4XYZL05B" + } + }, + "IntegApi2IntegApi202F39817F4": { + "Type": "AWS::ApiGateway::RestApi", + "Properties": { + "EndpointConfiguration": { + "Types": [ + "REGIONAL" + ] + }, + "Name": "IntegApi202" + } + }, + "IntegApi2IntegApi202Deployment16A1A56Af8137e7222475e5a9ac210201aa96737": { + "Type": "AWS::ApiGateway::Deployment", + "Properties": { + "RestApiId": { + "Ref": "IntegApi2IntegApi202F39817F4" + }, + "Description": "Automatically created by the RestApi construct" + }, + "DependsOn": [ + "IntegApi2IntegApi202GETA6A9E1FD", + "IntegApi2IntegApi202itemsGET3C1B2802", + "IntegApi2IntegApi202items6625F7BA" + ] + }, + "IntegApi2IntegApi202DeploymentStageprod9500285C": { + "Type": "AWS::ApiGateway::Stage", + "Properties": { + "RestApiId": { + "Ref": "IntegApi2IntegApi202F39817F4" + }, + "DeploymentId": { + "Ref": "IntegApi2IntegApi202Deployment16A1A56Af8137e7222475e5a9ac210201aa96737" + }, + "StageName": "prod" + } + }, + "IntegApi2IntegApi202items6625F7BA": { + "Type": "AWS::ApiGateway::Resource", + "Properties": { + "ParentId": { + "Fn::GetAtt": [ + "IntegApi2IntegApi202F39817F4", + "RootResourceId" + ] + }, + "PathPart": "items", + "RestApiId": { + "Ref": "IntegApi2IntegApi202F39817F4" + } + } + }, + "IntegApi2IntegApi202itemsGET3C1B2802": { + "Type": "AWS::ApiGateway::Method", + "Properties": { + "HttpMethod": "GET", + "ResourceId": { + "Ref": "IntegApi2IntegApi202items6625F7BA" + }, + "RestApiId": { + "Ref": "IntegApi2IntegApi202F39817F4" + }, + "AuthorizationType": "NONE", + "Integration": { + "IntegrationResponses": [ + { + "ResponseTemplates": { + "application/json": "{\"message\":\"Hello, world\"}" + }, + "StatusCode": "202" + } + ], + "RequestTemplates": { + "application/json": "{ statusCode: 202 }" + }, + "Type": "MOCK" + }, + "MethodResponses": [ + { + "StatusCode": "202" + } + ] + } + }, + "IntegApi2IntegApi202GETA6A9E1FD": { + "Type": "AWS::ApiGateway::Method", + "Properties": { + "HttpMethod": "GET", + "ResourceId": { + "Fn::GetAtt": [ + "IntegApi2IntegApi202F39817F4", + "RootResourceId" + ] + }, + "RestApiId": { + "Ref": "IntegApi2IntegApi202F39817F4" + }, + "AuthorizationType": "NONE", + "Integration": { + "IntegrationResponses": [ + { + "ResponseTemplates": { + "application/json": "{\"message\":\"Hello, world\"}" + }, + "StatusCode": "202" + } + ], + "RequestTemplates": { + "application/json": "{ statusCode: 202 }" + }, + "Type": "MOCK" + }, + "MethodResponses": [ + { + "StatusCode": "202" + } + ] + } + }, + "InvokeApiServiceRoleFB17CD97": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "ManagedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + } + }, + "InvokeApi313C8B49": { + "Type": "AWS::Lambda::Function", + "Properties": { + "Code": { + "ZipFile": "\nconst https = require('https');\nexports.handler = async function(event) {\n console.log(event);\n const options = {\n hostname: event.hostname,\n path: event.path,\n };\n let dataString = '';\n const response = await new Promise((resolve, reject) => {\n const req = https.get(options, (res) => {\n res.on('data', data => {\n dataString += data;\n })\n res.on('end', () => {\n resolve({\n statusCode: res.statusCode,\n body: dataString,\n });\n })\n });\n req.on('error', err => {\n reject({\n statusCode: 500,\n body: JSON.stringify({\n cause: 'Something went wrong',\n error: err,\n })\n });\n });\n req.end();\n });\n return response;\n}\n\n" + }, + "Role": { + "Fn::GetAtt": [ + "InvokeApiServiceRoleFB17CD97", + "Arn" + ] + }, + "Handler": "index.handler", + "Runtime": "nodejs16.x" + }, + "DependsOn": [ + "InvokeApiServiceRoleFB17CD97" + ] + } + }, + "Outputs": { + "IntegApi1IntegApi201Endpoint361E7C32": { + "Value": { + "Fn::Join": [ + "", + [ + "https://", + { + "Ref": "IntegApi1IntegApi2018FAD77E9" + }, + ".execute-api.", + { + "Ref": "AWS::Region" + }, + ".", + { + "Ref": "AWS::URLSuffix" + }, + "/", + { + "Ref": "IntegApi1IntegApi201DeploymentStageprod42C7F5CE" + }, + "/" + ] + ] + } + }, + "IntegApi2IntegApi202Endpoint18343E9B": { + "Value": { + "Fn::Join": [ + "", + [ + "https://", + { + "Ref": "IntegApi2IntegApi202F39817F4" + }, + ".execute-api.", + { + "Ref": "AWS::Region" + }, + ".", + { + "Ref": "AWS::URLSuffix" + }, + "/", + { + "Ref": "IntegApi2IntegApi202DeploymentStageprod9500285C" + }, + "/" + ] + ] + } + }, + "ExportsOutputRefInvokeApi313C8B4949AC2AFC": { + "Value": { + "Ref": "InvokeApi313C8B49" + }, + "Export": { + "Name": "integ-apigw-domain-name-mapping:ExportsOutputRefInvokeApi313C8B4949AC2AFC" + } + }, + "ExportsOutputRefIntegDomain624DF323D17B7540": { + "Value": { + "Ref": "IntegDomain624DF323" + }, + "Export": { + "Name": "integ-apigw-domain-name-mapping:ExportsOutputRefIntegDomain624DF323D17B7540" + } + }, + "ExportsOutputRefInteg2Domain70CCEA688A08551F": { + "Value": { + "Ref": "Integ2Domain70CCEA68" + }, + "Export": { + "Name": "integ-apigw-domain-name-mapping:ExportsOutputRefInteg2Domain70CCEA688A08551F" + } + } + }, + "Parameters": { + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" + } + }, + "Rules": { + "CheckBootstrapVersion": { + "Assertions": [ + { + "Assert": { + "Fn::Not": [ + { + "Fn::Contains": [ + [ + "1", + "2", + "3", + "4", + "5" + ], + { + "Ref": "BootstrapVersion" + } + ] + } + ] + }, + "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." + } + ] + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/domain-name.integ.snapshot/integ.json b/packages/@aws-cdk/aws-apigateway/test/domain-name.integ.snapshot/integ.json new file mode 100644 index 0000000000000..db70a8549af6b --- /dev/null +++ b/packages/@aws-cdk/aws-apigateway/test/domain-name.integ.snapshot/integ.json @@ -0,0 +1,13 @@ +{ + "enableLookups": true, + "version": "21.0.0", + "testCases": { + "domain-name-mapping-test/DefaultTest": { + "stacks": [ + "integ-apigw-domain-name-mapping" + ], + "assertionStack": "domain-name-mapping-test/DefaultTest/DeployAssert", + "assertionStackName": "domainnamemappingtestDefaultTestDeployAssert4FFC8047" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/domain-name.integ.snapshot/manifest.json b/packages/@aws-cdk/aws-apigateway/test/domain-name.integ.snapshot/manifest.json new file mode 100644 index 0000000000000..9a8e006b62584 --- /dev/null +++ b/packages/@aws-cdk/aws-apigateway/test/domain-name.integ.snapshot/manifest.json @@ -0,0 +1,397 @@ +{ + "version": "21.0.0", + "artifacts": { + "Tree": { + "type": "cdk:tree", + "properties": { + "file": "tree.json" + } + }, + "integ-apigw-domain-name-mapping.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "integ-apigw-domain-name-mapping.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "integ-apigw-domain-name-mapping": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "integ-apigw-domain-name-mapping.template.json", + "validateOnSynth": false, + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/732ce16bf00b2654f30bf4b983582705a052dc86d86378d872853ac7af91ba90.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "integ-apigw-domain-name-mapping.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dependencies": [ + "integ-apigw-domain-name-mapping.assets" + ], + "metadata": { + "/integ-apigw-domain-name-mapping/IntegApi1/IntegApi201/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "IntegApi1IntegApi2018FAD77E9" + } + ], + "/integ-apigw-domain-name-mapping/IntegApi1/IntegApi201/Deployment/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "IntegApi1IntegApi201DeploymentF1012E35e3d8f8929b682e11ef294dd954cc0999" + } + ], + "/integ-apigw-domain-name-mapping/IntegApi1/IntegApi201/DeploymentStage.prod/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "IntegApi1IntegApi201DeploymentStageprod42C7F5CE" + } + ], + "/integ-apigw-domain-name-mapping/IntegApi1/IntegApi201/Endpoint": [ + { + "type": "aws:cdk:logicalId", + "data": "IntegApi1IntegApi201Endpoint361E7C32" + } + ], + "/integ-apigw-domain-name-mapping/IntegApi1/IntegApi201/Default/items/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "IntegApi1IntegApi201itemsE127EEB1" + } + ], + "/integ-apigw-domain-name-mapping/IntegApi1/IntegApi201/Default/items/GET/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "IntegApi1IntegApi201itemsGET28ED9C03" + } + ], + "/integ-apigw-domain-name-mapping/IntegApi1/IntegApi201/Default/GET/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "IntegApi1IntegApi201GET725FD00E" + } + ], + "/integ-apigw-domain-name-mapping/IntegDomain/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "IntegDomain624DF323" + } + ], + "/integ-apigw-domain-name-mapping/IntegDomain/Map:--=>integapigwdomainnamemappingIntegApi1IntegApi201817D4F3E/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "IntegDomainMapintegapigwdomainnamemappingIntegApi1IntegApi201817D4F3E86701596" + } + ], + "/integ-apigw-domain-name-mapping/IntegDomain/Map:orders=>integapigwdomainnamemappingIntegApi1IntegApi201817D4F3E/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "IntegDomainMapordersintegapigwdomainnamemappingIntegApi1IntegApi201817D4F3E1F08DBEE" + } + ], + "/integ-apigw-domain-name-mapping/IntegDomain/Map:orders--v2=>integapigwdomainnamemappingIntegApi2IntegApi202DeploymentStageprodDA7FC3FE": [ + { + "type": "aws:cdk:logicalId", + "data": "IntegDomainMapordersv2integapigwdomainnamemappingIntegApi2IntegApi202DeploymentStageprodDA7FC3FE3C3CDD8F" + } + ], + "/integ-apigw-domain-name-mapping/IntegDomain/Map:orders--v1=>integapigwdomainnamemappingIntegApi1IntegApi201DeploymentStageprod556D5976": [ + { + "type": "aws:cdk:logicalId", + "data": "IntegDomainMapordersv1integapigwdomainnamemappingIntegApi1IntegApi201DeploymentStageprod556D59765598DA9A" + } + ], + "/integ-apigw-domain-name-mapping/Integ2Domain/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "Integ2Domain70CCEA68" + } + ], + "/integ-apigw-domain-name-mapping/Integ2Domain/Map:orders=>integapigwdomainnamemappingIntegApi1IntegApi201817D4F3E/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "Integ2DomainMapordersintegapigwdomainnamemappingIntegApi1IntegApi201817D4F3E604CCBD9" + } + ], + "/integ-apigw-domain-name-mapping/Integ2Domain/Map:orders--v2=>integapigwdomainnamemappingIntegApi2IntegApi202DeploymentStageprodDA7FC3FE": [ + { + "type": "aws:cdk:logicalId", + "data": "Integ2DomainMapordersv2integapigwdomainnamemappingIntegApi2IntegApi202DeploymentStageprodDA7FC3FECE78C5AD" + } + ], + "/integ-apigw-domain-name-mapping/Integ3Domain/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "Integ3DomainE531FBAB" + } + ], + "/integ-apigw-domain-name-mapping/Integ3Domain/Map:--=>integapigwdomainnamemappingIntegApi1IntegApi201817D4F3E/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "Integ3DomainMapintegapigwdomainnamemappingIntegApi1IntegApi201817D4F3EC2A223F3" + } + ], + "/integ-apigw-domain-name-mapping/Integ3Domain/Map:v2=>integapigwdomainnamemappingIntegApi2IntegApi20289438F2B/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "Integ3DomainMapv2integapigwdomainnamemappingIntegApi2IntegApi20289438F2BD839069D" + } + ], + "/integ-apigw-domain-name-mapping/IntegDomainRecord": [ + { + "type": "aws:cdk:logicalId", + "data": "IntegDomainRecord" + } + ], + "/integ-apigw-domain-name-mapping/Integ2DomainRecord": [ + { + "type": "aws:cdk:logicalId", + "data": "Integ2DomainRecord" + } + ], + "/integ-apigw-domain-name-mapping/Integ3DomainRecord": [ + { + "type": "aws:cdk:logicalId", + "data": "Integ3DomainRecord" + } + ], + "/integ-apigw-domain-name-mapping/IntegApi2/IntegApi202/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "IntegApi2IntegApi202F39817F4" + } + ], + "/integ-apigw-domain-name-mapping/IntegApi2/IntegApi202/Deployment/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "IntegApi2IntegApi202Deployment16A1A56Af8137e7222475e5a9ac210201aa96737" + } + ], + "/integ-apigw-domain-name-mapping/IntegApi2/IntegApi202/DeploymentStage.prod/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "IntegApi2IntegApi202DeploymentStageprod9500285C" + } + ], + "/integ-apigw-domain-name-mapping/IntegApi2/IntegApi202/Endpoint": [ + { + "type": "aws:cdk:logicalId", + "data": "IntegApi2IntegApi202Endpoint18343E9B" + } + ], + "/integ-apigw-domain-name-mapping/IntegApi2/IntegApi202/Default/items/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "IntegApi2IntegApi202items6625F7BA" + } + ], + "/integ-apigw-domain-name-mapping/IntegApi2/IntegApi202/Default/items/GET/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "IntegApi2IntegApi202itemsGET3C1B2802" + } + ], + "/integ-apigw-domain-name-mapping/IntegApi2/IntegApi202/Default/GET/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "IntegApi2IntegApi202GETA6A9E1FD" + } + ], + "/integ-apigw-domain-name-mapping/InvokeApi/ServiceRole/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "InvokeApiServiceRoleFB17CD97" + } + ], + "/integ-apigw-domain-name-mapping/InvokeApi/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "InvokeApi313C8B49" + } + ], + "/integ-apigw-domain-name-mapping/Exports/Output{\"Ref\":\"InvokeApi313C8B49\"}": [ + { + "type": "aws:cdk:logicalId", + "data": "ExportsOutputRefInvokeApi313C8B4949AC2AFC" + } + ], + "/integ-apigw-domain-name-mapping/Exports/Output{\"Ref\":\"IntegDomain624DF323\"}": [ + { + "type": "aws:cdk:logicalId", + "data": "ExportsOutputRefIntegDomain624DF323D17B7540" + } + ], + "/integ-apigw-domain-name-mapping/Exports/Output{\"Ref\":\"Integ2Domain70CCEA68\"}": [ + { + "type": "aws:cdk:logicalId", + "data": "ExportsOutputRefInteg2Domain70CCEA688A08551F" + } + ], + "/integ-apigw-domain-name-mapping/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/integ-apigw-domain-name-mapping/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ], + "Integ2DomainMapordersintegapigwdomainnamemappingIntegApi1IntegApi201DeploymentStageprod556D59769E7794A6": [ + { + "type": "aws:cdk:logicalId", + "data": "Integ2DomainMapordersintegapigwdomainnamemappingIntegApi1IntegApi201DeploymentStageprod556D59769E7794A6", + "trace": [ + "!!DESTRUCTIVE_CHANGES: WILL_DESTROY" + ] + } + ] + }, + "displayName": "integ-apigw-domain-name-mapping" + }, + "domainnamemappingtestDefaultTestDeployAssert4FFC8047.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "domainnamemappingtestDefaultTestDeployAssert4FFC8047.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "domainnamemappingtestDefaultTestDeployAssert4FFC8047": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "domainnamemappingtestDefaultTestDeployAssert4FFC8047.template.json", + "validateOnSynth": false, + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/ca221fe7d8415bb5d7851fa5f77af9fa55569243f4832c489ac239a1a9ccf4ca.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "domainnamemappingtestDefaultTestDeployAssert4FFC8047.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dependencies": [ + "integ-apigw-domain-name-mapping", + "domainnamemappingtestDefaultTestDeployAssert4FFC8047.assets" + ], + "metadata": { + "/domain-name-mapping-test/DefaultTest/DeployAssert/LambdaInvoke6c82f4296e4da69e1d6905e3d20f761a/Default/Default": [ + { + "type": "aws:cdk:logicalId", + "data": "LambdaInvoke6c82f4296e4da69e1d6905e3d20f761a" + } + ], + "/domain-name-mapping-test/DefaultTest/DeployAssert/LambdaInvoke6c82f4296e4da69e1d6905e3d20f761a/Invoke": [ + { + "type": "aws:cdk:logicalId", + "data": "LambdaInvoke6c82f4296e4da69e1d6905e3d20f761aInvokeF34C6427" + } + ], + "/domain-name-mapping-test/DefaultTest/DeployAssert/LambdaInvoke6c82f4296e4da69e1d6905e3d20f761a/AssertionResults": [ + { + "type": "aws:cdk:logicalId", + "data": "AssertionResultsLambdaInvoke6c82f4296e4da69e1d6905e3d20f761a" + } + ], + "/domain-name-mapping-test/DefaultTest/DeployAssert/SingletonFunction1488541a7b23466481b69b4408076b81/Role": [ + { + "type": "aws:cdk:logicalId", + "data": "SingletonFunction1488541a7b23466481b69b4408076b81Role37ABCE73" + } + ], + "/domain-name-mapping-test/DefaultTest/DeployAssert/SingletonFunction1488541a7b23466481b69b4408076b81/Handler": [ + { + "type": "aws:cdk:logicalId", + "data": "SingletonFunction1488541a7b23466481b69b4408076b81HandlerCD40AE9F" + } + ], + "/domain-name-mapping-test/DefaultTest/DeployAssert/LambdaInvoke4f2bfb0cc64af0ccca4a6e7b6c3de320/Default/Default": [ + { + "type": "aws:cdk:logicalId", + "data": "LambdaInvoke4f2bfb0cc64af0ccca4a6e7b6c3de320" + } + ], + "/domain-name-mapping-test/DefaultTest/DeployAssert/LambdaInvoke4f2bfb0cc64af0ccca4a6e7b6c3de320/Invoke": [ + { + "type": "aws:cdk:logicalId", + "data": "LambdaInvoke4f2bfb0cc64af0ccca4a6e7b6c3de320InvokeC08B85F1" + } + ], + "/domain-name-mapping-test/DefaultTest/DeployAssert/LambdaInvoke4f2bfb0cc64af0ccca4a6e7b6c3de320/AssertionResults": [ + { + "type": "aws:cdk:logicalId", + "data": "AssertionResultsLambdaInvoke4f2bfb0cc64af0ccca4a6e7b6c3de320" + } + ], + "/domain-name-mapping-test/DefaultTest/DeployAssert/LambdaInvokef718aff12f12e7e6e6dd823f91dfce23/Default/Default": [ + { + "type": "aws:cdk:logicalId", + "data": "LambdaInvokef718aff12f12e7e6e6dd823f91dfce23" + } + ], + "/domain-name-mapping-test/DefaultTest/DeployAssert/LambdaInvokef718aff12f12e7e6e6dd823f91dfce23/Invoke": [ + { + "type": "aws:cdk:logicalId", + "data": "LambdaInvokef718aff12f12e7e6e6dd823f91dfce23Invoke0C7CC2F4" + } + ], + "/domain-name-mapping-test/DefaultTest/DeployAssert/LambdaInvokef718aff12f12e7e6e6dd823f91dfce23/AssertionResults": [ + { + "type": "aws:cdk:logicalId", + "data": "AssertionResultsLambdaInvokef718aff12f12e7e6e6dd823f91dfce23" + } + ], + "/domain-name-mapping-test/DefaultTest/DeployAssert/LambdaInvoke2025c0c4c97e10064ec08312531cb316/Default/Default": [ + { + "type": "aws:cdk:logicalId", + "data": "LambdaInvoke2025c0c4c97e10064ec08312531cb316" + } + ], + "/domain-name-mapping-test/DefaultTest/DeployAssert/LambdaInvoke2025c0c4c97e10064ec08312531cb316/Invoke": [ + { + "type": "aws:cdk:logicalId", + "data": "LambdaInvoke2025c0c4c97e10064ec08312531cb316Invoke5ACCC8A3" + } + ], + "/domain-name-mapping-test/DefaultTest/DeployAssert/LambdaInvoke2025c0c4c97e10064ec08312531cb316/AssertionResults": [ + { + "type": "aws:cdk:logicalId", + "data": "AssertionResultsLambdaInvoke2025c0c4c97e10064ec08312531cb316" + } + ], + "/domain-name-mapping-test/DefaultTest/DeployAssert/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/domain-name-mapping-test/DefaultTest/DeployAssert/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "domain-name-mapping-test/DefaultTest/DeployAssert" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/domain-name.integ.snapshot/tree.json b/packages/@aws-cdk/aws-apigateway/test/domain-name.integ.snapshot/tree.json new file mode 100644 index 0000000000000..e8f305f9bd52c --- /dev/null +++ b/packages/@aws-cdk/aws-apigateway/test/domain-name.integ.snapshot/tree.json @@ -0,0 +1,1391 @@ +{ + "version": "tree-0.1", + "tree": { + "id": "App", + "path": "", + "children": { + "Tree": { + "id": "Tree", + "path": "Tree", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.108" + } + }, + "integ-apigw-domain-name-mapping": { + "id": "integ-apigw-domain-name-mapping", + "path": "integ-apigw-domain-name-mapping", + "children": { + "Cert": { + "id": "Cert", + "path": "integ-apigw-domain-name-mapping/Cert", + "constructInfo": { + "fqn": "@aws-cdk/core.Resource", + "version": "0.0.0" + } + }, + "IntegApi1": { + "id": "IntegApi1", + "path": "integ-apigw-domain-name-mapping/IntegApi1", + "children": { + "IntegApi201": { + "id": "IntegApi201", + "path": "integ-apigw-domain-name-mapping/IntegApi1/IntegApi201", + "children": { + "Resource": { + "id": "Resource", + "path": "integ-apigw-domain-name-mapping/IntegApi1/IntegApi201/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::ApiGateway::RestApi", + "aws:cdk:cloudformation:props": { + "endpointConfiguration": { + "types": [ + "REGIONAL" + ] + }, + "name": "IntegApi201" + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-apigateway.CfnRestApi", + "version": "0.0.0" + } + }, + "Deployment": { + "id": "Deployment", + "path": "integ-apigw-domain-name-mapping/IntegApi1/IntegApi201/Deployment", + "children": { + "Resource": { + "id": "Resource", + "path": "integ-apigw-domain-name-mapping/IntegApi1/IntegApi201/Deployment/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::ApiGateway::Deployment", + "aws:cdk:cloudformation:props": { + "restApiId": { + "Ref": "IntegApi1IntegApi2018FAD77E9" + }, + "description": "Automatically created by the RestApi construct" + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-apigateway.CfnDeployment", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-apigateway.Deployment", + "version": "0.0.0" + } + }, + "DeploymentStage.prod": { + "id": "DeploymentStage.prod", + "path": "integ-apigw-domain-name-mapping/IntegApi1/IntegApi201/DeploymentStage.prod", + "children": { + "Resource": { + "id": "Resource", + "path": "integ-apigw-domain-name-mapping/IntegApi1/IntegApi201/DeploymentStage.prod/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::ApiGateway::Stage", + "aws:cdk:cloudformation:props": { + "restApiId": { + "Ref": "IntegApi1IntegApi2018FAD77E9" + }, + "deploymentId": { + "Ref": "IntegApi1IntegApi201DeploymentF1012E35e3d8f8929b682e11ef294dd954cc0999" + }, + "stageName": "prod" + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-apigateway.CfnStage", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-apigateway.Stage", + "version": "0.0.0" + } + }, + "Endpoint": { + "id": "Endpoint", + "path": "integ-apigw-domain-name-mapping/IntegApi1/IntegApi201/Endpoint", + "constructInfo": { + "fqn": "@aws-cdk/core.CfnOutput", + "version": "0.0.0" + } + }, + "Default": { + "id": "Default", + "path": "integ-apigw-domain-name-mapping/IntegApi1/IntegApi201/Default", + "children": { + "items": { + "id": "items", + "path": "integ-apigw-domain-name-mapping/IntegApi1/IntegApi201/Default/items", + "children": { + "Resource": { + "id": "Resource", + "path": "integ-apigw-domain-name-mapping/IntegApi1/IntegApi201/Default/items/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::ApiGateway::Resource", + "aws:cdk:cloudformation:props": { + "parentId": { + "Fn::GetAtt": [ + "IntegApi1IntegApi2018FAD77E9", + "RootResourceId" + ] + }, + "pathPart": "items", + "restApiId": { + "Ref": "IntegApi1IntegApi2018FAD77E9" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-apigateway.CfnResource", + "version": "0.0.0" + } + }, + "GET": { + "id": "GET", + "path": "integ-apigw-domain-name-mapping/IntegApi1/IntegApi201/Default/items/GET", + "children": { + "Resource": { + "id": "Resource", + "path": "integ-apigw-domain-name-mapping/IntegApi1/IntegApi201/Default/items/GET/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::ApiGateway::Method", + "aws:cdk:cloudformation:props": { + "httpMethod": "GET", + "resourceId": { + "Ref": "IntegApi1IntegApi201itemsE127EEB1" + }, + "restApiId": { + "Ref": "IntegApi1IntegApi2018FAD77E9" + }, + "authorizationType": "NONE", + "integration": { + "type": "MOCK", + "requestTemplates": { + "application/json": "{ statusCode: 201 }" + }, + "integrationResponses": [ + { + "statusCode": "201", + "responseTemplates": { + "application/json": "{\"message\":\"Hello, world\"}" + } + } + ] + }, + "methodResponses": [ + { + "statusCode": "201" + } + ] + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-apigateway.CfnMethod", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-apigateway.Method", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-apigateway.Resource", + "version": "0.0.0" + } + }, + "GET": { + "id": "GET", + "path": "integ-apigw-domain-name-mapping/IntegApi1/IntegApi201/Default/GET", + "children": { + "Resource": { + "id": "Resource", + "path": "integ-apigw-domain-name-mapping/IntegApi1/IntegApi201/Default/GET/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::ApiGateway::Method", + "aws:cdk:cloudformation:props": { + "httpMethod": "GET", + "resourceId": { + "Fn::GetAtt": [ + "IntegApi1IntegApi2018FAD77E9", + "RootResourceId" + ] + }, + "restApiId": { + "Ref": "IntegApi1IntegApi2018FAD77E9" + }, + "authorizationType": "NONE", + "integration": { + "type": "MOCK", + "requestTemplates": { + "application/json": "{ statusCode: 201 }" + }, + "integrationResponses": [ + { + "statusCode": "201", + "responseTemplates": { + "application/json": "{\"message\":\"Hello, world\"}" + } + } + ] + }, + "methodResponses": [ + { + "statusCode": "201" + } + ] + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-apigateway.CfnMethod", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-apigateway.Method", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-apigateway.ResourceBase", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-apigateway.RestApi", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.108" + } + }, + "IntegDomain": { + "id": "IntegDomain", + "path": "integ-apigw-domain-name-mapping/IntegDomain", + "children": { + "Resource": { + "id": "Resource", + "path": "integ-apigw-domain-name-mapping/IntegDomain/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::ApiGateway::DomainName", + "aws:cdk:cloudformation:props": { + "domainName": "*.example.com", + "endpointConfiguration": { + "types": [ + "REGIONAL" + ] + }, + "regionalCertificateArn": "arn:aws:acm:test-region:12345678:certificate/86468209-a272-595d-b831-0efb6421265z", + "securityPolicy": "TLS_1_2" + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-apigateway.CfnDomainName", + "version": "0.0.0" + } + }, + "Map:--=>integapigwdomainnamemappingIntegApi1IntegApi201817D4F3E": { + "id": "Map:--=>integapigwdomainnamemappingIntegApi1IntegApi201817D4F3E", + "path": "integ-apigw-domain-name-mapping/IntegDomain/Map:--=>integapigwdomainnamemappingIntegApi1IntegApi201817D4F3E", + "children": { + "Resource": { + "id": "Resource", + "path": "integ-apigw-domain-name-mapping/IntegDomain/Map:--=>integapigwdomainnamemappingIntegApi1IntegApi201817D4F3E/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::ApiGateway::BasePathMapping", + "aws:cdk:cloudformation:props": { + "domainName": { + "Ref": "IntegDomain624DF323" + }, + "restApiId": { + "Ref": "IntegApi1IntegApi2018FAD77E9" + }, + "stage": { + "Ref": "IntegApi1IntegApi201DeploymentStageprod42C7F5CE" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-apigateway.CfnBasePathMapping", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-apigateway.BasePathMapping", + "version": "0.0.0" + } + }, + "Map:orders=>integapigwdomainnamemappingIntegApi1IntegApi201817D4F3E": { + "id": "Map:orders=>integapigwdomainnamemappingIntegApi1IntegApi201817D4F3E", + "path": "integ-apigw-domain-name-mapping/IntegDomain/Map:orders=>integapigwdomainnamemappingIntegApi1IntegApi201817D4F3E", + "children": { + "Resource": { + "id": "Resource", + "path": "integ-apigw-domain-name-mapping/IntegDomain/Map:orders=>integapigwdomainnamemappingIntegApi1IntegApi201817D4F3E/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::ApiGateway::BasePathMapping", + "aws:cdk:cloudformation:props": { + "domainName": { + "Ref": "IntegDomain624DF323" + }, + "basePath": "orders", + "restApiId": { + "Ref": "IntegApi1IntegApi2018FAD77E9" + }, + "stage": { + "Ref": "IntegApi1IntegApi201DeploymentStageprod42C7F5CE" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-apigateway.CfnBasePathMapping", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-apigateway.BasePathMapping", + "version": "0.0.0" + } + }, + "Map:orders--v2=>integapigwdomainnamemappingIntegApi2IntegApi202DeploymentStageprodDA7FC3FE": { + "id": "Map:orders--v2=>integapigwdomainnamemappingIntegApi2IntegApi202DeploymentStageprodDA7FC3FE", + "path": "integ-apigw-domain-name-mapping/IntegDomain/Map:orders--v2=>integapigwdomainnamemappingIntegApi2IntegApi202DeploymentStageprodDA7FC3FE", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::ApiGatewayV2::ApiMapping", + "aws:cdk:cloudformation:props": { + "apiId": { + "Ref": "IntegApi2IntegApi202F39817F4" + }, + "domainName": { + "Ref": "IntegDomain624DF323" + }, + "stage": { + "Ref": "IntegApi2IntegApi202DeploymentStageprod9500285C" + }, + "apiMappingKey": "orders/v2" + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-apigatewayv2.CfnApiMapping", + "version": "0.0.0" + } + }, + "Map:orders--v1=>integapigwdomainnamemappingIntegApi1IntegApi201DeploymentStageprod556D5976": { + "id": "Map:orders--v1=>integapigwdomainnamemappingIntegApi1IntegApi201DeploymentStageprod556D5976", + "path": "integ-apigw-domain-name-mapping/IntegDomain/Map:orders--v1=>integapigwdomainnamemappingIntegApi1IntegApi201DeploymentStageprod556D5976", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::ApiGatewayV2::ApiMapping", + "aws:cdk:cloudformation:props": { + "apiId": { + "Ref": "IntegApi1IntegApi2018FAD77E9" + }, + "domainName": { + "Ref": "IntegDomain624DF323" + }, + "stage": { + "Ref": "IntegApi1IntegApi201DeploymentStageprod42C7F5CE" + }, + "apiMappingKey": "orders/v1" + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-apigatewayv2.CfnApiMapping", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-apigateway.DomainName", + "version": "0.0.0" + } + }, + "Integ2Domain": { + "id": "Integ2Domain", + "path": "integ-apigw-domain-name-mapping/Integ2Domain", + "children": { + "Resource": { + "id": "Resource", + "path": "integ-apigw-domain-name-mapping/Integ2Domain/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::ApiGateway::DomainName", + "aws:cdk:cloudformation:props": { + "domainName": "another-*.example.com", + "endpointConfiguration": { + "types": [ + "REGIONAL" + ] + }, + "regionalCertificateArn": "arn:aws:acm:test-region:12345678:certificate/86468209-a272-595d-b831-0efb6421265z", + "securityPolicy": "TLS_1_2" + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-apigateway.CfnDomainName", + "version": "0.0.0" + } + }, + "Map:orders=>integapigwdomainnamemappingIntegApi1IntegApi201817D4F3E": { + "id": "Map:orders=>integapigwdomainnamemappingIntegApi1IntegApi201817D4F3E", + "path": "integ-apigw-domain-name-mapping/Integ2Domain/Map:orders=>integapigwdomainnamemappingIntegApi1IntegApi201817D4F3E", + "children": { + "Resource": { + "id": "Resource", + "path": "integ-apigw-domain-name-mapping/Integ2Domain/Map:orders=>integapigwdomainnamemappingIntegApi1IntegApi201817D4F3E/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::ApiGateway::BasePathMapping", + "aws:cdk:cloudformation:props": { + "domainName": { + "Ref": "Integ2Domain70CCEA68" + }, + "basePath": "orders", + "restApiId": { + "Ref": "IntegApi1IntegApi2018FAD77E9" + }, + "stage": { + "Ref": "IntegApi1IntegApi201DeploymentStageprod42C7F5CE" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-apigateway.CfnBasePathMapping", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-apigateway.BasePathMapping", + "version": "0.0.0" + } + }, + "Map:orders--v2=>integapigwdomainnamemappingIntegApi2IntegApi202DeploymentStageprodDA7FC3FE": { + "id": "Map:orders--v2=>integapigwdomainnamemappingIntegApi2IntegApi202DeploymentStageprodDA7FC3FE", + "path": "integ-apigw-domain-name-mapping/Integ2Domain/Map:orders--v2=>integapigwdomainnamemappingIntegApi2IntegApi202DeploymentStageprodDA7FC3FE", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::ApiGatewayV2::ApiMapping", + "aws:cdk:cloudformation:props": { + "apiId": { + "Ref": "IntegApi2IntegApi202F39817F4" + }, + "domainName": { + "Ref": "Integ2Domain70CCEA68" + }, + "stage": { + "Ref": "IntegApi2IntegApi202DeploymentStageprod9500285C" + }, + "apiMappingKey": "orders/v2" + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-apigatewayv2.CfnApiMapping", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-apigateway.DomainName", + "version": "0.0.0" + } + }, + "Integ3Domain": { + "id": "Integ3Domain", + "path": "integ-apigw-domain-name-mapping/Integ3Domain", + "children": { + "Resource": { + "id": "Resource", + "path": "integ-apigw-domain-name-mapping/Integ3Domain/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::ApiGateway::DomainName", + "aws:cdk:cloudformation:props": { + "domainName": "yet-another-*.example.com", + "endpointConfiguration": { + "types": [ + "REGIONAL" + ] + }, + "regionalCertificateArn": "arn:aws:acm:test-region:12345678:certificate/86468209-a272-595d-b831-0efb6421265z", + "securityPolicy": "TLS_1_2" + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-apigateway.CfnDomainName", + "version": "0.0.0" + } + }, + "Map:--=>integapigwdomainnamemappingIntegApi1IntegApi201817D4F3E": { + "id": "Map:--=>integapigwdomainnamemappingIntegApi1IntegApi201817D4F3E", + "path": "integ-apigw-domain-name-mapping/Integ3Domain/Map:--=>integapigwdomainnamemappingIntegApi1IntegApi201817D4F3E", + "children": { + "Resource": { + "id": "Resource", + "path": "integ-apigw-domain-name-mapping/Integ3Domain/Map:--=>integapigwdomainnamemappingIntegApi1IntegApi201817D4F3E/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::ApiGateway::BasePathMapping", + "aws:cdk:cloudformation:props": { + "domainName": { + "Ref": "Integ3DomainE531FBAB" + }, + "restApiId": { + "Ref": "IntegApi1IntegApi2018FAD77E9" + }, + "stage": { + "Ref": "IntegApi1IntegApi201DeploymentStageprod42C7F5CE" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-apigateway.CfnBasePathMapping", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-apigateway.BasePathMapping", + "version": "0.0.0" + } + }, + "Map:v2=>integapigwdomainnamemappingIntegApi2IntegApi20289438F2B": { + "id": "Map:v2=>integapigwdomainnamemappingIntegApi2IntegApi20289438F2B", + "path": "integ-apigw-domain-name-mapping/Integ3Domain/Map:v2=>integapigwdomainnamemappingIntegApi2IntegApi20289438F2B", + "children": { + "Resource": { + "id": "Resource", + "path": "integ-apigw-domain-name-mapping/Integ3Domain/Map:v2=>integapigwdomainnamemappingIntegApi2IntegApi20289438F2B/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::ApiGateway::BasePathMapping", + "aws:cdk:cloudformation:props": { + "domainName": { + "Ref": "Integ3DomainE531FBAB" + }, + "basePath": "v2", + "restApiId": { + "Ref": "IntegApi2IntegApi202F39817F4" + }, + "stage": { + "Ref": "IntegApi2IntegApi202DeploymentStageprod9500285C" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-apigateway.CfnBasePathMapping", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-apigateway.BasePathMapping", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-apigateway.DomainName", + "version": "0.0.0" + } + }, + "IntegDomainRecord": { + "id": "IntegDomainRecord", + "path": "integ-apigw-domain-name-mapping/IntegDomainRecord", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::Route53::RecordSet", + "aws:cdk:cloudformation:props": { + "name": "*.example.com", + "type": "A", + "aliasTarget": { + "hostedZoneId": { + "Fn::GetAtt": [ + "IntegDomain624DF323", + "RegionalHostedZoneId" + ] + }, + "dnsName": { + "Fn::GetAtt": [ + "IntegDomain624DF323", + "RegionalDomainName" + ] + } + }, + "hostedZoneId": "Z23ABC4XYZL05B" + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-route53.CfnRecordSet", + "version": "0.0.0" + } + }, + "Integ2DomainRecord": { + "id": "Integ2DomainRecord", + "path": "integ-apigw-domain-name-mapping/Integ2DomainRecord", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::Route53::RecordSet", + "aws:cdk:cloudformation:props": { + "name": "another-*.example.com", + "type": "A", + "aliasTarget": { + "hostedZoneId": { + "Fn::GetAtt": [ + "Integ2Domain70CCEA68", + "RegionalHostedZoneId" + ] + }, + "dnsName": { + "Fn::GetAtt": [ + "Integ2Domain70CCEA68", + "RegionalDomainName" + ] + } + }, + "hostedZoneId": "Z23ABC4XYZL05B" + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-route53.CfnRecordSet", + "version": "0.0.0" + } + }, + "Integ3DomainRecord": { + "id": "Integ3DomainRecord", + "path": "integ-apigw-domain-name-mapping/Integ3DomainRecord", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::Route53::RecordSet", + "aws:cdk:cloudformation:props": { + "name": "yet-another-*.example.com", + "type": "A", + "aliasTarget": { + "hostedZoneId": { + "Fn::GetAtt": [ + "Integ3DomainE531FBAB", + "RegionalHostedZoneId" + ] + }, + "dnsName": { + "Fn::GetAtt": [ + "Integ3DomainE531FBAB", + "RegionalDomainName" + ] + } + }, + "hostedZoneId": "Z23ABC4XYZL05B" + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-route53.CfnRecordSet", + "version": "0.0.0" + } + }, + "IntegApi2": { + "id": "IntegApi2", + "path": "integ-apigw-domain-name-mapping/IntegApi2", + "children": { + "IntegApi202": { + "id": "IntegApi202", + "path": "integ-apigw-domain-name-mapping/IntegApi2/IntegApi202", + "children": { + "Resource": { + "id": "Resource", + "path": "integ-apigw-domain-name-mapping/IntegApi2/IntegApi202/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::ApiGateway::RestApi", + "aws:cdk:cloudformation:props": { + "endpointConfiguration": { + "types": [ + "REGIONAL" + ] + }, + "name": "IntegApi202" + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-apigateway.CfnRestApi", + "version": "0.0.0" + } + }, + "Deployment": { + "id": "Deployment", + "path": "integ-apigw-domain-name-mapping/IntegApi2/IntegApi202/Deployment", + "children": { + "Resource": { + "id": "Resource", + "path": "integ-apigw-domain-name-mapping/IntegApi2/IntegApi202/Deployment/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::ApiGateway::Deployment", + "aws:cdk:cloudformation:props": { + "restApiId": { + "Ref": "IntegApi2IntegApi202F39817F4" + }, + "description": "Automatically created by the RestApi construct" + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-apigateway.CfnDeployment", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-apigateway.Deployment", + "version": "0.0.0" + } + }, + "DeploymentStage.prod": { + "id": "DeploymentStage.prod", + "path": "integ-apigw-domain-name-mapping/IntegApi2/IntegApi202/DeploymentStage.prod", + "children": { + "Resource": { + "id": "Resource", + "path": "integ-apigw-domain-name-mapping/IntegApi2/IntegApi202/DeploymentStage.prod/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::ApiGateway::Stage", + "aws:cdk:cloudformation:props": { + "restApiId": { + "Ref": "IntegApi2IntegApi202F39817F4" + }, + "deploymentId": { + "Ref": "IntegApi2IntegApi202Deployment16A1A56Af8137e7222475e5a9ac210201aa96737" + }, + "stageName": "prod" + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-apigateway.CfnStage", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-apigateway.Stage", + "version": "0.0.0" + } + }, + "Endpoint": { + "id": "Endpoint", + "path": "integ-apigw-domain-name-mapping/IntegApi2/IntegApi202/Endpoint", + "constructInfo": { + "fqn": "@aws-cdk/core.CfnOutput", + "version": "0.0.0" + } + }, + "Default": { + "id": "Default", + "path": "integ-apigw-domain-name-mapping/IntegApi2/IntegApi202/Default", + "children": { + "items": { + "id": "items", + "path": "integ-apigw-domain-name-mapping/IntegApi2/IntegApi202/Default/items", + "children": { + "Resource": { + "id": "Resource", + "path": "integ-apigw-domain-name-mapping/IntegApi2/IntegApi202/Default/items/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::ApiGateway::Resource", + "aws:cdk:cloudformation:props": { + "parentId": { + "Fn::GetAtt": [ + "IntegApi2IntegApi202F39817F4", + "RootResourceId" + ] + }, + "pathPart": "items", + "restApiId": { + "Ref": "IntegApi2IntegApi202F39817F4" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-apigateway.CfnResource", + "version": "0.0.0" + } + }, + "GET": { + "id": "GET", + "path": "integ-apigw-domain-name-mapping/IntegApi2/IntegApi202/Default/items/GET", + "children": { + "Resource": { + "id": "Resource", + "path": "integ-apigw-domain-name-mapping/IntegApi2/IntegApi202/Default/items/GET/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::ApiGateway::Method", + "aws:cdk:cloudformation:props": { + "httpMethod": "GET", + "resourceId": { + "Ref": "IntegApi2IntegApi202items6625F7BA" + }, + "restApiId": { + "Ref": "IntegApi2IntegApi202F39817F4" + }, + "authorizationType": "NONE", + "integration": { + "type": "MOCK", + "requestTemplates": { + "application/json": "{ statusCode: 202 }" + }, + "integrationResponses": [ + { + "statusCode": "202", + "responseTemplates": { + "application/json": "{\"message\":\"Hello, world\"}" + } + } + ] + }, + "methodResponses": [ + { + "statusCode": "202" + } + ] + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-apigateway.CfnMethod", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-apigateway.Method", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-apigateway.Resource", + "version": "0.0.0" + } + }, + "GET": { + "id": "GET", + "path": "integ-apigw-domain-name-mapping/IntegApi2/IntegApi202/Default/GET", + "children": { + "Resource": { + "id": "Resource", + "path": "integ-apigw-domain-name-mapping/IntegApi2/IntegApi202/Default/GET/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::ApiGateway::Method", + "aws:cdk:cloudformation:props": { + "httpMethod": "GET", + "resourceId": { + "Fn::GetAtt": [ + "IntegApi2IntegApi202F39817F4", + "RootResourceId" + ] + }, + "restApiId": { + "Ref": "IntegApi2IntegApi202F39817F4" + }, + "authorizationType": "NONE", + "integration": { + "type": "MOCK", + "requestTemplates": { + "application/json": "{ statusCode: 202 }" + }, + "integrationResponses": [ + { + "statusCode": "202", + "responseTemplates": { + "application/json": "{\"message\":\"Hello, world\"}" + } + } + ] + }, + "methodResponses": [ + { + "statusCode": "202" + } + ] + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-apigateway.CfnMethod", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-apigateway.Method", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-apigateway.ResourceBase", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-apigateway.RestApi", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.108" + } + }, + "InvokeApi": { + "id": "InvokeApi", + "path": "integ-apigw-domain-name-mapping/InvokeApi", + "children": { + "ServiceRole": { + "id": "ServiceRole", + "path": "integ-apigw-domain-name-mapping/InvokeApi/ServiceRole", + "children": { + "Resource": { + "id": "Resource", + "path": "integ-apigw-domain-name-mapping/InvokeApi/ServiceRole/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "lambda.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + }, + "managedPolicyArns": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" + ] + ] + } + ] + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-iam.CfnRole", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-iam.Role", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "integ-apigw-domain-name-mapping/InvokeApi/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::Lambda::Function", + "aws:cdk:cloudformation:props": { + "code": { + "zipFile": "\nconst https = require('https');\nexports.handler = async function(event) {\n console.log(event);\n const options = {\n hostname: event.hostname,\n path: event.path,\n };\n let dataString = '';\n const response = await new Promise((resolve, reject) => {\n const req = https.get(options, (res) => {\n res.on('data', data => {\n dataString += data;\n })\n res.on('end', () => {\n resolve({\n statusCode: res.statusCode,\n body: dataString,\n });\n })\n });\n req.on('error', err => {\n reject({\n statusCode: 500,\n body: JSON.stringify({\n cause: 'Something went wrong',\n error: err,\n })\n });\n });\n req.end();\n });\n return response;\n}\n\n" + }, + "role": { + "Fn::GetAtt": [ + "InvokeApiServiceRoleFB17CD97", + "Arn" + ] + }, + "handler": "index.handler", + "runtime": "nodejs16.x" + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-lambda.CfnFunction", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-lambda.Function", + "version": "0.0.0" + } + }, + "Exports": { + "id": "Exports", + "path": "integ-apigw-domain-name-mapping/Exports", + "children": { + "Output{\"Ref\":\"InvokeApi313C8B49\"}": { + "id": "Output{\"Ref\":\"InvokeApi313C8B49\"}", + "path": "integ-apigw-domain-name-mapping/Exports/Output{\"Ref\":\"InvokeApi313C8B49\"}", + "constructInfo": { + "fqn": "@aws-cdk/core.CfnOutput", + "version": "0.0.0" + } + }, + "Output{\"Ref\":\"IntegDomain624DF323\"}": { + "id": "Output{\"Ref\":\"IntegDomain624DF323\"}", + "path": "integ-apigw-domain-name-mapping/Exports/Output{\"Ref\":\"IntegDomain624DF323\"}", + "constructInfo": { + "fqn": "@aws-cdk/core.CfnOutput", + "version": "0.0.0" + } + }, + "Output{\"Ref\":\"Integ2Domain70CCEA68\"}": { + "id": "Output{\"Ref\":\"Integ2Domain70CCEA68\"}", + "path": "integ-apigw-domain-name-mapping/Exports/Output{\"Ref\":\"Integ2Domain70CCEA68\"}", + "constructInfo": { + "fqn": "@aws-cdk/core.CfnOutput", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.108" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/core.Stack", + "version": "0.0.0" + } + }, + "domain-name-mapping-test": { + "id": "domain-name-mapping-test", + "path": "domain-name-mapping-test", + "children": { + "DefaultTest": { + "id": "DefaultTest", + "path": "domain-name-mapping-test/DefaultTest", + "children": { + "Default": { + "id": "Default", + "path": "domain-name-mapping-test/DefaultTest/Default", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.108" + } + }, + "DeployAssert": { + "id": "DeployAssert", + "path": "domain-name-mapping-test/DefaultTest/DeployAssert", + "children": { + "LambdaInvoke6c82f4296e4da69e1d6905e3d20f761a": { + "id": "LambdaInvoke6c82f4296e4da69e1d6905e3d20f761a", + "path": "domain-name-mapping-test/DefaultTest/DeployAssert/LambdaInvoke6c82f4296e4da69e1d6905e3d20f761a", + "children": { + "SdkProvider": { + "id": "SdkProvider", + "path": "domain-name-mapping-test/DefaultTest/DeployAssert/LambdaInvoke6c82f4296e4da69e1d6905e3d20f761a/SdkProvider", + "children": { + "AssertionsProvider": { + "id": "AssertionsProvider", + "path": "domain-name-mapping-test/DefaultTest/DeployAssert/LambdaInvoke6c82f4296e4da69e1d6905e3d20f761a/SdkProvider/AssertionsProvider", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.108" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests.AssertionsProvider", + "version": "0.0.0" + } + }, + "Default": { + "id": "Default", + "path": "domain-name-mapping-test/DefaultTest/DeployAssert/LambdaInvoke6c82f4296e4da69e1d6905e3d20f761a/Default", + "children": { + "Default": { + "id": "Default", + "path": "domain-name-mapping-test/DefaultTest/DeployAssert/LambdaInvoke6c82f4296e4da69e1d6905e3d20f761a/Default/Default", + "constructInfo": { + "fqn": "@aws-cdk/core.CfnResource", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/core.CustomResource", + "version": "0.0.0" + } + }, + "Invoke": { + "id": "Invoke", + "path": "domain-name-mapping-test/DefaultTest/DeployAssert/LambdaInvoke6c82f4296e4da69e1d6905e3d20f761a/Invoke", + "constructInfo": { + "fqn": "@aws-cdk/core.CfnResource", + "version": "0.0.0" + } + }, + "AssertionResults": { + "id": "AssertionResults", + "path": "domain-name-mapping-test/DefaultTest/DeployAssert/LambdaInvoke6c82f4296e4da69e1d6905e3d20f761a/AssertionResults", + "constructInfo": { + "fqn": "@aws-cdk/core.CfnOutput", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests.LambdaInvokeFunction", + "version": "0.0.0" + } + }, + "SingletonFunction1488541a7b23466481b69b4408076b81": { + "id": "SingletonFunction1488541a7b23466481b69b4408076b81", + "path": "domain-name-mapping-test/DefaultTest/DeployAssert/SingletonFunction1488541a7b23466481b69b4408076b81", + "children": { + "Staging": { + "id": "Staging", + "path": "domain-name-mapping-test/DefaultTest/DeployAssert/SingletonFunction1488541a7b23466481b69b4408076b81/Staging", + "constructInfo": { + "fqn": "@aws-cdk/core.AssetStaging", + "version": "0.0.0" + } + }, + "Role": { + "id": "Role", + "path": "domain-name-mapping-test/DefaultTest/DeployAssert/SingletonFunction1488541a7b23466481b69b4408076b81/Role", + "constructInfo": { + "fqn": "@aws-cdk/core.CfnResource", + "version": "0.0.0" + } + }, + "Handler": { + "id": "Handler", + "path": "domain-name-mapping-test/DefaultTest/DeployAssert/SingletonFunction1488541a7b23466481b69b4408076b81/Handler", + "constructInfo": { + "fqn": "@aws-cdk/core.CfnResource", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.108" + } + }, + "LambdaInvoke4f2bfb0cc64af0ccca4a6e7b6c3de320": { + "id": "LambdaInvoke4f2bfb0cc64af0ccca4a6e7b6c3de320", + "path": "domain-name-mapping-test/DefaultTest/DeployAssert/LambdaInvoke4f2bfb0cc64af0ccca4a6e7b6c3de320", + "children": { + "SdkProvider": { + "id": "SdkProvider", + "path": "domain-name-mapping-test/DefaultTest/DeployAssert/LambdaInvoke4f2bfb0cc64af0ccca4a6e7b6c3de320/SdkProvider", + "children": { + "AssertionsProvider": { + "id": "AssertionsProvider", + "path": "domain-name-mapping-test/DefaultTest/DeployAssert/LambdaInvoke4f2bfb0cc64af0ccca4a6e7b6c3de320/SdkProvider/AssertionsProvider", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.108" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests.AssertionsProvider", + "version": "0.0.0" + } + }, + "Default": { + "id": "Default", + "path": "domain-name-mapping-test/DefaultTest/DeployAssert/LambdaInvoke4f2bfb0cc64af0ccca4a6e7b6c3de320/Default", + "children": { + "Default": { + "id": "Default", + "path": "domain-name-mapping-test/DefaultTest/DeployAssert/LambdaInvoke4f2bfb0cc64af0ccca4a6e7b6c3de320/Default/Default", + "constructInfo": { + "fqn": "@aws-cdk/core.CfnResource", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/core.CustomResource", + "version": "0.0.0" + } + }, + "Invoke": { + "id": "Invoke", + "path": "domain-name-mapping-test/DefaultTest/DeployAssert/LambdaInvoke4f2bfb0cc64af0ccca4a6e7b6c3de320/Invoke", + "constructInfo": { + "fqn": "@aws-cdk/core.CfnResource", + "version": "0.0.0" + } + }, + "AssertionResults": { + "id": "AssertionResults", + "path": "domain-name-mapping-test/DefaultTest/DeployAssert/LambdaInvoke4f2bfb0cc64af0ccca4a6e7b6c3de320/AssertionResults", + "constructInfo": { + "fqn": "@aws-cdk/core.CfnOutput", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests.LambdaInvokeFunction", + "version": "0.0.0" + } + }, + "LambdaInvokef718aff12f12e7e6e6dd823f91dfce23": { + "id": "LambdaInvokef718aff12f12e7e6e6dd823f91dfce23", + "path": "domain-name-mapping-test/DefaultTest/DeployAssert/LambdaInvokef718aff12f12e7e6e6dd823f91dfce23", + "children": { + "SdkProvider": { + "id": "SdkProvider", + "path": "domain-name-mapping-test/DefaultTest/DeployAssert/LambdaInvokef718aff12f12e7e6e6dd823f91dfce23/SdkProvider", + "children": { + "AssertionsProvider": { + "id": "AssertionsProvider", + "path": "domain-name-mapping-test/DefaultTest/DeployAssert/LambdaInvokef718aff12f12e7e6e6dd823f91dfce23/SdkProvider/AssertionsProvider", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.108" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests.AssertionsProvider", + "version": "0.0.0" + } + }, + "Default": { + "id": "Default", + "path": "domain-name-mapping-test/DefaultTest/DeployAssert/LambdaInvokef718aff12f12e7e6e6dd823f91dfce23/Default", + "children": { + "Default": { + "id": "Default", + "path": "domain-name-mapping-test/DefaultTest/DeployAssert/LambdaInvokef718aff12f12e7e6e6dd823f91dfce23/Default/Default", + "constructInfo": { + "fqn": "@aws-cdk/core.CfnResource", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/core.CustomResource", + "version": "0.0.0" + } + }, + "Invoke": { + "id": "Invoke", + "path": "domain-name-mapping-test/DefaultTest/DeployAssert/LambdaInvokef718aff12f12e7e6e6dd823f91dfce23/Invoke", + "constructInfo": { + "fqn": "@aws-cdk/core.CfnResource", + "version": "0.0.0" + } + }, + "AssertionResults": { + "id": "AssertionResults", + "path": "domain-name-mapping-test/DefaultTest/DeployAssert/LambdaInvokef718aff12f12e7e6e6dd823f91dfce23/AssertionResults", + "constructInfo": { + "fqn": "@aws-cdk/core.CfnOutput", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests.LambdaInvokeFunction", + "version": "0.0.0" + } + }, + "LambdaInvoke2025c0c4c97e10064ec08312531cb316": { + "id": "LambdaInvoke2025c0c4c97e10064ec08312531cb316", + "path": "domain-name-mapping-test/DefaultTest/DeployAssert/LambdaInvoke2025c0c4c97e10064ec08312531cb316", + "children": { + "SdkProvider": { + "id": "SdkProvider", + "path": "domain-name-mapping-test/DefaultTest/DeployAssert/LambdaInvoke2025c0c4c97e10064ec08312531cb316/SdkProvider", + "children": { + "AssertionsProvider": { + "id": "AssertionsProvider", + "path": "domain-name-mapping-test/DefaultTest/DeployAssert/LambdaInvoke2025c0c4c97e10064ec08312531cb316/SdkProvider/AssertionsProvider", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.108" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests.AssertionsProvider", + "version": "0.0.0" + } + }, + "Default": { + "id": "Default", + "path": "domain-name-mapping-test/DefaultTest/DeployAssert/LambdaInvoke2025c0c4c97e10064ec08312531cb316/Default", + "children": { + "Default": { + "id": "Default", + "path": "domain-name-mapping-test/DefaultTest/DeployAssert/LambdaInvoke2025c0c4c97e10064ec08312531cb316/Default/Default", + "constructInfo": { + "fqn": "@aws-cdk/core.CfnResource", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/core.CustomResource", + "version": "0.0.0" + } + }, + "Invoke": { + "id": "Invoke", + "path": "domain-name-mapping-test/DefaultTest/DeployAssert/LambdaInvoke2025c0c4c97e10064ec08312531cb316/Invoke", + "constructInfo": { + "fqn": "@aws-cdk/core.CfnResource", + "version": "0.0.0" + } + }, + "AssertionResults": { + "id": "AssertionResults", + "path": "domain-name-mapping-test/DefaultTest/DeployAssert/LambdaInvoke2025c0c4c97e10064ec08312531cb316/AssertionResults", + "constructInfo": { + "fqn": "@aws-cdk/core.CfnOutput", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests.LambdaInvokeFunction", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/core.Stack", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests.IntegTestCase", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests.IntegTest", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/core.App", + "version": "0.0.0" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-apigateway/test/domains.test.ts b/packages/@aws-cdk/aws-apigateway/test/domains.test.ts index 7e054c83d7102..63b70457c2b4d 100644 --- a/packages/@aws-cdk/aws-apigateway/test/domains.test.ts +++ b/packages/@aws-cdk/aws-apigateway/test/domains.test.ts @@ -137,6 +137,209 @@ describe('domains', () => { }); }); + describe('multi-level mapping', () => { + test('can add a multi-level path', () => { + // GIVEN + const stack = new Stack(); + const api = new apigw.RestApi(stack, 'api'); + api.root.addMethod('GET'); + + // WHEN + new apigw.DomainName(stack, 'Domain', { + domainName: 'foo.com', + certificate: acm.Certificate.fromCertificateArn(stack, 'cert', 'arn:aws:acm:us-east-1:1111111:certificate/11-3336f1-44483d-adc7-9cd375c5169d'), + endpointType: apigw.EndpointType.REGIONAL, + mapping: api, + basePath: 'v1/api', + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ApiGatewayV2::ApiMapping', { + 'DomainName': { + 'Ref': 'Domain66AC69E0', + }, + 'ApiId': { + 'Ref': 'apiC8550315', + }, + 'Stage': { + 'Ref': 'apiDeploymentStageprod896C8101', + }, + 'ApiMappingKey': 'v1/api', + }); + }); + + test('throws if endpointType is not REGIONAL', () => { + // GIVEN + const stack = new Stack(); + const api = new apigw.RestApi(stack, 'api'); + api.root.addMethod('GET'); + + // THEN + expect(() => { + new apigw.DomainName(stack, 'Domain', { + domainName: 'foo.com', + certificate: acm.Certificate.fromCertificateArn(stack, 'cert', 'arn:aws:acm:us-east-1:1111111:certificate/11-3336f1-44483d-adc7-9cd375c5169d'), + endpointType: apigw.EndpointType.EDGE, + mapping: api, + basePath: 'v1/api', + }); + }).toThrow(/multi-level basePath is only supported when endpointType is EndpointType.REGIONAL/); + }); + + test('throws if securityPolicy is not TLS_1_2', () => { + // GIVEN + const stack = new Stack(); + const api = new apigw.RestApi(stack, 'api'); + api.root.addMethod('GET'); + + // THEN + expect(() => { + new apigw.DomainName(stack, 'Domain', { + domainName: 'foo.com', + certificate: acm.Certificate.fromCertificateArn(stack, 'cert', 'arn:aws:acm:us-east-1:1111111:certificate/11-3336f1-44483d-adc7-9cd375c5169d'), + mapping: api, + basePath: 'v1/api', + securityPolicy: apigw.SecurityPolicy.TLS_1_0, + }); + }).toThrow(/securityPolicy must be set to TLS_1_2 if multi-level basePath is provided/); + }); + + test('can use addApiMapping', () => { + // GIVEN + const stack = new Stack(); + const api = new apigw.RestApi(stack, 'api'); + api.root.addMethod('GET'); + + // WHEN + const domain = new apigw.DomainName(stack, 'Domain', { + domainName: 'foo.com', + certificate: acm.Certificate.fromCertificateArn(stack, 'cert', 'arn:aws:acm:us-east-1:1111111:certificate/11-3336f1-44483d-adc7-9cd375c5169d'), + }); + domain.addApiMapping(api.deploymentStage); + domain.addApiMapping(api.deploymentStage, { basePath: '//' }); + domain.addApiMapping(api.deploymentStage, { + basePath: 'v1/my-api', + }); + domain.addApiMapping(api.deploymentStage, { + basePath: 'v1//my-api', + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ApiGatewayV2::ApiMapping', { + 'DomainName': { + 'Ref': 'Domain66AC69E0', + }, + 'ApiId': { + 'Ref': 'apiC8550315', + }, + 'Stage': { + 'Ref': 'apiDeploymentStageprod896C8101', + }, + }); + Template.fromStack(stack).hasResourceProperties('AWS::ApiGatewayV2::ApiMapping', { + 'DomainName': { + 'Ref': 'Domain66AC69E0', + }, + 'ApiId': { + 'Ref': 'apiC8550315', + }, + 'Stage': { + 'Ref': 'apiDeploymentStageprod896C8101', + }, + 'ApiMappingKey': '//', + }); + Template.fromStack(stack).hasResourceProperties('AWS::ApiGatewayV2::ApiMapping', { + 'DomainName': { + 'Ref': 'Domain66AC69E0', + }, + 'ApiId': { + 'Ref': 'apiC8550315', + }, + 'Stage': { + 'Ref': 'apiDeploymentStageprod896C8101', + }, + 'ApiMappingKey': 'v1/my-api', + }); + Template.fromStack(stack).hasResourceProperties('AWS::ApiGatewayV2::ApiMapping', { + 'DomainName': { + 'Ref': 'Domain66AC69E0', + }, + 'ApiId': { + 'Ref': 'apiC8550315', + }, + 'Stage': { + 'Ref': 'apiDeploymentStageprod896C8101', + }, + 'ApiMappingKey': 'v1//my-api', + }); + }); + + test('can use addDomainName', () => { + // GIVEN + const stack = new Stack(); + const api = new apigw.RestApi(stack, 'api'); + api.root.addMethod('GET'); + + const domain = api.addDomainName('Domain', { + domainName: 'foo.com', + certificate: acm.Certificate.fromCertificateArn(stack, 'cert', 'arn:aws:acm:us-east-1:1111111:certificate/11-3336f1-44483d-adc7-9cd375c5169d'), + }); + + // WHEN + domain.addApiMapping(api.deploymentStage, { + basePath: 'v1/my-api', + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::ApiGateway::BasePathMapping', { + 'DomainName': { + 'Ref': 'apiDomain6D60CEFD', + }, + 'RestApiId': { + 'Ref': 'apiC8550315', + }, + 'Stage': { + 'Ref': 'apiDeploymentStageprod896C8101', + }, + }); + Template.fromStack(stack).hasResourceProperties('AWS::ApiGatewayV2::ApiMapping', { + 'DomainName': { + 'Ref': 'apiDomain6D60CEFD', + }, + 'ApiId': { + 'Ref': 'apiC8550315', + }, + 'Stage': { + 'Ref': 'apiDeploymentStageprod896C8101', + }, + 'ApiMappingKey': 'v1/my-api', + }); + }); + + test('throws if addBasePathMapping tries to add a mapping for a path that is already mapped', () => { + // GIVEN + const stack = new Stack(); + const api = new apigw.RestApi(stack, 'api'); + api.root.addMethod('GET'); + + // WHEN + const domain = new apigw.DomainName(stack, 'Domain', { + domainName: 'foo.com', + certificate: acm.Certificate.fromCertificateArn(stack, 'cert', 'arn:aws:acm:us-east-1:1111111:certificate/11-3336f1-44483d-adc7-9cd375c5169d'), + mapping: api, + basePath: 'v1/path', + }); + + // THEN + expect(() => { + domain.addApiMapping(api.deploymentStage, { + basePath: 'v1/path', + }); + }).toThrow(/DomainName Domain already has a mapping for path v1\/path/); + }); + + }); + test('"addBasePathMapping" can be used to add base path mapping to the domain', () => { // GIVEN const stack = new Stack(); @@ -313,24 +516,6 @@ describe('domains', () => { }); }); - test('no additional base paths can added if addDomainName was called without a base path', () => { - // GIVEN - const domainName = 'my.domain.com'; - const stack = new Stack(); - const certificate = new acm.Certificate(stack, 'cert', { domainName: 'my.domain.com' }); - - // WHEN - const api = new apigw.RestApi(stack, 'api', {}); - - api.root.addMethod('GET'); - - const dn = api.addDomainName('domainId', { domainName, certificate }); - - expect(() => dn.addBasePathMapping(api, { basePath: 'books' })) - .toThrow(/No additional base paths are allowed/); - }); - - test('domain name cannot contain uppercase letters', () => { // GIVEN const stack = new Stack(); diff --git a/packages/@aws-cdk/aws-apigateway/test/integ.domain-name.ts b/packages/@aws-cdk/aws-apigateway/test/integ.domain-name.ts new file mode 100644 index 0000000000000..f2b106749e136 --- /dev/null +++ b/packages/@aws-cdk/aws-apigateway/test/integ.domain-name.ts @@ -0,0 +1,272 @@ +import { Certificate } from '@aws-cdk/aws-certificatemanager'; +import { Function, Code, Runtime } from '@aws-cdk/aws-lambda'; +import { CfnRecordSet } from '@aws-cdk/aws-route53'; +import * as cdk from '@aws-cdk/core'; +import { + IntegTest, + ExpectedResult, + Match, +} from '@aws-cdk/integ-tests'; +import { Construct } from 'constructs'; +import * as apigw from '../lib'; + +const domainName = process.env.CDK_INTEG_DOMAIN_NAME || process.env.DOMAIN_NAME; +const hostedZoneId = process.env.CDK_INTEG_HOSTED_ZONE_ID || process.env.HOSTED_ZONE_ID; +const certArn = process.env.CDK_INTEG_CERT_ARN || process.env.CERT_ARN; +if (!domainName || !certArn || !hostedZoneId) { + throw new Error('Env vars DOMAIN_NAME, HOSTED_ZONE_ID, and CERT_ARN must be set'); +} + +/** + * ------------------------------------------------------- + * ------------------------- GIVEN------------------------ + * ------------------------------------------------------- + */ +const app = new cdk.App(); +const testCase = new cdk.Stack(app, 'integ-apigw-domain-name-mapping'); + +interface ApiProps { + statusCode: string; + path: string; +} + +class Api extends Construct { + public readonly restApi: apigw.IRestApi; + private readonly resource: apigw.Resource; + constructor(scope: Construct, id: string, props: ApiProps) { + super(scope, id); + this.restApi = new apigw.RestApi(this, 'IntegApi'+props.statusCode, { + endpointTypes: [apigw.EndpointType.REGIONAL], + }); + this.resource = this.restApi.root.addResource(props.path); + const integration = this.createIntegration(props.statusCode); + const options = { + methodResponses: [{ + statusCode: props.statusCode, + }], + }; + this.restApi.root.addMethod('GET', integration, options); + this.resource.addMethod('GET', integration, options); + } + public addResource(path: string, statusCode: string, resource?: apigw.Resource): void { + const subResource = (resource ?? this.resource).addResource(path); + const integration = this.createIntegration(statusCode); + subResource.addMethod('GET', integration, { + methodResponses: [{ statusCode }], + }); + } + public addRootResource(path: string, statusCode: string): apigw.Resource { + const subResource = this.restApi.root.addResource(path); + const integration = this.createIntegration(statusCode); + subResource.addMethod('GET', integration, { + methodResponses: [{ statusCode }], + }); + return subResource; + } + + private createIntegration(statusCode: string): apigw.MockIntegration { + return new apigw.MockIntegration({ + requestTemplates: { 'application/json': `{ statusCode: ${Number(statusCode)} }` }, + integrationResponses: [{ + statusCode: statusCode, + responseTemplates: { + 'application/json': JSON.stringify({ message: 'Hello, world' }), + }, + }], + }); + } +} + +/** + * ------------------------------------------------------- + * ------------------------- WHEN ------------------------ + * ------------------------------------------------------- + */ +const certificate = Certificate.fromCertificateArn(testCase, 'Cert', certArn); +const api1 = new Api(testCase, 'IntegApi1', { + statusCode: '201', + path: 'items', +}); +const api2 = new Api(testCase, 'IntegApi2', { + statusCode: '202', + path: 'items', +}); + + +/** + * Test 1 + * + * Create an initial BasePathMapping for (none) + * Then use a mixture of `addBasePathMapping` and `addApiMapping` + * to test that they can be used together + */ +const domain = new apigw.DomainName(testCase, 'IntegDomain', { + domainName, + securityPolicy: apigw.SecurityPolicy.TLS_1_2, + certificate, + mapping: api1.restApi, +}); +new CfnRecordSet(testCase, 'IntegDomainRecord', { + name: domainName, + type: 'A', + hostedZoneId, + aliasTarget: { + hostedZoneId: domain.domainNameAliasHostedZoneId, + dnsName: domain.domainNameAliasDomainName, + }, +}); +domain.addBasePathMapping(api1.restApi, { + basePath: 'orders', +}); +domain.addApiMapping(api2.restApi.deploymentStage, { + basePath: 'orders/v2', +}); +domain.addApiMapping(api1.restApi.deploymentStage, { + basePath: 'orders/v1', +}); + +/** + * Test 2 + * + * Create an initial BasePathMapping for 'orders' + * and then add an ApiMapping for a multi-level path + */ +const secondDomain = new apigw.DomainName(testCase, 'Integ2Domain', { + domainName: `another-${domainName}`, + securityPolicy: apigw.SecurityPolicy.TLS_1_2, + certificate, + mapping: api1.restApi, + basePath: 'orders', +}); +new CfnRecordSet(testCase, 'Integ2DomainRecord', { + name: `another-${domainName}`, + type: 'A', + hostedZoneId, + aliasTarget: { + hostedZoneId: secondDomain.domainNameAliasHostedZoneId, + dnsName: secondDomain.domainNameAliasDomainName, + }, +}); +secondDomain.addApiMapping(api2.restApi.deploymentStage, { + basePath: 'orders/v2', +}); + + +/** + * Test 3 + * + * Test that you can create an initial BasePathMapping (none) + * and then add additional base path mappings + */ +const thirdDomain = new apigw.DomainName(testCase, 'Integ3Domain', { + domainName: `yet-another-${domainName}`, + securityPolicy: apigw.SecurityPolicy.TLS_1_2, + certificate, + mapping: api1.restApi, +}); +new CfnRecordSet(testCase, 'Integ3DomainRecord', { + name: `yet-another-${domainName}`, + type: 'A', + hostedZoneId, + aliasTarget: { + hostedZoneId: thirdDomain.domainNameAliasHostedZoneId, + dnsName: thirdDomain.domainNameAliasDomainName, + }, +}); +thirdDomain.addBasePathMapping(api2.restApi, { + basePath: 'v2', +}); + + +/** + * ------------------------------------------------------- + * ------------------------- THEN ------------------------ + * ------------------------------------------------------- + */ +const integ = new IntegTest(app, 'domain-name-mapping-test', { + testCases: [testCase], + enableLookups: true, +}); + +const invoke = new Function(testCase, 'InvokeApi', { + code: Code.fromInline(` +const https = require('https'); +exports.handler = async function(event) { + console.log(event); + const options = { + hostname: event.hostname, + path: event.path, + }; + let dataString = ''; + const response = await new Promise((resolve, reject) => { + const req = https.get(options, (res) => { + res.on('data', data => { + dataString += data; + }) + res.on('end', () => { + resolve({ + statusCode: res.statusCode, + body: dataString, + }); + }) + }); + req.on('error', err => { + reject({ + statusCode: 500, + body: JSON.stringify({ + cause: 'Something went wrong', + error: err, + }) + }); + }); + req.end(); + }); + return response; +} + +`), + handler: 'index.handler', + runtime: Runtime.NODEJS_16_X, +}); + +const api1Invoke = integ.assertions.invokeFunction({ + functionName: invoke.functionName, + payload: JSON.stringify({ + hostname: domain.domainName, + path: '/orders/v1/items', + }), +}); +api1Invoke.expect(ExpectedResult.objectLike({ + Payload: Match.stringLikeRegexp('201'), +})); +const api2Invoke = integ.assertions.invokeFunction({ + functionName: invoke.functionName, + payload: JSON.stringify({ + hostname: domain.domainName, + path: '/orders/v2/items', + }), +}); +api2Invoke.expect(ExpectedResult.objectLike({ + Payload: Match.stringLikeRegexp('202'), +})); + +const domain2api1Invoke = integ.assertions.invokeFunction({ + functionName: invoke.functionName, + payload: JSON.stringify({ + hostname: secondDomain.domainName, + path: '/orders/items', + }), +}); +domain2api1Invoke.expect(ExpectedResult.objectLike({ + Payload: Match.stringLikeRegexp('201'), +})); +const domain2api2Invoke = integ.assertions.invokeFunction({ + functionName: invoke.functionName, + payload: JSON.stringify({ + hostname: secondDomain.domainName, + path: '/orders/v2/items', + }), +}); +domain2api2Invoke.expect(ExpectedResult.objectLike({ + Payload: Match.stringLikeRegexp('202'), +})); diff --git a/packages/@aws-cdk/aws-applicationautoscaling/lib/scalable-target.ts b/packages/@aws-cdk/aws-applicationautoscaling/lib/scalable-target.ts index 6b0f4ab30d7a9..f5686e8c13170 100644 --- a/packages/@aws-cdk/aws-applicationautoscaling/lib/scalable-target.ts +++ b/packages/@aws-cdk/aws-applicationautoscaling/lib/scalable-target.ts @@ -290,4 +290,9 @@ export enum ServiceNamespace { * ElastiCache */ ELASTICACHE = 'elasticache', + + /** + * Neptune + */ + NEPTUNE = 'neptune', } diff --git a/packages/@aws-cdk/aws-applicationautoscaling/test/scalable-target.test.ts b/packages/@aws-cdk/aws-applicationautoscaling/test/scalable-target.test.ts index 8cdf9051af1f5..09374187c8333 100644 --- a/packages/@aws-cdk/aws-applicationautoscaling/test/scalable-target.test.ts +++ b/packages/@aws-cdk/aws-applicationautoscaling/test/scalable-target.test.ts @@ -184,6 +184,7 @@ describe('scalable target', () => { expect(appscaling.ServiceNamespace.RDS).toEqual('rds'); expect(appscaling.ServiceNamespace.SAGEMAKER).toEqual('sagemaker'); expect(appscaling.ServiceNamespace.ELASTICACHE).toEqual('elasticache'); + expect(appscaling.ServiceNamespace.NEPTUNE).toEqual('neptune'); }); test('create scalable target with negative minCapacity throws error', () => { diff --git a/packages/@aws-cdk/aws-cognito/lib/user-pool.ts b/packages/@aws-cdk/aws-cognito/lib/user-pool.ts index f3b3514952bcf..1b52f42493c46 100644 --- a/packages/@aws-cdk/aws-cognito/lib/user-pool.ts +++ b/packages/@aws-cdk/aws-cognito/lib/user-pool.ts @@ -980,6 +980,7 @@ export class UserPool extends UserPoolBase { fn.addPermission(`${capitalize}Cognito`, { principal: new ServicePrincipal('cognito-idp.amazonaws.com'), sourceArn: Lazy.string({ produce: () => this.userPoolArn }), + scope: this, }); } diff --git a/packages/@aws-cdk/aws-cognito/test/user-pool-custom-sender.integ.snapshot/cdk.out b/packages/@aws-cdk/aws-cognito/test/user-pool-custom-sender.integ.snapshot/cdk.out index 588d7b269d34f..8ecc185e9dbee 100644 --- a/packages/@aws-cdk/aws-cognito/test/user-pool-custom-sender.integ.snapshot/cdk.out +++ b/packages/@aws-cdk/aws-cognito/test/user-pool-custom-sender.integ.snapshot/cdk.out @@ -1 +1 @@ -{"version":"20.0.0"} \ No newline at end of file +{"version":"21.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cognito/test/user-pool-custom-sender.integ.snapshot/integ-user-pool-custom-sender.assets.json b/packages/@aws-cdk/aws-cognito/test/user-pool-custom-sender.integ.snapshot/integ-user-pool-custom-sender.assets.json index 3de77e9d22f00..23fe11bcb8494 100644 --- a/packages/@aws-cdk/aws-cognito/test/user-pool-custom-sender.integ.snapshot/integ-user-pool-custom-sender.assets.json +++ b/packages/@aws-cdk/aws-cognito/test/user-pool-custom-sender.integ.snapshot/integ-user-pool-custom-sender.assets.json @@ -1,7 +1,7 @@ { - "version": "20.0.0", + "version": "21.0.0", "files": { - "7e21bf24f8c6a20d81ddd4a52096ea99176dc68bcac04483e71b011708134d30": { + "51bd20d4d484317d077ffb92a54630892966b5b3354ea04f9b8ac08cb5d5d1d0": { "source": { "path": "integ-user-pool-custom-sender.template.json", "packaging": "file" @@ -9,7 +9,7 @@ "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "7e21bf24f8c6a20d81ddd4a52096ea99176dc68bcac04483e71b011708134d30.json", + "objectKey": "51bd20d4d484317d077ffb92a54630892966b5b3354ea04f9b8ac08cb5d5d1d0.json", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } diff --git a/packages/@aws-cdk/aws-cognito/test/user-pool-custom-sender.integ.snapshot/integ-user-pool-custom-sender.template.json b/packages/@aws-cdk/aws-cognito/test/user-pool-custom-sender.integ.snapshot/integ-user-pool-custom-sender.template.json index 1292eeec8dc9b..30e19f87d3261 100644 --- a/packages/@aws-cdk/aws-cognito/test/user-pool-custom-sender.integ.snapshot/integ-user-pool-custom-sender.template.json +++ b/packages/@aws-cdk/aws-cognito/test/user-pool-custom-sender.integ.snapshot/integ-user-pool-custom-sender.template.json @@ -50,25 +50,6 @@ "emailLambdaServiceRole7569D9F6" ] }, - "emailLambdaCustomEmailSenderCognito5E15D907": { - "Type": "AWS::Lambda::Permission", - "Properties": { - "Action": "lambda:InvokeFunction", - "FunctionName": { - "Fn::GetAtt": [ - "emailLambda61F82360", - "Arn" - ] - }, - "Principal": "cognito-idp.amazonaws.com", - "SourceArn": { - "Fn::GetAtt": [ - "pool056F3F7E", - "Arn" - ] - } - } - }, "keyFEDD6EC0": { "Type": "AWS::KMS::Key", "Properties": { @@ -104,6 +85,25 @@ "UpdateReplacePolicy": "Retain", "DeletionPolicy": "Retain" }, + "poolCustomEmailSenderCognitoE3D88E99": { + "Type": "AWS::Lambda::Permission", + "Properties": { + "Action": "lambda:InvokeFunction", + "FunctionName": { + "Fn::GetAtt": [ + "emailLambda61F82360", + "Arn" + ] + }, + "Principal": "cognito-idp.amazonaws.com", + "SourceArn": { + "Fn::GetAtt": [ + "pool056F3F7E", + "Arn" + ] + } + } + }, "pool056F3F7E": { "Type": "AWS::Cognito::UserPool", "Properties": { diff --git a/packages/@aws-cdk/aws-cognito/test/user-pool-custom-sender.integ.snapshot/integ.json b/packages/@aws-cdk/aws-cognito/test/user-pool-custom-sender.integ.snapshot/integ.json index 9b88272ab2446..d6a4a167f5bde 100644 --- a/packages/@aws-cdk/aws-cognito/test/user-pool-custom-sender.integ.snapshot/integ.json +++ b/packages/@aws-cdk/aws-cognito/test/user-pool-custom-sender.integ.snapshot/integ.json @@ -1,5 +1,5 @@ { - "version": "20.0.0", + "version": "21.0.0", "testCases": { "integ.user-pool-custom-sender": { "stacks": [ diff --git a/packages/@aws-cdk/aws-cognito/test/user-pool-custom-sender.integ.snapshot/manifest.json b/packages/@aws-cdk/aws-cognito/test/user-pool-custom-sender.integ.snapshot/manifest.json index 2903f3f321776..facf04ad09d84 100644 --- a/packages/@aws-cdk/aws-cognito/test/user-pool-custom-sender.integ.snapshot/manifest.json +++ b/packages/@aws-cdk/aws-cognito/test/user-pool-custom-sender.integ.snapshot/manifest.json @@ -1,5 +1,5 @@ { - "version": "20.0.0", + "version": "21.0.0", "artifacts": { "Tree": { "type": "cdk:tree", @@ -23,7 +23,7 @@ "validateOnSynth": false, "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/7e21bf24f8c6a20d81ddd4a52096ea99176dc68bcac04483e71b011708134d30.json", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/51bd20d4d484317d077ffb92a54630892966b5b3354ea04f9b8ac08cb5d5d1d0.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", "additionalDependencies": [ @@ -51,16 +51,16 @@ "data": "emailLambda61F82360" } ], - "/integ-user-pool-custom-sender/emailLambda/CustomEmailSenderCognito": [ + "/integ-user-pool-custom-sender/key/Resource": [ { "type": "aws:cdk:logicalId", - "data": "emailLambdaCustomEmailSenderCognito5E15D907" + "data": "keyFEDD6EC0" } ], - "/integ-user-pool-custom-sender/key/Resource": [ + "/integ-user-pool-custom-sender/pool/CustomEmailSenderCognito": [ { "type": "aws:cdk:logicalId", - "data": "keyFEDD6EC0" + "data": "poolCustomEmailSenderCognitoE3D88E99" } ], "/integ-user-pool-custom-sender/pool/Resource": [ @@ -98,6 +98,15 @@ "type": "aws:cdk:logicalId", "data": "CheckBootstrapVersion" } + ], + "emailLambdaCustomEmailSenderCognito5E15D907": [ + { + "type": "aws:cdk:logicalId", + "data": "emailLambdaCustomEmailSenderCognito5E15D907", + "trace": [ + "!!DESTRUCTIVE_CHANGES: WILL_DESTROY" + ] + } ] }, "displayName": "integ-user-pool-custom-sender" diff --git a/packages/@aws-cdk/aws-cognito/test/user-pool-custom-sender.integ.snapshot/tree.json b/packages/@aws-cdk/aws-cognito/test/user-pool-custom-sender.integ.snapshot/tree.json index e6053906c3300..f8e3274704efa 100644 --- a/packages/@aws-cdk/aws-cognito/test/user-pool-custom-sender.integ.snapshot/tree.json +++ b/packages/@aws-cdk/aws-cognito/test/user-pool-custom-sender.integ.snapshot/tree.json @@ -9,7 +9,7 @@ "path": "Tree", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.1.85" + "version": "10.1.123" } }, "integ-user-pool-custom-sender": { @@ -92,33 +92,6 @@ "fqn": "@aws-cdk/aws-lambda.CfnFunction", "version": "0.0.0" } - }, - "CustomEmailSenderCognito": { - "id": "CustomEmailSenderCognito", - "path": "integ-user-pool-custom-sender/emailLambda/CustomEmailSenderCognito", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::Lambda::Permission", - "aws:cdk:cloudformation:props": { - "action": "lambda:InvokeFunction", - "functionName": { - "Fn::GetAtt": [ - "emailLambda61F82360", - "Arn" - ] - }, - "principal": "cognito-idp.amazonaws.com", - "sourceArn": { - "Fn::GetAtt": [ - "pool056F3F7E", - "Arn" - ] - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-lambda.CfnPermission", - "version": "0.0.0" - } } }, "constructInfo": { @@ -181,6 +154,33 @@ "id": "pool", "path": "integ-user-pool-custom-sender/pool", "children": { + "CustomEmailSenderCognito": { + "id": "CustomEmailSenderCognito", + "path": "integ-user-pool-custom-sender/pool/CustomEmailSenderCognito", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::Lambda::Permission", + "aws:cdk:cloudformation:props": { + "action": "lambda:InvokeFunction", + "functionName": { + "Fn::GetAtt": [ + "emailLambda61F82360", + "Arn" + ] + }, + "principal": "cognito-idp.amazonaws.com", + "sourceArn": { + "Fn::GetAtt": [ + "pool056F3F7E", + "Arn" + ] + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-lambda.CfnPermission", + "version": "0.0.0" + } + }, "Resource": { "id": "Resource", "path": "integ-user-pool-custom-sender/pool/Resource", @@ -299,28 +299,28 @@ "id": "UserPoolId", "path": "integ-user-pool-custom-sender/UserPoolId", "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.85" + "fqn": "@aws-cdk/core.CfnOutput", + "version": "0.0.0" } }, "ClientId": { "id": "ClientId", "path": "integ-user-pool-custom-sender/ClientId", "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.85" + "fqn": "@aws-cdk/core.CfnOutput", + "version": "0.0.0" } } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.85" + "fqn": "@aws-cdk/core.Stack", + "version": "0.0.0" } } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.85" + "fqn": "@aws-cdk/core.App", + "version": "0.0.0" } } } \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cognito/test/user-pool-explicit-props.integ.snapshot/cdk.out b/packages/@aws-cdk/aws-cognito/test/user-pool-explicit-props.integ.snapshot/cdk.out index 588d7b269d34f..8ecc185e9dbee 100644 --- a/packages/@aws-cdk/aws-cognito/test/user-pool-explicit-props.integ.snapshot/cdk.out +++ b/packages/@aws-cdk/aws-cognito/test/user-pool-explicit-props.integ.snapshot/cdk.out @@ -1 +1 @@ -{"version":"20.0.0"} \ No newline at end of file +{"version":"21.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cognito/test/user-pool-explicit-props.integ.snapshot/integ-user-pool.assets.json b/packages/@aws-cdk/aws-cognito/test/user-pool-explicit-props.integ.snapshot/integ-user-pool.assets.json index 55c737535c051..3993c765c773e 100644 --- a/packages/@aws-cdk/aws-cognito/test/user-pool-explicit-props.integ.snapshot/integ-user-pool.assets.json +++ b/packages/@aws-cdk/aws-cognito/test/user-pool-explicit-props.integ.snapshot/integ-user-pool.assets.json @@ -1,7 +1,7 @@ { - "version": "20.0.0", + "version": "21.0.0", "files": { - "8bbf60047c97c5bdfc69a2679a633a8e0a90eee3419768262c5e1fea7b903a71": { + "7df3ca05ace569184cc645d485b05885dc2e13f745606873a57afa9d264ecc08": { "source": { "path": "integ-user-pool.template.json", "packaging": "file" @@ -9,7 +9,7 @@ "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "8bbf60047c97c5bdfc69a2679a633a8e0a90eee3419768262c5e1fea7b903a71.json", + "objectKey": "7df3ca05ace569184cc645d485b05885dc2e13f745606873a57afa9d264ecc08.json", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } diff --git a/packages/@aws-cdk/aws-cognito/test/user-pool-explicit-props.integ.snapshot/integ-user-pool.template.json b/packages/@aws-cdk/aws-cognito/test/user-pool-explicit-props.integ.snapshot/integ-user-pool.template.json index f93d7a4490a53..e8d562b64cc60 100644 --- a/packages/@aws-cdk/aws-cognito/test/user-pool-explicit-props.integ.snapshot/integ-user-pool.template.json +++ b/packages/@aws-cdk/aws-cognito/test/user-pool-explicit-props.integ.snapshot/integ-user-pool.template.json @@ -51,25 +51,6 @@ "createAuthChallengeServiceRole611710B5" ] }, - "createAuthChallengeCreateAuthChallengeCognito57E2297E": { - "Type": "AWS::Lambda::Permission", - "Properties": { - "Action": "lambda:InvokeFunction", - "FunctionName": { - "Fn::GetAtt": [ - "createAuthChallengeB185B225", - "Arn" - ] - }, - "Principal": "cognito-idp.amazonaws.com", - "SourceArn": { - "Fn::GetAtt": [ - "myuserpool01998219", - "Arn" - ] - } - } - }, "customMessageServiceRoleB4AE7F17": { "Type": "AWS::IAM::Role", "Properties": { @@ -121,25 +102,6 @@ "customMessageServiceRoleB4AE7F17" ] }, - "customMessageCustomMessageCognitoB4F894A6": { - "Type": "AWS::Lambda::Permission", - "Properties": { - "Action": "lambda:InvokeFunction", - "FunctionName": { - "Fn::GetAtt": [ - "customMessage52BA91E2", - "Arn" - ] - }, - "Principal": "cognito-idp.amazonaws.com", - "SourceArn": { - "Fn::GetAtt": [ - "myuserpool01998219", - "Arn" - ] - } - } - }, "defineAuthChallengeServiceRole9E2D15DF": { "Type": "AWS::IAM::Role", "Properties": { @@ -191,25 +153,6 @@ "defineAuthChallengeServiceRole9E2D15DF" ] }, - "defineAuthChallengeDefineAuthChallengeCognito4DBD8021": { - "Type": "AWS::Lambda::Permission", - "Properties": { - "Action": "lambda:InvokeFunction", - "FunctionName": { - "Fn::GetAtt": [ - "defineAuthChallengeAE7BCDA1", - "Arn" - ] - }, - "Principal": "cognito-idp.amazonaws.com", - "SourceArn": { - "Fn::GetAtt": [ - "myuserpool01998219", - "Arn" - ] - } - } - }, "postAuthenticationServiceRole5B3B242A": { "Type": "AWS::IAM::Role", "Properties": { @@ -261,25 +204,6 @@ "postAuthenticationServiceRole5B3B242A" ] }, - "postAuthenticationPostAuthenticationCognito8B923BC3": { - "Type": "AWS::Lambda::Permission", - "Properties": { - "Action": "lambda:InvokeFunction", - "FunctionName": { - "Fn::GetAtt": [ - "postAuthentication741BD8E3", - "Arn" - ] - }, - "Principal": "cognito-idp.amazonaws.com", - "SourceArn": { - "Fn::GetAtt": [ - "myuserpool01998219", - "Arn" - ] - } - } - }, "postConfirmationServiceRole864BE5F9": { "Type": "AWS::IAM::Role", "Properties": { @@ -331,25 +255,6 @@ "postConfirmationServiceRole864BE5F9" ] }, - "postConfirmationPostConfirmationCognito9D010393": { - "Type": "AWS::Lambda::Permission", - "Properties": { - "Action": "lambda:InvokeFunction", - "FunctionName": { - "Fn::GetAtt": [ - "postConfirmationD5E3F1DD", - "Arn" - ] - }, - "Principal": "cognito-idp.amazonaws.com", - "SourceArn": { - "Fn::GetAtt": [ - "myuserpool01998219", - "Arn" - ] - } - } - }, "preAuthenticationServiceRole9712F4D8": { "Type": "AWS::IAM::Role", "Properties": { @@ -401,25 +306,6 @@ "preAuthenticationServiceRole9712F4D8" ] }, - "preAuthenticationPreAuthenticationCognito67FACB54": { - "Type": "AWS::Lambda::Permission", - "Properties": { - "Action": "lambda:InvokeFunction", - "FunctionName": { - "Fn::GetAtt": [ - "preAuthentication56F78C81", - "Arn" - ] - }, - "Principal": "cognito-idp.amazonaws.com", - "SourceArn": { - "Fn::GetAtt": [ - "myuserpool01998219", - "Arn" - ] - } - } - }, "preSignUpServiceRole0A7E91EB": { "Type": "AWS::IAM::Role", "Properties": { @@ -471,25 +357,6 @@ "preSignUpServiceRole0A7E91EB" ] }, - "preSignUpPreSignUpCognitoE986CC53": { - "Type": "AWS::Lambda::Permission", - "Properties": { - "Action": "lambda:InvokeFunction", - "FunctionName": { - "Fn::GetAtt": [ - "preSignUp1934B27C", - "Arn" - ] - }, - "Principal": "cognito-idp.amazonaws.com", - "SourceArn": { - "Fn::GetAtt": [ - "myuserpool01998219", - "Arn" - ] - } - } - }, "preTokenGenerationServiceRole430C3D14": { "Type": "AWS::IAM::Role", "Properties": { @@ -541,25 +408,6 @@ "preTokenGenerationServiceRole430C3D14" ] }, - "preTokenGenerationPreTokenGenerationCognitoC1959918": { - "Type": "AWS::Lambda::Permission", - "Properties": { - "Action": "lambda:InvokeFunction", - "FunctionName": { - "Fn::GetAtt": [ - "preTokenGeneration1E968302", - "Arn" - ] - }, - "Principal": "cognito-idp.amazonaws.com", - "SourceArn": { - "Fn::GetAtt": [ - "myuserpool01998219", - "Arn" - ] - } - } - }, "userMigrationServiceRole091766B0": { "Type": "AWS::IAM::Role", "Properties": { @@ -611,25 +459,6 @@ "userMigrationServiceRole091766B0" ] }, - "userMigrationUserMigrationCognito29EEC4AD": { - "Type": "AWS::Lambda::Permission", - "Properties": { - "Action": "lambda:InvokeFunction", - "FunctionName": { - "Fn::GetAtt": [ - "userMigrationAAA960EC", - "Arn" - ] - }, - "Principal": "cognito-idp.amazonaws.com", - "SourceArn": { - "Fn::GetAtt": [ - "myuserpool01998219", - "Arn" - ] - } - } - }, "verifyAuthChallengeResponseServiceRole7077884C": { "Type": "AWS::IAM::Role", "Properties": { @@ -681,7 +510,178 @@ "verifyAuthChallengeResponseServiceRole7077884C" ] }, - "verifyAuthChallengeResponseVerifyAuthChallengeResponseCognito9DC48AFC": { + "myuserpoolCreateAuthChallengeCognitoCE4A6821": { + "Type": "AWS::Lambda::Permission", + "Properties": { + "Action": "lambda:InvokeFunction", + "FunctionName": { + "Fn::GetAtt": [ + "createAuthChallengeB185B225", + "Arn" + ] + }, + "Principal": "cognito-idp.amazonaws.com", + "SourceArn": { + "Fn::GetAtt": [ + "myuserpool01998219", + "Arn" + ] + } + } + }, + "myuserpoolCustomMessageCognito8057432C": { + "Type": "AWS::Lambda::Permission", + "Properties": { + "Action": "lambda:InvokeFunction", + "FunctionName": { + "Fn::GetAtt": [ + "customMessage52BA91E2", + "Arn" + ] + }, + "Principal": "cognito-idp.amazonaws.com", + "SourceArn": { + "Fn::GetAtt": [ + "myuserpool01998219", + "Arn" + ] + } + } + }, + "myuserpoolDefineAuthChallengeCognito81526ECF": { + "Type": "AWS::Lambda::Permission", + "Properties": { + "Action": "lambda:InvokeFunction", + "FunctionName": { + "Fn::GetAtt": [ + "defineAuthChallengeAE7BCDA1", + "Arn" + ] + }, + "Principal": "cognito-idp.amazonaws.com", + "SourceArn": { + "Fn::GetAtt": [ + "myuserpool01998219", + "Arn" + ] + } + } + }, + "myuserpoolPostAuthenticationCognito83D5BAE9": { + "Type": "AWS::Lambda::Permission", + "Properties": { + "Action": "lambda:InvokeFunction", + "FunctionName": { + "Fn::GetAtt": [ + "postAuthentication741BD8E3", + "Arn" + ] + }, + "Principal": "cognito-idp.amazonaws.com", + "SourceArn": { + "Fn::GetAtt": [ + "myuserpool01998219", + "Arn" + ] + } + } + }, + "myuserpoolPostConfirmationCognitoB4F79E1C": { + "Type": "AWS::Lambda::Permission", + "Properties": { + "Action": "lambda:InvokeFunction", + "FunctionName": { + "Fn::GetAtt": [ + "postConfirmationD5E3F1DD", + "Arn" + ] + }, + "Principal": "cognito-idp.amazonaws.com", + "SourceArn": { + "Fn::GetAtt": [ + "myuserpool01998219", + "Arn" + ] + } + } + }, + "myuserpoolPreAuthenticationCognitoE1C7AED3": { + "Type": "AWS::Lambda::Permission", + "Properties": { + "Action": "lambda:InvokeFunction", + "FunctionName": { + "Fn::GetAtt": [ + "preAuthentication56F78C81", + "Arn" + ] + }, + "Principal": "cognito-idp.amazonaws.com", + "SourceArn": { + "Fn::GetAtt": [ + "myuserpool01998219", + "Arn" + ] + } + } + }, + "myuserpoolPreSignUpCognitoD6CE8CAD": { + "Type": "AWS::Lambda::Permission", + "Properties": { + "Action": "lambda:InvokeFunction", + "FunctionName": { + "Fn::GetAtt": [ + "preSignUp1934B27C", + "Arn" + ] + }, + "Principal": "cognito-idp.amazonaws.com", + "SourceArn": { + "Fn::GetAtt": [ + "myuserpool01998219", + "Arn" + ] + } + } + }, + "myuserpoolPreTokenGenerationCognitoF1714665": { + "Type": "AWS::Lambda::Permission", + "Properties": { + "Action": "lambda:InvokeFunction", + "FunctionName": { + "Fn::GetAtt": [ + "preTokenGeneration1E968302", + "Arn" + ] + }, + "Principal": "cognito-idp.amazonaws.com", + "SourceArn": { + "Fn::GetAtt": [ + "myuserpool01998219", + "Arn" + ] + } + } + }, + "myuserpoolUserMigrationCognito56734AFB": { + "Type": "AWS::Lambda::Permission", + "Properties": { + "Action": "lambda:InvokeFunction", + "FunctionName": { + "Fn::GetAtt": [ + "userMigrationAAA960EC", + "Arn" + ] + }, + "Principal": "cognito-idp.amazonaws.com", + "SourceArn": { + "Fn::GetAtt": [ + "myuserpool01998219", + "Arn" + ] + } + } + }, + "myuserpoolVerifyAuthChallengeResponseCognitoAEAB40FD": { "Type": "AWS::Lambda::Permission", "Properties": { "Action": "lambda:InvokeFunction", diff --git a/packages/@aws-cdk/aws-cognito/test/user-pool-explicit-props.integ.snapshot/integ.json b/packages/@aws-cdk/aws-cognito/test/user-pool-explicit-props.integ.snapshot/integ.json index fe5de8ab7d52e..3f63a187791d6 100644 --- a/packages/@aws-cdk/aws-cognito/test/user-pool-explicit-props.integ.snapshot/integ.json +++ b/packages/@aws-cdk/aws-cognito/test/user-pool-explicit-props.integ.snapshot/integ.json @@ -1,5 +1,5 @@ { - "version": "20.0.0", + "version": "21.0.0", "testCases": { "integ.user-pool-explicit-props": { "stacks": [ diff --git a/packages/@aws-cdk/aws-cognito/test/user-pool-explicit-props.integ.snapshot/manifest.json b/packages/@aws-cdk/aws-cognito/test/user-pool-explicit-props.integ.snapshot/manifest.json index 7c8c1b260881a..8934cd44cef53 100644 --- a/packages/@aws-cdk/aws-cognito/test/user-pool-explicit-props.integ.snapshot/manifest.json +++ b/packages/@aws-cdk/aws-cognito/test/user-pool-explicit-props.integ.snapshot/manifest.json @@ -1,5 +1,5 @@ { - "version": "20.0.0", + "version": "21.0.0", "artifacts": { "Tree": { "type": "cdk:tree", @@ -23,7 +23,7 @@ "validateOnSynth": false, "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/8bbf60047c97c5bdfc69a2679a633a8e0a90eee3419768262c5e1fea7b903a71.json", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/7df3ca05ace569184cc645d485b05885dc2e13f745606873a57afa9d264ecc08.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", "additionalDependencies": [ @@ -51,12 +51,6 @@ "data": "createAuthChallengeB185B225" } ], - "/integ-user-pool/createAuthChallenge/CreateAuthChallengeCognito": [ - { - "type": "aws:cdk:logicalId", - "data": "createAuthChallengeCreateAuthChallengeCognito57E2297E" - } - ], "/integ-user-pool/customMessage/ServiceRole/Resource": [ { "type": "aws:cdk:logicalId", @@ -69,12 +63,6 @@ "data": "customMessage52BA91E2" } ], - "/integ-user-pool/customMessage/CustomMessageCognito": [ - { - "type": "aws:cdk:logicalId", - "data": "customMessageCustomMessageCognitoB4F894A6" - } - ], "/integ-user-pool/defineAuthChallenge/ServiceRole/Resource": [ { "type": "aws:cdk:logicalId", @@ -87,12 +75,6 @@ "data": "defineAuthChallengeAE7BCDA1" } ], - "/integ-user-pool/defineAuthChallenge/DefineAuthChallengeCognito": [ - { - "type": "aws:cdk:logicalId", - "data": "defineAuthChallengeDefineAuthChallengeCognito4DBD8021" - } - ], "/integ-user-pool/postAuthentication/ServiceRole/Resource": [ { "type": "aws:cdk:logicalId", @@ -105,12 +87,6 @@ "data": "postAuthentication741BD8E3" } ], - "/integ-user-pool/postAuthentication/PostAuthenticationCognito": [ - { - "type": "aws:cdk:logicalId", - "data": "postAuthenticationPostAuthenticationCognito8B923BC3" - } - ], "/integ-user-pool/postConfirmation/ServiceRole/Resource": [ { "type": "aws:cdk:logicalId", @@ -123,12 +99,6 @@ "data": "postConfirmationD5E3F1DD" } ], - "/integ-user-pool/postConfirmation/PostConfirmationCognito": [ - { - "type": "aws:cdk:logicalId", - "data": "postConfirmationPostConfirmationCognito9D010393" - } - ], "/integ-user-pool/preAuthentication/ServiceRole/Resource": [ { "type": "aws:cdk:logicalId", @@ -141,12 +111,6 @@ "data": "preAuthentication56F78C81" } ], - "/integ-user-pool/preAuthentication/PreAuthenticationCognito": [ - { - "type": "aws:cdk:logicalId", - "data": "preAuthenticationPreAuthenticationCognito67FACB54" - } - ], "/integ-user-pool/preSignUp/ServiceRole/Resource": [ { "type": "aws:cdk:logicalId", @@ -159,12 +123,6 @@ "data": "preSignUp1934B27C" } ], - "/integ-user-pool/preSignUp/PreSignUpCognito": [ - { - "type": "aws:cdk:logicalId", - "data": "preSignUpPreSignUpCognitoE986CC53" - } - ], "/integ-user-pool/preTokenGeneration/ServiceRole/Resource": [ { "type": "aws:cdk:logicalId", @@ -177,12 +135,6 @@ "data": "preTokenGeneration1E968302" } ], - "/integ-user-pool/preTokenGeneration/PreTokenGenerationCognito": [ - { - "type": "aws:cdk:logicalId", - "data": "preTokenGenerationPreTokenGenerationCognitoC1959918" - } - ], "/integ-user-pool/userMigration/ServiceRole/Resource": [ { "type": "aws:cdk:logicalId", @@ -195,12 +147,6 @@ "data": "userMigrationAAA960EC" } ], - "/integ-user-pool/userMigration/UserMigrationCognito": [ - { - "type": "aws:cdk:logicalId", - "data": "userMigrationUserMigrationCognito29EEC4AD" - } - ], "/integ-user-pool/verifyAuthChallengeResponse/ServiceRole/Resource": [ { "type": "aws:cdk:logicalId", @@ -213,10 +159,64 @@ "data": "verifyAuthChallengeResponse211FE4A6" } ], - "/integ-user-pool/verifyAuthChallengeResponse/VerifyAuthChallengeResponseCognito": [ + "/integ-user-pool/myuserpool/CreateAuthChallengeCognito": [ + { + "type": "aws:cdk:logicalId", + "data": "myuserpoolCreateAuthChallengeCognitoCE4A6821" + } + ], + "/integ-user-pool/myuserpool/CustomMessageCognito": [ + { + "type": "aws:cdk:logicalId", + "data": "myuserpoolCustomMessageCognito8057432C" + } + ], + "/integ-user-pool/myuserpool/DefineAuthChallengeCognito": [ + { + "type": "aws:cdk:logicalId", + "data": "myuserpoolDefineAuthChallengeCognito81526ECF" + } + ], + "/integ-user-pool/myuserpool/PostAuthenticationCognito": [ + { + "type": "aws:cdk:logicalId", + "data": "myuserpoolPostAuthenticationCognito83D5BAE9" + } + ], + "/integ-user-pool/myuserpool/PostConfirmationCognito": [ + { + "type": "aws:cdk:logicalId", + "data": "myuserpoolPostConfirmationCognitoB4F79E1C" + } + ], + "/integ-user-pool/myuserpool/PreAuthenticationCognito": [ { "type": "aws:cdk:logicalId", - "data": "verifyAuthChallengeResponseVerifyAuthChallengeResponseCognito9DC48AFC" + "data": "myuserpoolPreAuthenticationCognitoE1C7AED3" + } + ], + "/integ-user-pool/myuserpool/PreSignUpCognito": [ + { + "type": "aws:cdk:logicalId", + "data": "myuserpoolPreSignUpCognitoD6CE8CAD" + } + ], + "/integ-user-pool/myuserpool/PreTokenGenerationCognito": [ + { + "type": "aws:cdk:logicalId", + "data": "myuserpoolPreTokenGenerationCognitoF1714665" + } + ], + "/integ-user-pool/myuserpool/UserMigrationCognito": [ + { + "type": "aws:cdk:logicalId", + "data": "myuserpoolUserMigrationCognito56734AFB" + } + ], + "/integ-user-pool/myuserpool/VerifyAuthChallengeResponseCognito": [ + { + "type": "aws:cdk:logicalId", + "data": "myuserpoolVerifyAuthChallengeResponseCognitoAEAB40FD" } ], "/integ-user-pool/myuserpool/smsRole/Resource": [ @@ -260,6 +260,96 @@ "type": "aws:cdk:logicalId", "data": "CheckBootstrapVersion" } + ], + "createAuthChallengeCreateAuthChallengeCognito57E2297E": [ + { + "type": "aws:cdk:logicalId", + "data": "createAuthChallengeCreateAuthChallengeCognito57E2297E", + "trace": [ + "!!DESTRUCTIVE_CHANGES: WILL_DESTROY" + ] + } + ], + "customMessageCustomMessageCognitoB4F894A6": [ + { + "type": "aws:cdk:logicalId", + "data": "customMessageCustomMessageCognitoB4F894A6", + "trace": [ + "!!DESTRUCTIVE_CHANGES: WILL_DESTROY" + ] + } + ], + "defineAuthChallengeDefineAuthChallengeCognito4DBD8021": [ + { + "type": "aws:cdk:logicalId", + "data": "defineAuthChallengeDefineAuthChallengeCognito4DBD8021", + "trace": [ + "!!DESTRUCTIVE_CHANGES: WILL_DESTROY" + ] + } + ], + "postAuthenticationPostAuthenticationCognito8B923BC3": [ + { + "type": "aws:cdk:logicalId", + "data": "postAuthenticationPostAuthenticationCognito8B923BC3", + "trace": [ + "!!DESTRUCTIVE_CHANGES: WILL_DESTROY" + ] + } + ], + "postConfirmationPostConfirmationCognito9D010393": [ + { + "type": "aws:cdk:logicalId", + "data": "postConfirmationPostConfirmationCognito9D010393", + "trace": [ + "!!DESTRUCTIVE_CHANGES: WILL_DESTROY" + ] + } + ], + "preAuthenticationPreAuthenticationCognito67FACB54": [ + { + "type": "aws:cdk:logicalId", + "data": "preAuthenticationPreAuthenticationCognito67FACB54", + "trace": [ + "!!DESTRUCTIVE_CHANGES: WILL_DESTROY" + ] + } + ], + "preSignUpPreSignUpCognitoE986CC53": [ + { + "type": "aws:cdk:logicalId", + "data": "preSignUpPreSignUpCognitoE986CC53", + "trace": [ + "!!DESTRUCTIVE_CHANGES: WILL_DESTROY" + ] + } + ], + "preTokenGenerationPreTokenGenerationCognitoC1959918": [ + { + "type": "aws:cdk:logicalId", + "data": "preTokenGenerationPreTokenGenerationCognitoC1959918", + "trace": [ + "!!DESTRUCTIVE_CHANGES: WILL_DESTROY" + ] + } + ], + "userMigrationUserMigrationCognito29EEC4AD": [ + { + "type": "aws:cdk:logicalId", + "data": "userMigrationUserMigrationCognito29EEC4AD", + "trace": [ + "!!DESTRUCTIVE_CHANGES: WILL_DESTROY" + ] + } + ], + "verifyAuthChallengeResponseVerifyAuthChallengeResponseCognito9DC48AFC": [ + { + "type": "aws:cdk:logicalId", + "data": "verifyAuthChallengeResponseVerifyAuthChallengeResponseCognito9DC48AFC", + "trace": [ + "!!DESTRUCTIVE_CHANGES: WILL_DESTROY" + ] + } ] }, "displayName": "integ-user-pool" diff --git a/packages/@aws-cdk/aws-cognito/test/user-pool-explicit-props.integ.snapshot/tree.json b/packages/@aws-cdk/aws-cognito/test/user-pool-explicit-props.integ.snapshot/tree.json index aeea487ff9dcf..15fe1267a751d 100644 --- a/packages/@aws-cdk/aws-cognito/test/user-pool-explicit-props.integ.snapshot/tree.json +++ b/packages/@aws-cdk/aws-cognito/test/user-pool-explicit-props.integ.snapshot/tree.json @@ -9,7 +9,7 @@ "path": "Tree", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.1.85" + "version": "10.1.123" } }, "integ-user-pool": { @@ -93,33 +93,6 @@ "fqn": "@aws-cdk/aws-lambda.CfnFunction", "version": "0.0.0" } - }, - "CreateAuthChallengeCognito": { - "id": "CreateAuthChallengeCognito", - "path": "integ-user-pool/createAuthChallenge/CreateAuthChallengeCognito", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::Lambda::Permission", - "aws:cdk:cloudformation:props": { - "action": "lambda:InvokeFunction", - "functionName": { - "Fn::GetAtt": [ - "createAuthChallengeB185B225", - "Arn" - ] - }, - "principal": "cognito-idp.amazonaws.com", - "sourceArn": { - "Fn::GetAtt": [ - "myuserpool01998219", - "Arn" - ] - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-lambda.CfnPermission", - "version": "0.0.0" - } } }, "constructInfo": { @@ -204,33 +177,6 @@ "fqn": "@aws-cdk/aws-lambda.CfnFunction", "version": "0.0.0" } - }, - "CustomMessageCognito": { - "id": "CustomMessageCognito", - "path": "integ-user-pool/customMessage/CustomMessageCognito", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::Lambda::Permission", - "aws:cdk:cloudformation:props": { - "action": "lambda:InvokeFunction", - "functionName": { - "Fn::GetAtt": [ - "customMessage52BA91E2", - "Arn" - ] - }, - "principal": "cognito-idp.amazonaws.com", - "sourceArn": { - "Fn::GetAtt": [ - "myuserpool01998219", - "Arn" - ] - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-lambda.CfnPermission", - "version": "0.0.0" - } } }, "constructInfo": { @@ -315,33 +261,6 @@ "fqn": "@aws-cdk/aws-lambda.CfnFunction", "version": "0.0.0" } - }, - "DefineAuthChallengeCognito": { - "id": "DefineAuthChallengeCognito", - "path": "integ-user-pool/defineAuthChallenge/DefineAuthChallengeCognito", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::Lambda::Permission", - "aws:cdk:cloudformation:props": { - "action": "lambda:InvokeFunction", - "functionName": { - "Fn::GetAtt": [ - "defineAuthChallengeAE7BCDA1", - "Arn" - ] - }, - "principal": "cognito-idp.amazonaws.com", - "sourceArn": { - "Fn::GetAtt": [ - "myuserpool01998219", - "Arn" - ] - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-lambda.CfnPermission", - "version": "0.0.0" - } } }, "constructInfo": { @@ -426,33 +345,6 @@ "fqn": "@aws-cdk/aws-lambda.CfnFunction", "version": "0.0.0" } - }, - "PostAuthenticationCognito": { - "id": "PostAuthenticationCognito", - "path": "integ-user-pool/postAuthentication/PostAuthenticationCognito", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::Lambda::Permission", - "aws:cdk:cloudformation:props": { - "action": "lambda:InvokeFunction", - "functionName": { - "Fn::GetAtt": [ - "postAuthentication741BD8E3", - "Arn" - ] - }, - "principal": "cognito-idp.amazonaws.com", - "sourceArn": { - "Fn::GetAtt": [ - "myuserpool01998219", - "Arn" - ] - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-lambda.CfnPermission", - "version": "0.0.0" - } } }, "constructInfo": { @@ -537,33 +429,6 @@ "fqn": "@aws-cdk/aws-lambda.CfnFunction", "version": "0.0.0" } - }, - "PostConfirmationCognito": { - "id": "PostConfirmationCognito", - "path": "integ-user-pool/postConfirmation/PostConfirmationCognito", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::Lambda::Permission", - "aws:cdk:cloudformation:props": { - "action": "lambda:InvokeFunction", - "functionName": { - "Fn::GetAtt": [ - "postConfirmationD5E3F1DD", - "Arn" - ] - }, - "principal": "cognito-idp.amazonaws.com", - "sourceArn": { - "Fn::GetAtt": [ - "myuserpool01998219", - "Arn" - ] - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-lambda.CfnPermission", - "version": "0.0.0" - } } }, "constructInfo": { @@ -648,33 +513,6 @@ "fqn": "@aws-cdk/aws-lambda.CfnFunction", "version": "0.0.0" } - }, - "PreAuthenticationCognito": { - "id": "PreAuthenticationCognito", - "path": "integ-user-pool/preAuthentication/PreAuthenticationCognito", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::Lambda::Permission", - "aws:cdk:cloudformation:props": { - "action": "lambda:InvokeFunction", - "functionName": { - "Fn::GetAtt": [ - "preAuthentication56F78C81", - "Arn" - ] - }, - "principal": "cognito-idp.amazonaws.com", - "sourceArn": { - "Fn::GetAtt": [ - "myuserpool01998219", - "Arn" - ] - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-lambda.CfnPermission", - "version": "0.0.0" - } } }, "constructInfo": { @@ -759,33 +597,6 @@ "fqn": "@aws-cdk/aws-lambda.CfnFunction", "version": "0.0.0" } - }, - "PreSignUpCognito": { - "id": "PreSignUpCognito", - "path": "integ-user-pool/preSignUp/PreSignUpCognito", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::Lambda::Permission", - "aws:cdk:cloudformation:props": { - "action": "lambda:InvokeFunction", - "functionName": { - "Fn::GetAtt": [ - "preSignUp1934B27C", - "Arn" - ] - }, - "principal": "cognito-idp.amazonaws.com", - "sourceArn": { - "Fn::GetAtt": [ - "myuserpool01998219", - "Arn" - ] - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-lambda.CfnPermission", - "version": "0.0.0" - } } }, "constructInfo": { @@ -870,33 +681,6 @@ "fqn": "@aws-cdk/aws-lambda.CfnFunction", "version": "0.0.0" } - }, - "PreTokenGenerationCognito": { - "id": "PreTokenGenerationCognito", - "path": "integ-user-pool/preTokenGeneration/PreTokenGenerationCognito", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::Lambda::Permission", - "aws:cdk:cloudformation:props": { - "action": "lambda:InvokeFunction", - "functionName": { - "Fn::GetAtt": [ - "preTokenGeneration1E968302", - "Arn" - ] - }, - "principal": "cognito-idp.amazonaws.com", - "sourceArn": { - "Fn::GetAtt": [ - "myuserpool01998219", - "Arn" - ] - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-lambda.CfnPermission", - "version": "0.0.0" - } } }, "constructInfo": { @@ -981,33 +765,6 @@ "fqn": "@aws-cdk/aws-lambda.CfnFunction", "version": "0.0.0" } - }, - "UserMigrationCognito": { - "id": "UserMigrationCognito", - "path": "integ-user-pool/userMigration/UserMigrationCognito", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::Lambda::Permission", - "aws:cdk:cloudformation:props": { - "action": "lambda:InvokeFunction", - "functionName": { - "Fn::GetAtt": [ - "userMigrationAAA960EC", - "Arn" - ] - }, - "principal": "cognito-idp.amazonaws.com", - "sourceArn": { - "Fn::GetAtt": [ - "myuserpool01998219", - "Arn" - ] - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-lambda.CfnPermission", - "version": "0.0.0" - } } }, "constructInfo": { @@ -1092,10 +849,263 @@ "fqn": "@aws-cdk/aws-lambda.CfnFunction", "version": "0.0.0" } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-lambda.Function", + "version": "0.0.0" + } + }, + "myuserpool": { + "id": "myuserpool", + "path": "integ-user-pool/myuserpool", + "children": { + "CreateAuthChallengeCognito": { + "id": "CreateAuthChallengeCognito", + "path": "integ-user-pool/myuserpool/CreateAuthChallengeCognito", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::Lambda::Permission", + "aws:cdk:cloudformation:props": { + "action": "lambda:InvokeFunction", + "functionName": { + "Fn::GetAtt": [ + "createAuthChallengeB185B225", + "Arn" + ] + }, + "principal": "cognito-idp.amazonaws.com", + "sourceArn": { + "Fn::GetAtt": [ + "myuserpool01998219", + "Arn" + ] + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-lambda.CfnPermission", + "version": "0.0.0" + } + }, + "CustomMessageCognito": { + "id": "CustomMessageCognito", + "path": "integ-user-pool/myuserpool/CustomMessageCognito", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::Lambda::Permission", + "aws:cdk:cloudformation:props": { + "action": "lambda:InvokeFunction", + "functionName": { + "Fn::GetAtt": [ + "customMessage52BA91E2", + "Arn" + ] + }, + "principal": "cognito-idp.amazonaws.com", + "sourceArn": { + "Fn::GetAtt": [ + "myuserpool01998219", + "Arn" + ] + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-lambda.CfnPermission", + "version": "0.0.0" + } + }, + "DefineAuthChallengeCognito": { + "id": "DefineAuthChallengeCognito", + "path": "integ-user-pool/myuserpool/DefineAuthChallengeCognito", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::Lambda::Permission", + "aws:cdk:cloudformation:props": { + "action": "lambda:InvokeFunction", + "functionName": { + "Fn::GetAtt": [ + "defineAuthChallengeAE7BCDA1", + "Arn" + ] + }, + "principal": "cognito-idp.amazonaws.com", + "sourceArn": { + "Fn::GetAtt": [ + "myuserpool01998219", + "Arn" + ] + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-lambda.CfnPermission", + "version": "0.0.0" + } + }, + "PostAuthenticationCognito": { + "id": "PostAuthenticationCognito", + "path": "integ-user-pool/myuserpool/PostAuthenticationCognito", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::Lambda::Permission", + "aws:cdk:cloudformation:props": { + "action": "lambda:InvokeFunction", + "functionName": { + "Fn::GetAtt": [ + "postAuthentication741BD8E3", + "Arn" + ] + }, + "principal": "cognito-idp.amazonaws.com", + "sourceArn": { + "Fn::GetAtt": [ + "myuserpool01998219", + "Arn" + ] + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-lambda.CfnPermission", + "version": "0.0.0" + } + }, + "PostConfirmationCognito": { + "id": "PostConfirmationCognito", + "path": "integ-user-pool/myuserpool/PostConfirmationCognito", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::Lambda::Permission", + "aws:cdk:cloudformation:props": { + "action": "lambda:InvokeFunction", + "functionName": { + "Fn::GetAtt": [ + "postConfirmationD5E3F1DD", + "Arn" + ] + }, + "principal": "cognito-idp.amazonaws.com", + "sourceArn": { + "Fn::GetAtt": [ + "myuserpool01998219", + "Arn" + ] + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-lambda.CfnPermission", + "version": "0.0.0" + } + }, + "PreAuthenticationCognito": { + "id": "PreAuthenticationCognito", + "path": "integ-user-pool/myuserpool/PreAuthenticationCognito", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::Lambda::Permission", + "aws:cdk:cloudformation:props": { + "action": "lambda:InvokeFunction", + "functionName": { + "Fn::GetAtt": [ + "preAuthentication56F78C81", + "Arn" + ] + }, + "principal": "cognito-idp.amazonaws.com", + "sourceArn": { + "Fn::GetAtt": [ + "myuserpool01998219", + "Arn" + ] + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-lambda.CfnPermission", + "version": "0.0.0" + } + }, + "PreSignUpCognito": { + "id": "PreSignUpCognito", + "path": "integ-user-pool/myuserpool/PreSignUpCognito", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::Lambda::Permission", + "aws:cdk:cloudformation:props": { + "action": "lambda:InvokeFunction", + "functionName": { + "Fn::GetAtt": [ + "preSignUp1934B27C", + "Arn" + ] + }, + "principal": "cognito-idp.amazonaws.com", + "sourceArn": { + "Fn::GetAtt": [ + "myuserpool01998219", + "Arn" + ] + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-lambda.CfnPermission", + "version": "0.0.0" + } + }, + "PreTokenGenerationCognito": { + "id": "PreTokenGenerationCognito", + "path": "integ-user-pool/myuserpool/PreTokenGenerationCognito", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::Lambda::Permission", + "aws:cdk:cloudformation:props": { + "action": "lambda:InvokeFunction", + "functionName": { + "Fn::GetAtt": [ + "preTokenGeneration1E968302", + "Arn" + ] + }, + "principal": "cognito-idp.amazonaws.com", + "sourceArn": { + "Fn::GetAtt": [ + "myuserpool01998219", + "Arn" + ] + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-lambda.CfnPermission", + "version": "0.0.0" + } + }, + "UserMigrationCognito": { + "id": "UserMigrationCognito", + "path": "integ-user-pool/myuserpool/UserMigrationCognito", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::Lambda::Permission", + "aws:cdk:cloudformation:props": { + "action": "lambda:InvokeFunction", + "functionName": { + "Fn::GetAtt": [ + "userMigrationAAA960EC", + "Arn" + ] + }, + "principal": "cognito-idp.amazonaws.com", + "sourceArn": { + "Fn::GetAtt": [ + "myuserpool01998219", + "Arn" + ] + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-lambda.CfnPermission", + "version": "0.0.0" + } }, "VerifyAuthChallengeResponseCognito": { "id": "VerifyAuthChallengeResponseCognito", - "path": "integ-user-pool/verifyAuthChallengeResponse/VerifyAuthChallengeResponseCognito", + "path": "integ-user-pool/myuserpool/VerifyAuthChallengeResponseCognito", "attributes": { "aws:cdk:cloudformation:type": "AWS::Lambda::Permission", "aws:cdk:cloudformation:props": { @@ -1119,17 +1129,7 @@ "fqn": "@aws-cdk/aws-lambda.CfnPermission", "version": "0.0.0" } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-lambda.Function", - "version": "0.0.0" - } - }, - "myuserpool": { - "id": "myuserpool", - "path": "integ-user-pool/myuserpool", - "children": { + }, "smsRole": { "id": "smsRole", "path": "integ-user-pool/myuserpool/smsRole", @@ -1407,28 +1407,28 @@ "id": "userpoolId", "path": "integ-user-pool/userpoolId", "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.85" + "fqn": "@aws-cdk/core.CfnOutput", + "version": "0.0.0" } }, "cognitoDomainName": { "id": "cognitoDomainName", "path": "integ-user-pool/cognitoDomainName", "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.85" + "fqn": "@aws-cdk/core.CfnOutput", + "version": "0.0.0" } } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.85" + "fqn": "@aws-cdk/core.Stack", + "version": "0.0.0" } } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.85" + "fqn": "@aws-cdk/core.App", + "version": "0.0.0" } } } \ No newline at end of file diff --git a/packages/@aws-cdk/aws-cognito/test/user-pool.test.ts b/packages/@aws-cdk/aws-cognito/test/user-pool.test.ts index 2457148d07f1c..f1dc19505e7a5 100644 --- a/packages/@aws-cdk/aws-cognito/test/user-pool.test.ts +++ b/packages/@aws-cdk/aws-cognito/test/user-pool.test.ts @@ -487,6 +487,32 @@ describe('User Pool', () => { }); }); + test('can use same lambda as trigger for multiple user pools', () => { + // GIVEN + const stack = new Stack(); + const fn = fooFunction(stack, 'preSignUp'); + + // WHEN + new UserPool(stack, 'Pool1', { + lambdaTriggers: { preSignUp: fn }, + }); + new UserPool(stack, 'Pool2', { + lambdaTriggers: { preSignUp: fn }, + }); + + // THEN + Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Permission', { + SourceArn: { + 'Fn::GetAtt': ['Pool1E3396DF1', 'Arn'], + }, + }); + Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Permission', { + SourceArn: { + 'Fn::GetAtt': ['Pool28D850567', 'Arn'], + }, + }); + }); + test('fails when the same trigger is added twice', () => { // GIVEN const stack = new Stack(); diff --git a/packages/@aws-cdk/aws-config/lib/rule.ts b/packages/@aws-cdk/aws-config/lib/rule.ts index 78c3481db084d..fc1d1e6c83eb3 100644 --- a/packages/@aws-cdk/aws-config/lib/rule.ts +++ b/packages/@aws-cdk/aws-config/lib/rule.ts @@ -1,7 +1,8 @@ +import { createHash } from 'crypto'; import * as events from '@aws-cdk/aws-events'; import * as iam from '@aws-cdk/aws-iam'; import * as lambda from '@aws-cdk/aws-lambda'; -import { IResource, Lazy, Resource } from '@aws-cdk/core'; +import { IResource, Lazy, Resource, Stack } from '@aws-cdk/core'; import { Construct } from 'constructs'; import { CfnConfigRule } from './config.generated'; @@ -408,11 +409,20 @@ export class CustomRule extends RuleNew { messageType: MessageType.SCHEDULED_NOTIFICATION, }); } - - props.lambdaFunction.addPermission('Permission', { - principal: new iam.ServicePrincipal('config.amazonaws.com'), - sourceAccount: this.env.account, - }); + const hash = createHash('sha256') + .update(JSON.stringify({ + fnName: props.lambdaFunction.functionName.toString, + accountId: Stack.of(this).resolve(this.env.account), + region: Stack.of(this).resolve(this.env.region), + }), 'utf8') + .digest('base64'); + const customRulePermissionId: string = `CustomRulePermission${hash}`; + if (!props.lambdaFunction.permissionsNode.tryFindChild(customRulePermissionId)) { + props.lambdaFunction.addPermission(customRulePermissionId, { + principal: new iam.ServicePrincipal('config.amazonaws.com'), + sourceAccount: this.env.account, + }); + }; if (props.lambdaFunction.role) { props.lambdaFunction.role.addManagedPolicy( diff --git a/packages/@aws-cdk/aws-config/test/integ.rule.lit.ts b/packages/@aws-cdk/aws-config/test/integ.rule.lit.ts index a5d9c646d1d10..08e2c2ee8a584 100644 --- a/packages/@aws-cdk/aws-config/test/integ.rule.lit.ts +++ b/packages/@aws-cdk/aws-config/test/integ.rule.lit.ts @@ -38,5 +38,5 @@ class ConfigStack extends cdk.Stack { } } -new ConfigStack(app, 'aws-cdk-config-rule-integ'); +new ConfigStack(app, 'aws-cdk-config-rule-integ', {}); app.synth(); diff --git a/packages/@aws-cdk/aws-config/test/integ.scoped-rule.ts b/packages/@aws-cdk/aws-config/test/integ.scoped-rule.ts index 833794f336ad8..0eccad268e525 100644 --- a/packages/@aws-cdk/aws-config/test/integ.scoped-rule.ts +++ b/packages/@aws-cdk/aws-config/test/integ.scoped-rule.ts @@ -4,7 +4,7 @@ import * as config from '../lib'; const app = new cdk.App(); -const stack = new cdk.Stack(app, 'aws-cdk-config-rule-scoped-integ'); +const stack = new cdk.Stack(app, 'aws-cdk-config-rule-scoped-integ', {}); const fn = new lambda.Function(stack, 'CustomFunction', { code: lambda.AssetCode.fromInline('exports.handler = (event) => console.log(event);'), diff --git a/packages/@aws-cdk/aws-config/test/rule.lit.integ.snapshot/aws-cdk-config-rule-integ.assets.json b/packages/@aws-cdk/aws-config/test/rule.lit.integ.snapshot/aws-cdk-config-rule-integ.assets.json index 7f96ffaf0785c..9e29cd6c1ff13 100644 --- a/packages/@aws-cdk/aws-config/test/rule.lit.integ.snapshot/aws-cdk-config-rule-integ.assets.json +++ b/packages/@aws-cdk/aws-config/test/rule.lit.integ.snapshot/aws-cdk-config-rule-integ.assets.json @@ -1,7 +1,7 @@ { "version": "21.0.0", "files": { - "9c0ec14ff7954b877625fb363a75213d58cb40e40acfcb23727388ddf0c52fec": { + "99b272ad5d23fb805d1e06b58a04179d8720a36f6aa8cf035eff419db2e87432": { "source": { "path": "aws-cdk-config-rule-integ.template.json", "packaging": "file" @@ -9,7 +9,7 @@ "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "9c0ec14ff7954b877625fb363a75213d58cb40e40acfcb23727388ddf0c52fec.json", + "objectKey": "99b272ad5d23fb805d1e06b58a04179d8720a36f6aa8cf035eff419db2e87432.json", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } diff --git a/packages/@aws-cdk/aws-config/test/rule.lit.integ.snapshot/aws-cdk-config-rule-integ.template.json b/packages/@aws-cdk/aws-config/test/rule.lit.integ.snapshot/aws-cdk-config-rule-integ.template.json index 68c6f438dafbd..453a6df4c44cb 100644 --- a/packages/@aws-cdk/aws-config/test/rule.lit.integ.snapshot/aws-cdk-config-rule-integ.template.json +++ b/packages/@aws-cdk/aws-config/test/rule.lit.integ.snapshot/aws-cdk-config-rule-integ.template.json @@ -62,7 +62,7 @@ "CustomFunctionServiceRoleD3F73B79" ] }, - "CustomFunctionPermission41887A5E": { + "CustomFunctionCustomRulePermissionbM1jVaicvRO9SDCiAbsQcYrOlESEtMwrrF9ZQQRvd5QED54A3F8": { "Type": "AWS::Lambda::Permission", "Properties": { "Action": "lambda:InvokeFunction", @@ -107,7 +107,7 @@ } }, "DependsOn": [ - "CustomFunctionPermission41887A5E", + "CustomFunctionCustomRulePermissionbM1jVaicvRO9SDCiAbsQcYrOlESEtMwrrF9ZQQRvd5QED54A3F8", "CustomFunctionBADD59E7", "CustomFunctionServiceRoleD3F73B79" ] diff --git a/packages/@aws-cdk/aws-config/test/rule.lit.integ.snapshot/manifest.json b/packages/@aws-cdk/aws-config/test/rule.lit.integ.snapshot/manifest.json index 231c02b46bba8..7c1a82eb94b9e 100644 --- a/packages/@aws-cdk/aws-config/test/rule.lit.integ.snapshot/manifest.json +++ b/packages/@aws-cdk/aws-config/test/rule.lit.integ.snapshot/manifest.json @@ -23,7 +23,7 @@ "validateOnSynth": false, "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/9c0ec14ff7954b877625fb363a75213d58cb40e40acfcb23727388ddf0c52fec.json", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/99b272ad5d23fb805d1e06b58a04179d8720a36f6aa8cf035eff419db2e87432.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", "additionalDependencies": [ @@ -51,10 +51,10 @@ "data": "CustomFunctionBADD59E7" } ], - "/aws-cdk-config-rule-integ/CustomFunction/Permission": [ + "/aws-cdk-config-rule-integ/CustomFunction/CustomRulePermissionbM1jVaicvRO9SDCiAbsQcYrOlESEtMwrrF9ZQQRvd5Q=": [ { "type": "aws:cdk:logicalId", - "data": "CustomFunctionPermission41887A5E" + "data": "CustomFunctionCustomRulePermissionbM1jVaicvRO9SDCiAbsQcYrOlESEtMwrrF9ZQQRvd5QED54A3F8" } ], "/aws-cdk-config-rule-integ/Custom/Resource": [ @@ -104,6 +104,15 @@ "type": "aws:cdk:logicalId", "data": "CheckBootstrapVersion" } + ], + "CustomFunctionCustomRulePermissionXogMcOcBfKkfAgTC3zxpecyWNuSNTUwy6QrCZdRtCdwF5AB15B7": [ + { + "type": "aws:cdk:logicalId", + "data": "CustomFunctionCustomRulePermissionXogMcOcBfKkfAgTC3zxpecyWNuSNTUwy6QrCZdRtCdwF5AB15B7", + "trace": [ + "!!DESTRUCTIVE_CHANGES: WILL_DESTROY" + ] + } ] }, "displayName": "aws-cdk-config-rule-integ" diff --git a/packages/@aws-cdk/aws-config/test/rule.lit.integ.snapshot/tree.json b/packages/@aws-cdk/aws-config/test/rule.lit.integ.snapshot/tree.json index 302082fb96f44..f2b1dc364816f 100644 --- a/packages/@aws-cdk/aws-config/test/rule.lit.integ.snapshot/tree.json +++ b/packages/@aws-cdk/aws-config/test/rule.lit.integ.snapshot/tree.json @@ -105,9 +105,9 @@ "version": "0.0.0" } }, - "Permission": { - "id": "Permission", - "path": "aws-cdk-config-rule-integ/CustomFunction/Permission", + "CustomRulePermissionbM1jVaicvRO9SDCiAbsQcYrOlESEtMwrrF9ZQQRvd5Q=": { + "id": "CustomRulePermissionbM1jVaicvRO9SDCiAbsQcYrOlESEtMwrrF9ZQQRvd5Q=", + "path": "aws-cdk-config-rule-integ/CustomFunction/CustomRulePermissionbM1jVaicvRO9SDCiAbsQcYrOlESEtMwrrF9ZQQRvd5Q=", "attributes": { "aws:cdk:cloudformation:type": "AWS::Lambda::Permission", "aws:cdk:cloudformation:props": { diff --git a/packages/@aws-cdk/aws-config/test/rule.test.ts b/packages/@aws-cdk/aws-config/test/rule.test.ts index 740ebf9220264..ae037c19df4ce 100644 --- a/packages/@aws-cdk/aws-config/test/rule.test.ts +++ b/packages/@aws-cdk/aws-config/test/rule.test.ts @@ -91,11 +91,6 @@ describe('rule', () => { }, MaximumExecutionFrequency: 'Six_Hours', }, - DependsOn: [ - 'FunctionPermissionEC8FE997', - 'Function76856677', - 'FunctionServiceRole675BB04A', - ], }); Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Permission', { @@ -460,6 +455,49 @@ describe('rule', () => { }); }); + test('create two custom rules and one function', () => { + // GIVEN + const stack = new cdk.Stack(); + const fn = new lambda.Function(stack, 'Function', { + code: lambda.AssetCode.fromInline('foo'), + handler: 'index.handler', + runtime: lambda.Runtime.NODEJS_14_X, + }); + + // WHEN + new config.CustomRule(stack, 'Rule1', { + configurationChanges: true, + description: 'really cool rule', + lambdaFunction: fn, + maximumExecutionFrequency: config.MaximumExecutionFrequency.SIX_HOURS, + configRuleName: 'cool rule 1', + periodic: true, + }); + new config.CustomRule(stack, 'Rule2', { + configurationChanges: true, + description: 'really cool rule', + lambdaFunction: fn, + configRuleName: 'cool rule 2', + }); + + // THEN + Template.fromStack(stack).resourceCountIs('AWS::Config::ConfigRule', 2); + Template.fromStack(stack).resourceCountIs('AWS::Lambda::Permission', 1); + + Template.fromStack(stack).hasResourceProperties('AWS::Lambda::Permission', { + Action: 'lambda:InvokeFunction', + FunctionName: { + 'Fn::GetAtt': [ + 'Function76856677', + 'Arn', + ], + }, + Principal: 'config.amazonaws.com', + SourceAccount: { + Ref: 'AWS::AccountId', + }, + }); + }); test('create a 0 charactor policy', () => { // GIVEN const stack = new cdk.Stack(); diff --git a/packages/@aws-cdk/aws-config/test/scoped-rule.integ.snapshot/aws-cdk-config-rule-scoped-integ.assets.json b/packages/@aws-cdk/aws-config/test/scoped-rule.integ.snapshot/aws-cdk-config-rule-scoped-integ.assets.json index fef322c5aba81..300c3d5fa29f2 100644 --- a/packages/@aws-cdk/aws-config/test/scoped-rule.integ.snapshot/aws-cdk-config-rule-scoped-integ.assets.json +++ b/packages/@aws-cdk/aws-config/test/scoped-rule.integ.snapshot/aws-cdk-config-rule-scoped-integ.assets.json @@ -1,7 +1,7 @@ { "version": "21.0.0", "files": { - "334d65f391737c79c5dd4a7f1fd9b8b58c86d362835cfcfd1a3873245cb214e0": { + "ce24448515abcdc66d5b46f4e7b5a3a4bad2eda8fa9f00dde24710cbc9860c87": { "source": { "path": "aws-cdk-config-rule-scoped-integ.template.json", "packaging": "file" @@ -9,7 +9,7 @@ "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "334d65f391737c79c5dd4a7f1fd9b8b58c86d362835cfcfd1a3873245cb214e0.json", + "objectKey": "ce24448515abcdc66d5b46f4e7b5a3a4bad2eda8fa9f00dde24710cbc9860c87.json", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } diff --git a/packages/@aws-cdk/aws-config/test/scoped-rule.integ.snapshot/aws-cdk-config-rule-scoped-integ.template.json b/packages/@aws-cdk/aws-config/test/scoped-rule.integ.snapshot/aws-cdk-config-rule-scoped-integ.template.json index bbbf2466ae4a5..e004ce28e7a8c 100644 --- a/packages/@aws-cdk/aws-config/test/scoped-rule.integ.snapshot/aws-cdk-config-rule-scoped-integ.template.json +++ b/packages/@aws-cdk/aws-config/test/scoped-rule.integ.snapshot/aws-cdk-config-rule-scoped-integ.template.json @@ -62,7 +62,7 @@ "CustomFunctionServiceRoleD3F73B79" ] }, - "CustomFunctionPermission41887A5E": { + "CustomFunctionCustomRulePermissionbM1jVaicvRO9SDCiAbsQcYrOlESEtMwrrF9ZQQRvd5QED54A3F8": { "Type": "AWS::Lambda::Permission", "Properties": { "Action": "lambda:InvokeFunction", @@ -103,7 +103,7 @@ } }, "DependsOn": [ - "CustomFunctionPermission41887A5E", + "CustomFunctionCustomRulePermissionbM1jVaicvRO9SDCiAbsQcYrOlESEtMwrrF9ZQQRvd5QED54A3F8", "CustomFunctionBADD59E7", "CustomFunctionServiceRoleD3F73B79" ] diff --git a/packages/@aws-cdk/aws-config/test/scoped-rule.integ.snapshot/manifest.json b/packages/@aws-cdk/aws-config/test/scoped-rule.integ.snapshot/manifest.json index 5df879d5b8fd0..6806b5a47e4c5 100644 --- a/packages/@aws-cdk/aws-config/test/scoped-rule.integ.snapshot/manifest.json +++ b/packages/@aws-cdk/aws-config/test/scoped-rule.integ.snapshot/manifest.json @@ -23,7 +23,7 @@ "validateOnSynth": false, "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/334d65f391737c79c5dd4a7f1fd9b8b58c86d362835cfcfd1a3873245cb214e0.json", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/ce24448515abcdc66d5b46f4e7b5a3a4bad2eda8fa9f00dde24710cbc9860c87.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", "additionalDependencies": [ @@ -51,10 +51,10 @@ "data": "CustomFunctionBADD59E7" } ], - "/aws-cdk-config-rule-scoped-integ/CustomFunction/Permission": [ + "/aws-cdk-config-rule-scoped-integ/CustomFunction/CustomRulePermissionbM1jVaicvRO9SDCiAbsQcYrOlESEtMwrrF9ZQQRvd5Q=": [ { "type": "aws:cdk:logicalId", - "data": "CustomFunctionPermission41887A5E" + "data": "CustomFunctionCustomRulePermissionbM1jVaicvRO9SDCiAbsQcYrOlESEtMwrrF9ZQQRvd5QED54A3F8" } ], "/aws-cdk-config-rule-scoped-integ/Custom/Resource": [ @@ -74,6 +74,15 @@ "type": "aws:cdk:logicalId", "data": "CheckBootstrapVersion" } + ], + "CustomFunctionPermission41887A5E": [ + { + "type": "aws:cdk:logicalId", + "data": "CustomFunctionPermission41887A5E", + "trace": [ + "!!DESTRUCTIVE_CHANGES: WILL_DESTROY" + ] + } ] }, "displayName": "aws-cdk-config-rule-scoped-integ" diff --git a/packages/@aws-cdk/aws-config/test/scoped-rule.integ.snapshot/tree.json b/packages/@aws-cdk/aws-config/test/scoped-rule.integ.snapshot/tree.json index f1136029cb247..5b58c8e4a216f 100644 --- a/packages/@aws-cdk/aws-config/test/scoped-rule.integ.snapshot/tree.json +++ b/packages/@aws-cdk/aws-config/test/scoped-rule.integ.snapshot/tree.json @@ -105,9 +105,9 @@ "version": "0.0.0" } }, - "Permission": { - "id": "Permission", - "path": "aws-cdk-config-rule-scoped-integ/CustomFunction/Permission", + "CustomRulePermissionbM1jVaicvRO9SDCiAbsQcYrOlESEtMwrrF9ZQQRvd5Q=": { + "id": "CustomRulePermissionbM1jVaicvRO9SDCiAbsQcYrOlESEtMwrrF9ZQQRvd5Q=", + "path": "aws-cdk-config-rule-scoped-integ/CustomFunction/CustomRulePermissionbM1jVaicvRO9SDCiAbsQcYrOlESEtMwrrF9ZQQRvd5Q=", "attributes": { "aws:cdk:cloudformation:type": "AWS::Lambda::Permission", "aws:cdk:cloudformation:props": { diff --git a/packages/@aws-cdk/aws-rds/lib/cluster-engine.ts b/packages/@aws-cdk/aws-rds/lib/cluster-engine.ts index 37af190258d2a..4e95d6908fac9 100644 --- a/packages/@aws-cdk/aws-rds/lib/cluster-engine.ts +++ b/packages/@aws-cdk/aws-rds/lib/cluster-engine.ts @@ -669,6 +669,8 @@ export class AuroraPostgresEngineVersion { public static readonly VER_13_7 = AuroraPostgresEngineVersion.of('13.7', '13', { s3Import: true, s3Export: true }); /** Version "14.3". */ public static readonly VER_14_3 = AuroraPostgresEngineVersion.of('14.3', '14', { s3Import: true, s3Export: true }); + /** Version "14.4". */ + public static readonly VER_14_4 = AuroraPostgresEngineVersion.of('14.4', '14', { s3Import: true, s3Export: true }); /** * Create a new AuroraPostgresEngineVersion with an arbitrary version. diff --git a/packages/@aws-cdk/aws-rds/lib/instance-engine.ts b/packages/@aws-cdk/aws-rds/lib/instance-engine.ts index cada0ef139c4a..624deb0e9edfd 100644 --- a/packages/@aws-cdk/aws-rds/lib/instance-engine.ts +++ b/packages/@aws-cdk/aws-rds/lib/instance-engine.ts @@ -163,129 +163,129 @@ abstract class InstanceEngineBase implements IInstanceEngine { export class MariaDbEngineVersion { /** * Version "10.0" (only a major version, without a specific minor version). - * @deprecated MariaDB 10.0 will reach end of life on May 18, 2021 + * @deprecated MariaDB 10.0 is no longer supported by Amazon RDS. */ public static readonly VER_10_0 = MariaDbEngineVersion.of('10.0', '10.0'); /** * Version "10.0.17". - * @deprecated MariaDB 10.0 will reach end of life on May 18, 2021 + * @deprecated MariaDB 10.0 is no longer supported by Amazon RDS. */ public static readonly VER_10_0_17 = MariaDbEngineVersion.of('10.0.17', '10.0'); /** * Version "10.0.24". - * @deprecated MariaDB 10.0 will reach end of life on May 18, 2021 + * @deprecated MariaDB 10.0 is no longer supported by Amazon RDS. */ public static readonly VER_10_0_24 = MariaDbEngineVersion.of('10.0.24', '10.0'); /** * Version "10.0.28". - * @deprecated MariaDB 10.0 will reach end of life on May 18, 2021 + * @deprecated MariaDB 10.0 is no longer supported by Amazon RDS. */ public static readonly VER_10_0_28 = MariaDbEngineVersion.of('10.0.28', '10.0'); /** * Version "10.0.31". - * @deprecated MariaDB 10.0 will reach end of life on May 18, 2021 + * @deprecated MariaDB 10.0 is no longer supported by Amazon RDS. */ public static readonly VER_10_0_31 = MariaDbEngineVersion.of('10.0.31', '10.0'); /** * Version "10.0.32". - * @deprecated MariaDB 10.0 will reach end of life on May 18, 2021 + * @deprecated MariaDB 10.0 is no longer supported by Amazon RDS. */ public static readonly VER_10_0_32 = MariaDbEngineVersion.of('10.0.32', '10.0'); /** * Version "10.0.34". - * @deprecated MariaDB 10.0 will reach end of life on May 18, 2021 + * @deprecated MariaDB 10.0 is no longer supported by Amazon RDS. */ public static readonly VER_10_0_34 = MariaDbEngineVersion.of('10.0.34', '10.0'); /** * Version "10.0.35". - * @deprecated MariaDB 10.0 will reach end of life on May 18, 2021 + * @deprecated MariaDB 10.0 is no longer supported by Amazon RDS. */ public static readonly VER_10_0_35 = MariaDbEngineVersion.of('10.0.35', '10.0'); /** * Version "10.1" (only a major version, without a specific minor version). - * @deprecated MariaDB 10.1 will reach end of life on May 18, 2021 + * @deprecated MariaDB 10.1 is no longer supported by Amazon RDS. */ public static readonly VER_10_1 = MariaDbEngineVersion.of('10.1', '10.1'); /** * Version "10.1.14". - * @deprecated MariaDB 10.1 will reach end of life on May 18, 2021 + * @deprecated MariaDB 10.1 is no longer supported by Amazon RDS. */ public static readonly VER_10_1_14 = MariaDbEngineVersion.of('10.1.14', '10.1'); /** * Version "10.1.19". - * @deprecated MariaDB 10.1 will reach end of life on May 18, 2021 + * @deprecated MariaDB 10.1 is no longer supported by Amazon RDS. */ public static readonly VER_10_1_19 = MariaDbEngineVersion.of('10.1.19', '10.1'); /** * Version "10.1.23". - * @deprecated MariaDB 10.1 will reach end of life on May 18, 2021 + * @deprecated MariaDB 10.1 is no longer supported by Amazon RDS. */ public static readonly VER_10_1_23 = MariaDbEngineVersion.of('10.1.23', '10.1'); /** * Version "10.1.26". - * @deprecated MariaDB 10.1 will reach end of life on May 18, 2021 + * @deprecated MariaDB 10.1 is no longer supported by Amazon RDS. */ public static readonly VER_10_1_26 = MariaDbEngineVersion.of('10.1.26', '10.1'); /** * Version "10.1.31". - * @deprecated MariaDB 10.1 will reach end of life on May 18, 2021 + * @deprecated MariaDB 10.1 is no longer supported by Amazon RDS. */ public static readonly VER_10_1_31 = MariaDbEngineVersion.of('10.1.31', '10.1'); /** * Version "10.1.34". - * @deprecated MariaDB 10.1 will reach end of life on May 18, 2021 + * @deprecated MariaDB 10.1 is no longer supported by Amazon RDS. */ public static readonly VER_10_1_34 = MariaDbEngineVersion.of('10.1.34', '10.1'); /** * Version "10.2" (only a major version, without a specific minor version) - * @deprecated MariaDB 10.2 will reach end of life on October 15, 2022 + * @deprecated MariaDB 10.2 is no longer supported by Amazon RDS. */ public static readonly VER_10_2 = MariaDbEngineVersion.of('10.2', '10.2'); /** * Version "10.2.11". - * @deprecated MariaDB 10.2 will reach end of life on October 15, 2022 + * @deprecated MariaDB 10.2 is no longer supported by Amazon RDS. */ public static readonly VER_10_2_11 = MariaDbEngineVersion.of('10.2.11', '10.2'); /** * Version "10.2.12". - * @deprecated MariaDB 10.2 will reach end of life on October 15, 2022 + * @deprecated MariaDB 10.2 is no longer supported by Amazon RDS. */ public static readonly VER_10_2_12 = MariaDbEngineVersion.of('10.2.12', '10.2'); /** * Version "10.2.15". - * @deprecated MariaDB 10.2 will reach end of life on October 15, 2022 + * @deprecated MariaDB 10.2 is no longer supported by Amazon RDS. */ public static readonly VER_10_2_15 = MariaDbEngineVersion.of('10.2.15', '10.2'); /** * Version "10.2.21". - * @deprecated MariaDB 10.2 will reach end of life on October 15, 2022 + * @deprecated MariaDB 10.2 is no longer supported by Amazon RDS. */ public static readonly VER_10_2_21 = MariaDbEngineVersion.of('10.2.21', '10.2'); /** * Version "10.2.32". - * @deprecated MariaDB 10.2 will reach end of life on October 15, 2022 + * @deprecated MariaDB 10.2 is no longer supported by Amazon RDS. */ public static readonly VER_10_2_32 = MariaDbEngineVersion.of('10.2.32', '10.2'); /** * Version "10.2.37". - * @deprecated MariaDB 10.2 will reach end of life on October 15, 2022 + * @deprecated MariaDB 10.2 is no longer supported by Amazon RDS. */ public static readonly VER_10_2_37 = MariaDbEngineVersion.of('10.2.37', '10.2'); /** * Version "10.2.39". - * @deprecated MariaDB 10.2 will reach end of life on October 15, 2022 + * @deprecated MariaDB 10.2 is no longer supported by Amazon RDS. */ public static readonly VER_10_2_39 = MariaDbEngineVersion.of('10.2.39', '10.2'); /** * Version "10.2.40". - * @deprecated MariaDB 10.2 will reach end of life on October 15, 2022 + * @deprecated MariaDB 10.2 is no longer supported by Amazon RDS. */ public static readonly VER_10_2_40 = MariaDbEngineVersion.of('10.2.40', '10.2'); /** * Version "10.2.41". - * @deprecated MariaDB 10.2 will reach end of life on October 15, 2022 + * @deprecated MariaDB 10.2 is no longer supported by Amazon RDS. */ public static readonly VER_10_2_41 = MariaDbEngineVersion.of('10.2.41', '10.2'); @@ -309,6 +309,8 @@ export class MariaDbEngineVersion { public static readonly VER_10_3_34 = MariaDbEngineVersion.of('10.3.34', '10.3'); /** Version "10.3.35". */ public static readonly VER_10_3_35 = MariaDbEngineVersion.of('10.3.35', '10.3'); + /** Version "10.3.36". */ + public static readonly VER_10_3_36 = MariaDbEngineVersion.of('10.3.36', '10.3'); /** Version "10.4" (only a major version, without a specific minor version). */ public static readonly VER_10_4 = MariaDbEngineVersion.of('10.4', '10.4'); @@ -326,6 +328,8 @@ export class MariaDbEngineVersion { public static readonly VER_10_4_24 = MariaDbEngineVersion.of('10.4.24', '10.4'); /** Version "10.4.25". */ public static readonly VER_10_4_25 = MariaDbEngineVersion.of('10.4.25', '10.4'); + /** Version "10.4.26". */ + public static readonly VER_10_4_26 = MariaDbEngineVersion.of('10.4.26', '10.4'); /** Version "10.5" (only a major version, without a specific minor version). */ public static readonly VER_10_5 = MariaDbEngineVersion.of('10.5', '10.5'); @@ -341,6 +345,8 @@ export class MariaDbEngineVersion { public static readonly VER_10_5_15 = MariaDbEngineVersion.of('10.5.15', '10.5'); /** Version "10.5.16". */ public static readonly VER_10_5_16 = MariaDbEngineVersion.of('10.5.16', '10.5'); + /** Version "10.5.17". */ + public static readonly VER_10_5_17 = MariaDbEngineVersion.of('10.5.17', '10.5'); /** Version "10.6" (only a major version, without a specific minor version). */ public static readonly VER_10_6 = MariaDbEngineVersion.of('10.6', '10.6'); @@ -417,98 +423,98 @@ class MariaDbInstanceEngine extends InstanceEngineBase { export class MysqlEngineVersion { /** * Version "5.5" (only a major version, without a specific minor version). - * @deprecated MySQL 5.5 will reach end of life on May 25, 2021 + * @deprecated MySQL 5.5 is no longer supported by Amazon RDS. */ public static readonly VER_5_5 = MysqlEngineVersion.of('5.5', '5.5'); /** * Version "5.5.46". - * @deprecated MySQL 5.5 will reach end of life on May 25, 2021 + * @deprecated MySQL 5.5 is no longer supported by Amazon RDS. */ public static readonly VER_5_5_46 = MysqlEngineVersion.of('5.5.46', '5.5'); /** * Version "5.5.53". - * @deprecated MySQL 5.5 will reach end of life on May 25, 2021 + * @deprecated MySQL 5.5 is no longer supported by Amazon RDS. */ public static readonly VER_5_5_53 = MysqlEngineVersion.of('5.5.53', '5.5'); /** * Version "5.5.57". - * @deprecated MySQL 5.5 will reach end of life on May 25, 2021 + * @deprecated MySQL 5.5 is no longer supported by Amazon RDS. */ public static readonly VER_5_5_57 = MysqlEngineVersion.of('5.5.57', '5.5'); /** * Version "5.5.59". - * @deprecated MySQL 5.5 will reach end of life on May 25, 2021 + * @deprecated MySQL 5.5 is no longer supported by Amazon RDS. */ public static readonly VER_5_5_59 = MysqlEngineVersion.of('5.5.59', '5.5'); /** * Version "5.5.61". - * @deprecated MySQL 5.5 will reach end of life on May 25, 2021 + * @deprecated MySQL 5.5 is no longer supported by Amazon RDS. */ public static readonly VER_5_5_61 = MysqlEngineVersion.of('5.5.61', '5.5'); /** * Version "5.6" (only a major version, without a specific minor version). - * @deprecated MySQL 5.6 will reach end of life on August 3, 2021 + * @deprecated MySQL 5.6 is no longer supported by Amazon RDS. */ public static readonly VER_5_6 = MysqlEngineVersion.of('5.6', '5.6'); /** * Version "5.6.34". - * @deprecated MySQL 5.6 will reach end of life on August 3, 2021 + * @deprecated MySQL 5.6 is no longer supported by Amazon RDS. */ public static readonly VER_5_6_34 = MysqlEngineVersion.of('5.6.34', '5.6'); /** * Version "5.6.35". - * @deprecated MySQL 5.6 will reach end of life on August 3, 2021 + * @deprecated MySQL 5.6 is no longer supported by Amazon RDS. */ public static readonly VER_5_6_35 = MysqlEngineVersion.of('5.6.35', '5.6'); /** * Version "5.6.37". - * @deprecated MySQL 5.6 will reach end of life on August 3, 2021 + * @deprecated MySQL 5.6 is no longer supported by Amazon RDS. */ public static readonly VER_5_6_37 = MysqlEngineVersion.of('5.6.37', '5.6'); /** * Version "5.6.39". - * @deprecated MySQL 5.6 will reach end of life on August 3, 2021 + * @deprecated MySQL 5.6 is no longer supported by Amazon RDS. */ public static readonly VER_5_6_39 = MysqlEngineVersion.of('5.6.39', '5.6'); /** * Version "5.6.40". - * @deprecated MySQL 5.6 will reach end of life on August 3, 2021 + * @deprecated MySQL 5.6 is no longer supported by Amazon RDS. */ public static readonly VER_5_6_40 = MysqlEngineVersion.of('5.6.40', '5.6'); /** * Version "5.6.41". - * @deprecated MySQL 5.6 will reach end of life on August 3, 2021 + * @deprecated MySQL 5.6 is no longer supported by Amazon RDS. */ public static readonly VER_5_6_41 = MysqlEngineVersion.of('5.6.41', '5.6'); /** * Version "5.6.43". - * @deprecated MySQL 5.6 will reach end of life on August 3, 2021 + * @deprecated MySQL 5.6 is no longer supported by Amazon RDS. */ public static readonly VER_5_6_43 = MysqlEngineVersion.of('5.6.43', '5.6'); /** * Version "5.6.44". - * @deprecated MySQL 5.6 will reach end of life on August 3, 2021 + * @deprecated MySQL 5.6 is no longer supported by Amazon RDS. */ public static readonly VER_5_6_44 = MysqlEngineVersion.of('5.6.44', '5.6'); /** * Version "5.6.46". - * @deprecated MySQL 5.6 will reach end of life on August 3, 2021 + * @deprecated MySQL 5.6 is no longer supported by Amazon RDS. */ public static readonly VER_5_6_46 = MysqlEngineVersion.of('5.6.46', '5.6'); /** * Version "5.6.48". - * @deprecated MySQL 5.6 will reach end of life on August 3, 2021 + * @deprecated MySQL 5.6 is no longer supported by Amazon RDS. */ public static readonly VER_5_6_48 = MysqlEngineVersion.of('5.6.48', '5.6'); /** * Version "5.6.49". - * @deprecated MySQL 5.6 will reach end of life on August 3, 2021 + * @deprecated MySQL 5.6 is no longer supported by Amazon RDS. */ public static readonly VER_5_6_49 = MysqlEngineVersion.of('5.6.49', '5.6'); /** * Version "5.6.51". - * @deprecated MySQL 5.6 will reach end of life on August 3, 2021 + * @deprecated MySQL 5.6 is no longer supported by Amazon RDS. */ public static readonly VER_5_6_51 = MysqlEngineVersion.of('5.6.51', '5.6'); @@ -661,213 +667,213 @@ export interface PostgresEngineFeatures { export class PostgresEngineVersion { /** * Version "9.5" (only a major version, without a specific minor version). - * @deprecated PostgreSQL 9.5 will reach end of life on February 16, 2021 + * @deprecated PostgreSQL 9.5 is no longer supported by Amazon RDS. */ public static readonly VER_9_5 = PostgresEngineVersion.of('9.5', '9.5'); /** * Version "9.5.2". - * @deprecated PostgreSQL 9.5 will reach end of life on February 16, 2021 + * @deprecated PostgreSQL 9.5 is no longer supported by Amazon RDS. */ public static readonly VER_9_5_2 = PostgresEngineVersion.of('9.5.2', '9.5'); /** * Version "9.5.4". - * @deprecated PostgreSQL 9.5 will reach end of life on February 16, 2021 + * @deprecated PostgreSQL 9.5 is no longer supported by Amazon RDS. */ public static readonly VER_9_5_4 = PostgresEngineVersion.of('9.5.4', '9.5'); /** * Version "9.5.6". - * @deprecated PostgreSQL 9.5 will reach end of life on February 16, 2021 + * @deprecated PostgreSQL 9.5 is no longer supported by Amazon RDS. */ public static readonly VER_9_5_6 = PostgresEngineVersion.of('9.5.6', '9.5'); /** * Version "9.5.7". - * @deprecated PostgreSQL 9.5 will reach end of life on February 16, 2021 + * @deprecated PostgreSQL 9.5 is no longer supported by Amazon RDS. */ public static readonly VER_9_5_7 = PostgresEngineVersion.of('9.5.7', '9.5'); /** * Version "9.5.9". - * @deprecated PostgreSQL 9.5 will reach end of life on February 16, 2021 + * @deprecated PostgreSQL 9.5 is no longer supported by Amazon RDS. */ public static readonly VER_9_5_9 = PostgresEngineVersion.of('9.5.9', '9.5'); /** * Version "9.5.10". - * @deprecated PostgreSQL 9.5 will reach end of life on February 16, 2021 + * @deprecated PostgreSQL 9.5 is no longer supported by Amazon RDS. */ public static readonly VER_9_5_10 = PostgresEngineVersion.of('9.5.10', '9.5'); /** * Version "9.5.12". - * @deprecated PostgreSQL 9.5 will reach end of life on February 16, 2021 + * @deprecated PostgreSQL 9.5 is no longer supported by Amazon RDS. */ public static readonly VER_9_5_12 = PostgresEngineVersion.of('9.5.12', '9.5'); /** * Version "9.5.13". - * @deprecated PostgreSQL 9.5 will reach end of life on February 16, 2021 + * @deprecated PostgreSQL 9.5 is no longer supported by Amazon RDS. */ public static readonly VER_9_5_13 = PostgresEngineVersion.of('9.5.13', '9.5'); /** * Version "9.5.14". - * @deprecated PostgreSQL 9.5 will reach end of life on February 16, 2021 + * @deprecated PostgreSQL 9.5 is no longer supported by Amazon RDS. */ public static readonly VER_9_5_14 = PostgresEngineVersion.of('9.5.14', '9.5'); /** * Version "9.5.15". - * @deprecated PostgreSQL 9.5 will reach end of life on February 16, 2021 + * @deprecated PostgreSQL 9.5 is no longer supported by Amazon RDS. */ public static readonly VER_9_5_15 = PostgresEngineVersion.of('9.5.15', '9.5'); /** * Version "9.5.16". - * @deprecated PostgreSQL 9.5 will reach end of life on February 16, 2021 + * @deprecated PostgreSQL 9.5 is no longer supported by Amazon RDS. */ public static readonly VER_9_5_16 = PostgresEngineVersion.of('9.5.16', '9.5'); /** * Version "9.5.18". - * @deprecated PostgreSQL 9.5 will reach end of life on February 16, 2021 + * @deprecated PostgreSQL 9.5 is no longer supported by Amazon RDS. */ public static readonly VER_9_5_18 = PostgresEngineVersion.of('9.5.18', '9.5'); /** * Version "9.5.19". - * @deprecated PostgreSQL 9.5 will reach end of life on February 16, 2021 + * @deprecated PostgreSQL 9.5 is no longer supported by Amazon RDS. */ public static readonly VER_9_5_19 = PostgresEngineVersion.of('9.5.19', '9.5'); /** * Version "9.5.20". - * @deprecated PostgreSQL 9.5 will reach end of life on February 16, 2021 + * @deprecated PostgreSQL 9.5 is no longer supported by Amazon RDS. */ public static readonly VER_9_5_20 = PostgresEngineVersion.of('9.5.20', '9.5'); /** * Version "9.5.21". - * @deprecated PostgreSQL 9.5 will reach end of life on February 16, 2021 + * @deprecated PostgreSQL 9.5 is no longer supported by Amazon RDS. */ public static readonly VER_9_5_21 = PostgresEngineVersion.of('9.5.21', '9.5'); /** * Version "9.5.22". - * @deprecated PostgreSQL 9.5 will reach end of life on February 16, 2021 + * @deprecated PostgreSQL 9.5 is no longer supported by Amazon RDS. */ public static readonly VER_9_5_22 = PostgresEngineVersion.of('9.5.22', '9.5'); /** * Version "9.5.23". - * @deprecated PostgreSQL 9.5 will reach end of life on February 16, 2021 + * @deprecated PostgreSQL 9.5 is no longer supported by Amazon RDS. */ public static readonly VER_9_5_23 = PostgresEngineVersion.of('9.5.23', '9.5'); /** * Version "9.5.24". - * @deprecated PostgreSQL 9.5 will reach end of life on February 16, 2021 + * @deprecated PostgreSQL 9.5 is no longer supported by Amazon RDS. */ public static readonly VER_9_5_24 = PostgresEngineVersion.of('9.5.24', '9.5'); /** * Version "9.5.25". - * @deprecated PostgreSQL 9.5 will reach end of life on February 16, 2021 + * @deprecated PostgreSQL 9.5 is no longer supported by Amazon RDS. */ public static readonly VER_9_5_25 = PostgresEngineVersion.of('9.5.25', '9.5'); /** * Version "9.6" (only a major version, without a specific minor version). - * @deprecated PostgreSQL 9.6 will reach end of life in November 2021 + * @deprecated PostgreSQL 9.6 is no longer supported by Amazon RDS. */ public static readonly VER_9_6 = PostgresEngineVersion.of('9.6', '9.6'); /** * Version "9.6.1". - * @deprecated PostgreSQL 9.6 will reach end of life in November 2021 + * @deprecated PostgreSQL 9.6 is no longer supported by Amazon RDS. */ public static readonly VER_9_6_1 = PostgresEngineVersion.of('9.6.1', '9.6'); /** * Version "9.6.2". - * @deprecated PostgreSQL 9.6 will reach end of life in November 2021 + * @deprecated PostgreSQL 9.6 is no longer supported by Amazon RDS. */ public static readonly VER_9_6_2 = PostgresEngineVersion.of('9.6.2', '9.6'); /** * Version "9.6.3". - * @deprecated PostgreSQL 9.6 will reach end of life in November 2021 + * @deprecated PostgreSQL 9.6 is no longer supported by Amazon RDS. */ public static readonly VER_9_6_3 = PostgresEngineVersion.of('9.6.3', '9.6'); /** * Version "9.6.5". - * @deprecated PostgreSQL 9.6 will reach end of life in November 2021 + * @deprecated PostgreSQL 9.6 is no longer supported by Amazon RDS. */ public static readonly VER_9_6_5 = PostgresEngineVersion.of('9.6.5', '9.6'); /** * Version "9.6.6". - * @deprecated PostgreSQL 9.6 will reach end of life in November 2021 + * @deprecated PostgreSQL 9.6 is no longer supported by Amazon RDS. */ public static readonly VER_9_6_6 = PostgresEngineVersion.of('9.6.6', '9.6'); /** * Version "9.6.8". - * @deprecated PostgreSQL 9.6 will reach end of life in November 2021 + * @deprecated PostgreSQL 9.6 is no longer supported by Amazon RDS. */ public static readonly VER_9_6_8 = PostgresEngineVersion.of('9.6.8', '9.6'); /** * Version "9.6.9". - * @deprecated PostgreSQL 9.6 will reach end of life in November 2021 + * @deprecated PostgreSQL 9.6 is no longer supported by Amazon RDS. */ public static readonly VER_9_6_9 = PostgresEngineVersion.of('9.6.9', '9.6'); /** * Version "9.6.10". - * @deprecated PostgreSQL 9.6 will reach end of life in November 2021 + * @deprecated PostgreSQL 9.6 is no longer supported by Amazon RDS. */ public static readonly VER_9_6_10 = PostgresEngineVersion.of('9.6.10', '9.6'); /** * Version "9.6.11". - * @deprecated PostgreSQL 9.6 will reach end of life in November 2021 + * @deprecated PostgreSQL 9.6 is no longer supported by Amazon RDS. */ public static readonly VER_9_6_11 = PostgresEngineVersion.of('9.6.11', '9.6'); /** * Version "9.6.12". - * @deprecated PostgreSQL 9.6 will reach end of life in November 2021 + * @deprecated PostgreSQL 9.6 is no longer supported by Amazon RDS. */ public static readonly VER_9_6_12 = PostgresEngineVersion.of('9.6.12', '9.6'); /** * Version "9.6.14". - * @deprecated PostgreSQL 9.6 will reach end of life in November 2021 + * @deprecated PostgreSQL 9.6 is no longer supported by Amazon RDS. */ public static readonly VER_9_6_14 = PostgresEngineVersion.of('9.6.14', '9.6'); /** * Version "9.6.15". - * @deprecated PostgreSQL 9.6 will reach end of life in November 2021 + * @deprecated PostgreSQL 9.6 is no longer supported by Amazon RDS. */ public static readonly VER_9_6_15 = PostgresEngineVersion.of('9.6.15', '9.6'); /** * Version "9.6.16". - * @deprecated PostgreSQL 9.6 will reach end of life in November 2021 + * @deprecated PostgreSQL 9.6 is no longer supported by Amazon RDS. */ public static readonly VER_9_6_16 = PostgresEngineVersion.of('9.6.16', '9.6'); /** * Version "9.6.17". - * @deprecated PostgreSQL 9.6 will reach end of life in November 2021 + * @deprecated PostgreSQL 9.6 is no longer supported by Amazon RDS. */ public static readonly VER_9_6_17 = PostgresEngineVersion.of('9.6.17', '9.6'); /** * Version "9.6.18". - * @deprecated PostgreSQL 9.6 will reach end of life in November 2021 + * @deprecated PostgreSQL 9.6 is no longer supported by Amazon RDS. */ public static readonly VER_9_6_18 = PostgresEngineVersion.of('9.6.18', '9.6'); /** * Version "9.6.19". - * @deprecated PostgreSQL 9.6 will reach end of life in November 2021 + * @deprecated PostgreSQL 9.6 is no longer supported by Amazon RDS. */ public static readonly VER_9_6_19 = PostgresEngineVersion.of('9.6.19', '9.6'); /** * Version "9.6.20". - * @deprecated PostgreSQL 9.6 will reach end of life in November 2021 + * @deprecated PostgreSQL 9.6 is no longer supported by Amazon RDS. */ public static readonly VER_9_6_20 = PostgresEngineVersion.of('9.6.20', '9.6'); /** * Version "9.6.21". - * @deprecated PostgreSQL 9.6 will reach end of life in November 2021 + * @deprecated PostgreSQL 9.6 is no longer supported by Amazon RDS. */ public static readonly VER_9_6_21 = PostgresEngineVersion.of('9.6.21', '9.6'); /** * Version "9.6.22". - * @deprecated PostgreSQL 9.6 will reach end of life in November 2021 + * @deprecated PostgreSQL 9.6 is no longer supported by Amazon RDS. */ public static readonly VER_9_6_22 = PostgresEngineVersion.of('9.6.22', '9.6'); /** * Version "9.6.23". - * @deprecated PostgreSQL 9.6 will reach end of life in November 2021 + * @deprecated PostgreSQL 9.6 is no longer supported by Amazon RDS. */ public static readonly VER_9_6_23 = PostgresEngineVersion.of('9.6.23', '9.6'); /** * Version "9.6.24". - * @deprecated PostgreSQL 9.6 will reach end of life in November 2021 + * @deprecated PostgreSQL 9.6 is no longer supported by Amazon RDS. */ public static readonly VER_9_6_24 = PostgresEngineVersion.of('9.6.24', '9.6'); @@ -991,6 +997,8 @@ export class PostgresEngineVersion { public static readonly VER_14_2 = PostgresEngineVersion.of('14.2', '14', { s3Import: true, s3Export: true }); /** Version "14.3". */ public static readonly VER_14_3 = PostgresEngineVersion.of('14.3', '14', { s3Import: true, s3Export: true }); + /** Version "14.4". */ + public static readonly VER_14_4 = PostgresEngineVersion.of('14.4', '14', { s3Import: true, s3Export: true }); /** * Create a new PostgresEngineVersion with an arbitrary version. diff --git a/packages/@aws-cdk/aws-redshift/README.md b/packages/@aws-cdk/aws-redshift/README.md index 66af962185f72..056a1fde16276 100644 --- a/packages/@aws-cdk/aws-redshift/README.md +++ b/packages/@aws-cdk/aws-redshift/README.md @@ -368,3 +368,21 @@ The elastic IP address is an external IP address for accessing the cluster outsi In some cases, you might want to associate the cluster with an elastic IP address or change an elastic IP address that is associated with the cluster. To attach an elastic IP address after the cluster is created, first update the cluster so that it is not publicly accessible, then make it both publicly accessible and add an Elastic IP address in the same operation. +## Enhanced VPC Routing + +When you use Amazon Redshift enhanced VPC routing, Amazon Redshift forces all COPY and UNLOAD traffic between your cluster and your data repositories through your virtual private cloud (VPC) based on the Amazon VPC service. By using enhanced VPC routing, you can use standard VPC features, such as VPC security groups, network access control lists (ACLs), VPC endpoints, VPC endpoint policies, internet gateways, and Domain Name System (DNS) servers, as described in the Amazon VPC User Guide. You use these features to tightly manage the flow of data between your Amazon Redshift cluster and other resources. When you use enhanced VPC routing to route traffic through your VPC, you can also use VPC flow logs to monitor COPY and UNLOAD traffic. + +```ts +declare const vpc: ec2.Vpc; + +new Cluster(stack, 'Redshift', { + masterUser: { + masterUsername: 'admin', + masterPassword: cdk.SecretValue.unsafePlainText('tooshort'), + }, + vpc, + enhancedVpcRouting: true, +}) +``` + +If enhanced VPC routing is not enabled, Amazon Redshift routes traffic through the internet, including traffic to other services within the AWS network. diff --git a/packages/@aws-cdk/aws-redshift/lib/cluster.ts b/packages/@aws-cdk/aws-redshift/lib/cluster.ts index f888bc8cf309c..7a850ff82f68b 100644 --- a/packages/@aws-cdk/aws-redshift/lib/cluster.ts +++ b/packages/@aws-cdk/aws-redshift/lib/cluster.ts @@ -354,6 +354,15 @@ export interface ClusterProps { * @default - No Elastic IP */ readonly elasticIp?: string + + /** + * If this flag is set, Amazon Redshift forces all COPY and UNLOAD traffic between your cluster and your data repositories through your virtual private cloud (VPC). + * + * @see https://docs.aws.amazon.com/redshift/latest/mgmt/enhanced-vpc-routing.html + * + * @default - false + */ + readonly enhancedVpcRouting?: boolean } /** @@ -547,6 +556,7 @@ export class Cluster extends ClusterBase { encrypted: props.encrypted ?? true, classic: props.classicResizing, elasticIp: props.elasticIp, + enhancedVpcRouting: props.enhancedVpcRouting, }); this.cluster.applyRemovalPolicy(removalPolicy, { diff --git a/packages/@aws-cdk/aws-redshift/test/cluster-enhancedvpcrouting.integ.snapshot/EnhancedVpcRoutingDefaultTestDeployAssert10B513A1.assets.json b/packages/@aws-cdk/aws-redshift/test/cluster-enhancedvpcrouting.integ.snapshot/EnhancedVpcRoutingDefaultTestDeployAssert10B513A1.assets.json new file mode 100644 index 0000000000000..00fd66f1b4bc2 --- /dev/null +++ b/packages/@aws-cdk/aws-redshift/test/cluster-enhancedvpcrouting.integ.snapshot/EnhancedVpcRoutingDefaultTestDeployAssert10B513A1.assets.json @@ -0,0 +1,19 @@ +{ + "version": "21.0.0", + "files": { + "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { + "source": { + "path": "EnhancedVpcRoutingDefaultTestDeployAssert10B513A1.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-redshift/test/cluster-enhancedvpcrouting.integ.snapshot/EnhancedVpcRoutingDefaultTestDeployAssert10B513A1.template.json b/packages/@aws-cdk/aws-redshift/test/cluster-enhancedvpcrouting.integ.snapshot/EnhancedVpcRoutingDefaultTestDeployAssert10B513A1.template.json new file mode 100644 index 0000000000000..ad9d0fb73d1dd --- /dev/null +++ b/packages/@aws-cdk/aws-redshift/test/cluster-enhancedvpcrouting.integ.snapshot/EnhancedVpcRoutingDefaultTestDeployAssert10B513A1.template.json @@ -0,0 +1,36 @@ +{ + "Parameters": { + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" + } + }, + "Rules": { + "CheckBootstrapVersion": { + "Assertions": [ + { + "Assert": { + "Fn::Not": [ + { + "Fn::Contains": [ + [ + "1", + "2", + "3", + "4", + "5" + ], + { + "Ref": "BootstrapVersion" + } + ] + } + ] + }, + "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." + } + ] + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-redshift/test/cluster-enhancedvpcrouting.integ.snapshot/cdk.out b/packages/@aws-cdk/aws-redshift/test/cluster-enhancedvpcrouting.integ.snapshot/cdk.out new file mode 100644 index 0000000000000..8ecc185e9dbee --- /dev/null +++ b/packages/@aws-cdk/aws-redshift/test/cluster-enhancedvpcrouting.integ.snapshot/cdk.out @@ -0,0 +1 @@ +{"version":"21.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-redshift/test/cluster-enhancedvpcrouting.integ.snapshot/integ.json b/packages/@aws-cdk/aws-redshift/test/cluster-enhancedvpcrouting.integ.snapshot/integ.json new file mode 100644 index 0000000000000..dd54e06e8a6f1 --- /dev/null +++ b/packages/@aws-cdk/aws-redshift/test/cluster-enhancedvpcrouting.integ.snapshot/integ.json @@ -0,0 +1,12 @@ +{ + "version": "21.0.0", + "testCases": { + "EnhancedVpcRouting/DefaultTest": { + "stacks": [ + "redshift-enhancedvpcrouting-integ" + ], + "assertionStack": "EnhancedVpcRouting/DefaultTest/DeployAssert", + "assertionStackName": "EnhancedVpcRoutingDefaultTestDeployAssert10B513A1" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-redshift/test/cluster-enhancedvpcrouting.integ.snapshot/manifest.json b/packages/@aws-cdk/aws-redshift/test/cluster-enhancedvpcrouting.integ.snapshot/manifest.json new file mode 100644 index 0000000000000..88ff20370e7aa --- /dev/null +++ b/packages/@aws-cdk/aws-redshift/test/cluster-enhancedvpcrouting.integ.snapshot/manifest.json @@ -0,0 +1,273 @@ +{ + "version": "21.0.0", + "artifacts": { + "Tree": { + "type": "cdk:tree", + "properties": { + "file": "tree.json" + } + }, + "redshift-enhancedvpcrouting-integ.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "redshift-enhancedvpcrouting-integ.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "redshift-enhancedvpcrouting-integ": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "redshift-enhancedvpcrouting-integ.template.json", + "validateOnSynth": false, + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/88e2010a08d484eca3203f7e1bcffce43eaa10faedbd092b56c3d70967765b7a.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "redshift-enhancedvpcrouting-integ.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dependencies": [ + "redshift-enhancedvpcrouting-integ.assets" + ], + "metadata": { + "/redshift-enhancedvpcrouting-integ/VPC/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCB9E5F0B4" + } + ], + "/redshift-enhancedvpcrouting-integ/VPC/PublicSubnet1/Subnet": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCPublicSubnet1SubnetB4246D30" + } + ], + "/redshift-enhancedvpcrouting-integ/VPC/PublicSubnet1/RouteTable": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCPublicSubnet1RouteTableFEE4B781" + } + ], + "/redshift-enhancedvpcrouting-integ/VPC/PublicSubnet1/RouteTableAssociation": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCPublicSubnet1RouteTableAssociation0B0896DC" + } + ], + "/redshift-enhancedvpcrouting-integ/VPC/PublicSubnet1/DefaultRoute": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCPublicSubnet1DefaultRoute91CEF279" + } + ], + "/redshift-enhancedvpcrouting-integ/VPC/PublicSubnet1/EIP": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCPublicSubnet1EIP6AD938E8" + } + ], + "/redshift-enhancedvpcrouting-integ/VPC/PublicSubnet1/NATGateway": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCPublicSubnet1NATGatewayE0556630" + } + ], + "/redshift-enhancedvpcrouting-integ/VPC/PublicSubnet2/Subnet": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCPublicSubnet2Subnet74179F39" + } + ], + "/redshift-enhancedvpcrouting-integ/VPC/PublicSubnet2/RouteTable": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCPublicSubnet2RouteTable6F1A15F1" + } + ], + "/redshift-enhancedvpcrouting-integ/VPC/PublicSubnet2/RouteTableAssociation": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCPublicSubnet2RouteTableAssociation5A808732" + } + ], + "/redshift-enhancedvpcrouting-integ/VPC/PublicSubnet2/DefaultRoute": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCPublicSubnet2DefaultRouteB7481BBA" + } + ], + "/redshift-enhancedvpcrouting-integ/VPC/PublicSubnet2/EIP": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCPublicSubnet2EIP4947BC00" + } + ], + "/redshift-enhancedvpcrouting-integ/VPC/PublicSubnet2/NATGateway": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCPublicSubnet2NATGateway3C070193" + } + ], + "/redshift-enhancedvpcrouting-integ/VPC/PrivateSubnet1/Subnet": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCPrivateSubnet1Subnet8BCA10E0" + } + ], + "/redshift-enhancedvpcrouting-integ/VPC/PrivateSubnet1/RouteTable": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCPrivateSubnet1RouteTableBE8A6027" + } + ], + "/redshift-enhancedvpcrouting-integ/VPC/PrivateSubnet1/RouteTableAssociation": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCPrivateSubnet1RouteTableAssociation347902D1" + } + ], + "/redshift-enhancedvpcrouting-integ/VPC/PrivateSubnet1/DefaultRoute": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCPrivateSubnet1DefaultRouteAE1D6490" + } + ], + "/redshift-enhancedvpcrouting-integ/VPC/PrivateSubnet2/Subnet": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCPrivateSubnet2SubnetCFCDAA7A" + } + ], + "/redshift-enhancedvpcrouting-integ/VPC/PrivateSubnet2/RouteTable": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCPrivateSubnet2RouteTable0A19E10E" + } + ], + "/redshift-enhancedvpcrouting-integ/VPC/PrivateSubnet2/RouteTableAssociation": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCPrivateSubnet2RouteTableAssociation0C73D413" + } + ], + "/redshift-enhancedvpcrouting-integ/VPC/PrivateSubnet2/DefaultRoute": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCPrivateSubnet2DefaultRouteF4F5CFD2" + } + ], + "/redshift-enhancedvpcrouting-integ/VPC/IGW": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCIGWB7E252D3" + } + ], + "/redshift-enhancedvpcrouting-integ/VPC/VPCGW": [ + { + "type": "aws:cdk:logicalId", + "data": "VPCVPCGW99B986DC" + } + ], + "/redshift-enhancedvpcrouting-integ/Cluster/Subnets/Default": [ + { + "type": "aws:cdk:logicalId", + "data": "ClusterSubnetsDCFA5CB7" + } + ], + "/redshift-enhancedvpcrouting-integ/Cluster/SecurityGroup/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "ClusterSecurityGroup0921994B" + } + ], + "/redshift-enhancedvpcrouting-integ/Cluster/Secret/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "ClusterSecret6368BD0F" + } + ], + "/redshift-enhancedvpcrouting-integ/Cluster/Secret/Attachment/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "ClusterSecretAttachment769E6258" + } + ], + "/redshift-enhancedvpcrouting-integ/Cluster/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "ClusterEB0386A7" + } + ], + "/redshift-enhancedvpcrouting-integ/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/redshift-enhancedvpcrouting-integ/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "redshift-enhancedvpcrouting-integ" + }, + "EnhancedVpcRoutingDefaultTestDeployAssert10B513A1.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "EnhancedVpcRoutingDefaultTestDeployAssert10B513A1.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "EnhancedVpcRoutingDefaultTestDeployAssert10B513A1": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "EnhancedVpcRoutingDefaultTestDeployAssert10B513A1.template.json", + "validateOnSynth": false, + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "EnhancedVpcRoutingDefaultTestDeployAssert10B513A1.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dependencies": [ + "EnhancedVpcRoutingDefaultTestDeployAssert10B513A1.assets" + ], + "metadata": { + "/EnhancedVpcRouting/DefaultTest/DeployAssert/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/EnhancedVpcRouting/DefaultTest/DeployAssert/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "EnhancedVpcRouting/DefaultTest/DeployAssert" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-redshift/test/cluster-enhancedvpcrouting.integ.snapshot/redshift-enhancedvpcrouting-integ.assets.json b/packages/@aws-cdk/aws-redshift/test/cluster-enhancedvpcrouting.integ.snapshot/redshift-enhancedvpcrouting-integ.assets.json new file mode 100644 index 0000000000000..02aab1b89f83b --- /dev/null +++ b/packages/@aws-cdk/aws-redshift/test/cluster-enhancedvpcrouting.integ.snapshot/redshift-enhancedvpcrouting-integ.assets.json @@ -0,0 +1,19 @@ +{ + "version": "21.0.0", + "files": { + "88e2010a08d484eca3203f7e1bcffce43eaa10faedbd092b56c3d70967765b7a": { + "source": { + "path": "redshift-enhancedvpcrouting-integ.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "88e2010a08d484eca3203f7e1bcffce43eaa10faedbd092b56c3d70967765b7a.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-redshift/test/cluster-enhancedvpcrouting.integ.snapshot/redshift-enhancedvpcrouting-integ.template.json b/packages/@aws-cdk/aws-redshift/test/cluster-enhancedvpcrouting.integ.snapshot/redshift-enhancedvpcrouting-integ.template.json new file mode 100644 index 0000000000000..11ee8a25f8fb6 --- /dev/null +++ b/packages/@aws-cdk/aws-redshift/test/cluster-enhancedvpcrouting.integ.snapshot/redshift-enhancedvpcrouting-integ.template.json @@ -0,0 +1,537 @@ +{ + "Resources": { + "VPCB9E5F0B4": { + "Type": "AWS::EC2::VPC", + "Properties": { + "CidrBlock": "10.0.0.0/16", + "EnableDnsHostnames": true, + "EnableDnsSupport": true, + "InstanceTenancy": "default", + "Tags": [ + { + "Key": "Name", + "Value": "redshift-enhancedvpcrouting-integ/VPC" + } + ] + } + }, + "VPCPublicSubnet1SubnetB4246D30": { + "Type": "AWS::EC2::Subnet", + "Properties": { + "VpcId": { + "Ref": "VPCB9E5F0B4" + }, + "AvailabilityZone": { + "Fn::Select": [ + 0, + { + "Fn::GetAZs": "" + } + ] + }, + "CidrBlock": "10.0.0.0/18", + "MapPublicIpOnLaunch": true, + "Tags": [ + { + "Key": "aws-cdk:subnet-name", + "Value": "Public" + }, + { + "Key": "aws-cdk:subnet-type", + "Value": "Public" + }, + { + "Key": "Name", + "Value": "redshift-enhancedvpcrouting-integ/VPC/PublicSubnet1" + } + ] + } + }, + "VPCPublicSubnet1RouteTableFEE4B781": { + "Type": "AWS::EC2::RouteTable", + "Properties": { + "VpcId": { + "Ref": "VPCB9E5F0B4" + }, + "Tags": [ + { + "Key": "Name", + "Value": "redshift-enhancedvpcrouting-integ/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", + "Tags": [ + { + "Key": "Name", + "Value": "redshift-enhancedvpcrouting-integ/VPC/PublicSubnet1" + } + ] + } + }, + "VPCPublicSubnet1NATGatewayE0556630": { + "Type": "AWS::EC2::NatGateway", + "Properties": { + "SubnetId": { + "Ref": "VPCPublicSubnet1SubnetB4246D30" + }, + "AllocationId": { + "Fn::GetAtt": [ + "VPCPublicSubnet1EIP6AD938E8", + "AllocationId" + ] + }, + "Tags": [ + { + "Key": "Name", + "Value": "redshift-enhancedvpcrouting-integ/VPC/PublicSubnet1" + } + ] + }, + "DependsOn": [ + "VPCPublicSubnet1DefaultRoute91CEF279", + "VPCPublicSubnet1RouteTableAssociation0B0896DC" + ] + }, + "VPCPublicSubnet2Subnet74179F39": { + "Type": "AWS::EC2::Subnet", + "Properties": { + "VpcId": { + "Ref": "VPCB9E5F0B4" + }, + "AvailabilityZone": { + "Fn::Select": [ + 1, + { + "Fn::GetAZs": "" + } + ] + }, + "CidrBlock": "10.0.64.0/18", + "MapPublicIpOnLaunch": true, + "Tags": [ + { + "Key": "aws-cdk:subnet-name", + "Value": "Public" + }, + { + "Key": "aws-cdk:subnet-type", + "Value": "Public" + }, + { + "Key": "Name", + "Value": "redshift-enhancedvpcrouting-integ/VPC/PublicSubnet2" + } + ] + } + }, + "VPCPublicSubnet2RouteTable6F1A15F1": { + "Type": "AWS::EC2::RouteTable", + "Properties": { + "VpcId": { + "Ref": "VPCB9E5F0B4" + }, + "Tags": [ + { + "Key": "Name", + "Value": "redshift-enhancedvpcrouting-integ/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", + "Tags": [ + { + "Key": "Name", + "Value": "redshift-enhancedvpcrouting-integ/VPC/PublicSubnet2" + } + ] + } + }, + "VPCPublicSubnet2NATGateway3C070193": { + "Type": "AWS::EC2::NatGateway", + "Properties": { + "SubnetId": { + "Ref": "VPCPublicSubnet2Subnet74179F39" + }, + "AllocationId": { + "Fn::GetAtt": [ + "VPCPublicSubnet2EIP4947BC00", + "AllocationId" + ] + }, + "Tags": [ + { + "Key": "Name", + "Value": "redshift-enhancedvpcrouting-integ/VPC/PublicSubnet2" + } + ] + }, + "DependsOn": [ + "VPCPublicSubnet2DefaultRouteB7481BBA", + "VPCPublicSubnet2RouteTableAssociation5A808732" + ] + }, + "VPCPrivateSubnet1Subnet8BCA10E0": { + "Type": "AWS::EC2::Subnet", + "Properties": { + "VpcId": { + "Ref": "VPCB9E5F0B4" + }, + "AvailabilityZone": { + "Fn::Select": [ + 0, + { + "Fn::GetAZs": "" + } + ] + }, + "CidrBlock": "10.0.128.0/18", + "MapPublicIpOnLaunch": false, + "Tags": [ + { + "Key": "aws-cdk:subnet-name", + "Value": "Private" + }, + { + "Key": "aws-cdk:subnet-type", + "Value": "Private" + }, + { + "Key": "Name", + "Value": "redshift-enhancedvpcrouting-integ/VPC/PrivateSubnet1" + } + ] + } + }, + "VPCPrivateSubnet1RouteTableBE8A6027": { + "Type": "AWS::EC2::RouteTable", + "Properties": { + "VpcId": { + "Ref": "VPCB9E5F0B4" + }, + "Tags": [ + { + "Key": "Name", + "Value": "redshift-enhancedvpcrouting-integ/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": { + "VpcId": { + "Ref": "VPCB9E5F0B4" + }, + "AvailabilityZone": { + "Fn::Select": [ + 1, + { + "Fn::GetAZs": "" + } + ] + }, + "CidrBlock": "10.0.192.0/18", + "MapPublicIpOnLaunch": false, + "Tags": [ + { + "Key": "aws-cdk:subnet-name", + "Value": "Private" + }, + { + "Key": "aws-cdk:subnet-type", + "Value": "Private" + }, + { + "Key": "Name", + "Value": "redshift-enhancedvpcrouting-integ/VPC/PrivateSubnet2" + } + ] + } + }, + "VPCPrivateSubnet2RouteTable0A19E10E": { + "Type": "AWS::EC2::RouteTable", + "Properties": { + "VpcId": { + "Ref": "VPCB9E5F0B4" + }, + "Tags": [ + { + "Key": "Name", + "Value": "redshift-enhancedvpcrouting-integ/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": "redshift-enhancedvpcrouting-integ/VPC" + } + ] + } + }, + "VPCVPCGW99B986DC": { + "Type": "AWS::EC2::VPCGatewayAttachment", + "Properties": { + "VpcId": { + "Ref": "VPCB9E5F0B4" + }, + "InternetGatewayId": { + "Ref": "VPCIGWB7E252D3" + } + } + }, + "ClusterSubnetsDCFA5CB7": { + "Type": "AWS::Redshift::ClusterSubnetGroup", + "Properties": { + "Description": "Subnets for Cluster Redshift cluster", + "SubnetIds": [ + { + "Ref": "VPCPublicSubnet1SubnetB4246D30" + }, + { + "Ref": "VPCPublicSubnet2Subnet74179F39" + } + ] + }, + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain" + }, + "ClusterSecurityGroup0921994B": { + "Type": "AWS::EC2::SecurityGroup", + "Properties": { + "GroupDescription": "Redshift security group", + "SecurityGroupEgress": [ + { + "CidrIp": "0.0.0.0/0", + "Description": "Allow all outbound traffic by default", + "IpProtocol": "-1" + } + ], + "VpcId": { + "Ref": "VPCB9E5F0B4" + } + } + }, + "ClusterSecret6368BD0F": { + "Type": "AWS::SecretsManager::Secret", + "Properties": { + "GenerateSecretString": { + "ExcludeCharacters": "\"@/\\ '", + "GenerateStringKey": "password", + "PasswordLength": 30, + "SecretStringTemplate": "{\"username\":\"admin\"}" + } + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "ClusterSecretAttachment769E6258": { + "Type": "AWS::SecretsManager::SecretTargetAttachment", + "Properties": { + "SecretId": { + "Ref": "ClusterSecret6368BD0F" + }, + "TargetId": { + "Ref": "ClusterEB0386A7" + }, + "TargetType": "AWS::Redshift::Cluster" + } + }, + "ClusterEB0386A7": { + "Type": "AWS::Redshift::Cluster", + "Properties": { + "ClusterType": "multi-node", + "DBName": "default_db", + "MasterUsername": { + "Fn::Join": [ + "", + [ + "{{resolve:secretsmanager:", + { + "Ref": "ClusterSecret6368BD0F" + }, + ":SecretString:username::}}" + ] + ] + }, + "MasterUserPassword": { + "Fn::Join": [ + "", + [ + "{{resolve:secretsmanager:", + { + "Ref": "ClusterSecret6368BD0F" + }, + ":SecretString:password::}}" + ] + ] + }, + "NodeType": "dc2.large", + "AllowVersionUpgrade": true, + "AutomatedSnapshotRetentionPeriod": 1, + "ClusterSubnetGroupName": { + "Ref": "ClusterSubnetsDCFA5CB7" + }, + "Encrypted": true, + "EnhancedVpcRouting": true, + "NumberOfNodes": 2, + "PubliclyAccessible": false, + "VpcSecurityGroupIds": [ + { + "Fn::GetAtt": [ + "ClusterSecurityGroup0921994B", + "GroupId" + ] + } + ] + }, + "UpdateReplacePolicy": "Retain", + "DeletionPolicy": "Retain" + } + }, + "Parameters": { + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" + } + }, + "Rules": { + "CheckBootstrapVersion": { + "Assertions": [ + { + "Assert": { + "Fn::Not": [ + { + "Fn::Contains": [ + [ + "1", + "2", + "3", + "4", + "5" + ], + { + "Ref": "BootstrapVersion" + } + ] + } + ] + }, + "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." + } + ] + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-redshift/test/cluster-enhancedvpcrouting.integ.snapshot/tree.json b/packages/@aws-cdk/aws-redshift/test/cluster-enhancedvpcrouting.integ.snapshot/tree.json new file mode 100644 index 0000000000000..ebc0d8772046a --- /dev/null +++ b/packages/@aws-cdk/aws-redshift/test/cluster-enhancedvpcrouting.integ.snapshot/tree.json @@ -0,0 +1,902 @@ +{ + "version": "tree-0.1", + "tree": { + "id": "App", + "path": "", + "children": { + "Tree": { + "id": "Tree", + "path": "Tree", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.129" + } + }, + "redshift-enhancedvpcrouting-integ": { + "id": "redshift-enhancedvpcrouting-integ", + "path": "redshift-enhancedvpcrouting-integ", + "children": { + "VPC": { + "id": "VPC", + "path": "redshift-enhancedvpcrouting-integ/VPC", + "children": { + "Resource": { + "id": "Resource", + "path": "redshift-enhancedvpcrouting-integ/VPC/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::VPC", + "aws:cdk:cloudformation:props": { + "cidrBlock": "10.0.0.0/16", + "enableDnsHostnames": true, + "enableDnsSupport": true, + "instanceTenancy": "default", + "tags": [ + { + "key": "Name", + "value": "redshift-enhancedvpcrouting-integ/VPC" + } + ] + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-ec2.CfnVPC", + "version": "0.0.0" + } + }, + "PublicSubnet1": { + "id": "PublicSubnet1", + "path": "redshift-enhancedvpcrouting-integ/VPC/PublicSubnet1", + "children": { + "Subnet": { + "id": "Subnet", + "path": "redshift-enhancedvpcrouting-integ/VPC/PublicSubnet1/Subnet", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", + "aws:cdk:cloudformation:props": { + "vpcId": { + "Ref": "VPCB9E5F0B4" + }, + "availabilityZone": { + "Fn::Select": [ + 0, + { + "Fn::GetAZs": "" + } + ] + }, + "cidrBlock": "10.0.0.0/18", + "mapPublicIpOnLaunch": true, + "tags": [ + { + "key": "aws-cdk:subnet-name", + "value": "Public" + }, + { + "key": "aws-cdk:subnet-type", + "value": "Public" + }, + { + "key": "Name", + "value": "redshift-enhancedvpcrouting-integ/VPC/PublicSubnet1" + } + ] + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-ec2.CfnSubnet", + "version": "0.0.0" + } + }, + "Acl": { + "id": "Acl", + "path": "redshift-enhancedvpcrouting-integ/VPC/PublicSubnet1/Acl", + "constructInfo": { + "fqn": "@aws-cdk/core.Resource", + "version": "0.0.0" + } + }, + "RouteTable": { + "id": "RouteTable", + "path": "redshift-enhancedvpcrouting-integ/VPC/PublicSubnet1/RouteTable", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", + "aws:cdk:cloudformation:props": { + "vpcId": { + "Ref": "VPCB9E5F0B4" + }, + "tags": [ + { + "key": "Name", + "value": "redshift-enhancedvpcrouting-integ/VPC/PublicSubnet1" + } + ] + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-ec2.CfnRouteTable", + "version": "0.0.0" + } + }, + "RouteTableAssociation": { + "id": "RouteTableAssociation", + "path": "redshift-enhancedvpcrouting-integ/VPC/PublicSubnet1/RouteTableAssociation", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", + "aws:cdk:cloudformation:props": { + "routeTableId": { + "Ref": "VPCPublicSubnet1RouteTableFEE4B781" + }, + "subnetId": { + "Ref": "VPCPublicSubnet1SubnetB4246D30" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-ec2.CfnSubnetRouteTableAssociation", + "version": "0.0.0" + } + }, + "DefaultRoute": { + "id": "DefaultRoute", + "path": "redshift-enhancedvpcrouting-integ/VPC/PublicSubnet1/DefaultRoute", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Route", + "aws:cdk:cloudformation:props": { + "routeTableId": { + "Ref": "VPCPublicSubnet1RouteTableFEE4B781" + }, + "destinationCidrBlock": "0.0.0.0/0", + "gatewayId": { + "Ref": "VPCIGWB7E252D3" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-ec2.CfnRoute", + "version": "0.0.0" + } + }, + "EIP": { + "id": "EIP", + "path": "redshift-enhancedvpcrouting-integ/VPC/PublicSubnet1/EIP", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::EIP", + "aws:cdk:cloudformation:props": { + "domain": "vpc", + "tags": [ + { + "key": "Name", + "value": "redshift-enhancedvpcrouting-integ/VPC/PublicSubnet1" + } + ] + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-ec2.CfnEIP", + "version": "0.0.0" + } + }, + "NATGateway": { + "id": "NATGateway", + "path": "redshift-enhancedvpcrouting-integ/VPC/PublicSubnet1/NATGateway", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::NatGateway", + "aws:cdk:cloudformation:props": { + "subnetId": { + "Ref": "VPCPublicSubnet1SubnetB4246D30" + }, + "allocationId": { + "Fn::GetAtt": [ + "VPCPublicSubnet1EIP6AD938E8", + "AllocationId" + ] + }, + "tags": [ + { + "key": "Name", + "value": "redshift-enhancedvpcrouting-integ/VPC/PublicSubnet1" + } + ] + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-ec2.CfnNatGateway", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-ec2.PublicSubnet", + "version": "0.0.0" + } + }, + "PublicSubnet2": { + "id": "PublicSubnet2", + "path": "redshift-enhancedvpcrouting-integ/VPC/PublicSubnet2", + "children": { + "Subnet": { + "id": "Subnet", + "path": "redshift-enhancedvpcrouting-integ/VPC/PublicSubnet2/Subnet", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", + "aws:cdk:cloudformation:props": { + "vpcId": { + "Ref": "VPCB9E5F0B4" + }, + "availabilityZone": { + "Fn::Select": [ + 1, + { + "Fn::GetAZs": "" + } + ] + }, + "cidrBlock": "10.0.64.0/18", + "mapPublicIpOnLaunch": true, + "tags": [ + { + "key": "aws-cdk:subnet-name", + "value": "Public" + }, + { + "key": "aws-cdk:subnet-type", + "value": "Public" + }, + { + "key": "Name", + "value": "redshift-enhancedvpcrouting-integ/VPC/PublicSubnet2" + } + ] + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-ec2.CfnSubnet", + "version": "0.0.0" + } + }, + "Acl": { + "id": "Acl", + "path": "redshift-enhancedvpcrouting-integ/VPC/PublicSubnet2/Acl", + "constructInfo": { + "fqn": "@aws-cdk/core.Resource", + "version": "0.0.0" + } + }, + "RouteTable": { + "id": "RouteTable", + "path": "redshift-enhancedvpcrouting-integ/VPC/PublicSubnet2/RouteTable", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", + "aws:cdk:cloudformation:props": { + "vpcId": { + "Ref": "VPCB9E5F0B4" + }, + "tags": [ + { + "key": "Name", + "value": "redshift-enhancedvpcrouting-integ/VPC/PublicSubnet2" + } + ] + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-ec2.CfnRouteTable", + "version": "0.0.0" + } + }, + "RouteTableAssociation": { + "id": "RouteTableAssociation", + "path": "redshift-enhancedvpcrouting-integ/VPC/PublicSubnet2/RouteTableAssociation", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", + "aws:cdk:cloudformation:props": { + "routeTableId": { + "Ref": "VPCPublicSubnet2RouteTable6F1A15F1" + }, + "subnetId": { + "Ref": "VPCPublicSubnet2Subnet74179F39" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-ec2.CfnSubnetRouteTableAssociation", + "version": "0.0.0" + } + }, + "DefaultRoute": { + "id": "DefaultRoute", + "path": "redshift-enhancedvpcrouting-integ/VPC/PublicSubnet2/DefaultRoute", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Route", + "aws:cdk:cloudformation:props": { + "routeTableId": { + "Ref": "VPCPublicSubnet2RouteTable6F1A15F1" + }, + "destinationCidrBlock": "0.0.0.0/0", + "gatewayId": { + "Ref": "VPCIGWB7E252D3" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-ec2.CfnRoute", + "version": "0.0.0" + } + }, + "EIP": { + "id": "EIP", + "path": "redshift-enhancedvpcrouting-integ/VPC/PublicSubnet2/EIP", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::EIP", + "aws:cdk:cloudformation:props": { + "domain": "vpc", + "tags": [ + { + "key": "Name", + "value": "redshift-enhancedvpcrouting-integ/VPC/PublicSubnet2" + } + ] + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-ec2.CfnEIP", + "version": "0.0.0" + } + }, + "NATGateway": { + "id": "NATGateway", + "path": "redshift-enhancedvpcrouting-integ/VPC/PublicSubnet2/NATGateway", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::NatGateway", + "aws:cdk:cloudformation:props": { + "subnetId": { + "Ref": "VPCPublicSubnet2Subnet74179F39" + }, + "allocationId": { + "Fn::GetAtt": [ + "VPCPublicSubnet2EIP4947BC00", + "AllocationId" + ] + }, + "tags": [ + { + "key": "Name", + "value": "redshift-enhancedvpcrouting-integ/VPC/PublicSubnet2" + } + ] + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-ec2.CfnNatGateway", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-ec2.PublicSubnet", + "version": "0.0.0" + } + }, + "PrivateSubnet1": { + "id": "PrivateSubnet1", + "path": "redshift-enhancedvpcrouting-integ/VPC/PrivateSubnet1", + "children": { + "Subnet": { + "id": "Subnet", + "path": "redshift-enhancedvpcrouting-integ/VPC/PrivateSubnet1/Subnet", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", + "aws:cdk:cloudformation:props": { + "vpcId": { + "Ref": "VPCB9E5F0B4" + }, + "availabilityZone": { + "Fn::Select": [ + 0, + { + "Fn::GetAZs": "" + } + ] + }, + "cidrBlock": "10.0.128.0/18", + "mapPublicIpOnLaunch": false, + "tags": [ + { + "key": "aws-cdk:subnet-name", + "value": "Private" + }, + { + "key": "aws-cdk:subnet-type", + "value": "Private" + }, + { + "key": "Name", + "value": "redshift-enhancedvpcrouting-integ/VPC/PrivateSubnet1" + } + ] + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-ec2.CfnSubnet", + "version": "0.0.0" + } + }, + "Acl": { + "id": "Acl", + "path": "redshift-enhancedvpcrouting-integ/VPC/PrivateSubnet1/Acl", + "constructInfo": { + "fqn": "@aws-cdk/core.Resource", + "version": "0.0.0" + } + }, + "RouteTable": { + "id": "RouteTable", + "path": "redshift-enhancedvpcrouting-integ/VPC/PrivateSubnet1/RouteTable", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", + "aws:cdk:cloudformation:props": { + "vpcId": { + "Ref": "VPCB9E5F0B4" + }, + "tags": [ + { + "key": "Name", + "value": "redshift-enhancedvpcrouting-integ/VPC/PrivateSubnet1" + } + ] + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-ec2.CfnRouteTable", + "version": "0.0.0" + } + }, + "RouteTableAssociation": { + "id": "RouteTableAssociation", + "path": "redshift-enhancedvpcrouting-integ/VPC/PrivateSubnet1/RouteTableAssociation", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", + "aws:cdk:cloudformation:props": { + "routeTableId": { + "Ref": "VPCPrivateSubnet1RouteTableBE8A6027" + }, + "subnetId": { + "Ref": "VPCPrivateSubnet1Subnet8BCA10E0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-ec2.CfnSubnetRouteTableAssociation", + "version": "0.0.0" + } + }, + "DefaultRoute": { + "id": "DefaultRoute", + "path": "redshift-enhancedvpcrouting-integ/VPC/PrivateSubnet1/DefaultRoute", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Route", + "aws:cdk:cloudformation:props": { + "routeTableId": { + "Ref": "VPCPrivateSubnet1RouteTableBE8A6027" + }, + "destinationCidrBlock": "0.0.0.0/0", + "natGatewayId": { + "Ref": "VPCPublicSubnet1NATGatewayE0556630" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-ec2.CfnRoute", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-ec2.PrivateSubnet", + "version": "0.0.0" + } + }, + "PrivateSubnet2": { + "id": "PrivateSubnet2", + "path": "redshift-enhancedvpcrouting-integ/VPC/PrivateSubnet2", + "children": { + "Subnet": { + "id": "Subnet", + "path": "redshift-enhancedvpcrouting-integ/VPC/PrivateSubnet2/Subnet", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", + "aws:cdk:cloudformation:props": { + "vpcId": { + "Ref": "VPCB9E5F0B4" + }, + "availabilityZone": { + "Fn::Select": [ + 1, + { + "Fn::GetAZs": "" + } + ] + }, + "cidrBlock": "10.0.192.0/18", + "mapPublicIpOnLaunch": false, + "tags": [ + { + "key": "aws-cdk:subnet-name", + "value": "Private" + }, + { + "key": "aws-cdk:subnet-type", + "value": "Private" + }, + { + "key": "Name", + "value": "redshift-enhancedvpcrouting-integ/VPC/PrivateSubnet2" + } + ] + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-ec2.CfnSubnet", + "version": "0.0.0" + } + }, + "Acl": { + "id": "Acl", + "path": "redshift-enhancedvpcrouting-integ/VPC/PrivateSubnet2/Acl", + "constructInfo": { + "fqn": "@aws-cdk/core.Resource", + "version": "0.0.0" + } + }, + "RouteTable": { + "id": "RouteTable", + "path": "redshift-enhancedvpcrouting-integ/VPC/PrivateSubnet2/RouteTable", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", + "aws:cdk:cloudformation:props": { + "vpcId": { + "Ref": "VPCB9E5F0B4" + }, + "tags": [ + { + "key": "Name", + "value": "redshift-enhancedvpcrouting-integ/VPC/PrivateSubnet2" + } + ] + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-ec2.CfnRouteTable", + "version": "0.0.0" + } + }, + "RouteTableAssociation": { + "id": "RouteTableAssociation", + "path": "redshift-enhancedvpcrouting-integ/VPC/PrivateSubnet2/RouteTableAssociation", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", + "aws:cdk:cloudformation:props": { + "routeTableId": { + "Ref": "VPCPrivateSubnet2RouteTable0A19E10E" + }, + "subnetId": { + "Ref": "VPCPrivateSubnet2SubnetCFCDAA7A" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-ec2.CfnSubnetRouteTableAssociation", + "version": "0.0.0" + } + }, + "DefaultRoute": { + "id": "DefaultRoute", + "path": "redshift-enhancedvpcrouting-integ/VPC/PrivateSubnet2/DefaultRoute", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Route", + "aws:cdk:cloudformation:props": { + "routeTableId": { + "Ref": "VPCPrivateSubnet2RouteTable0A19E10E" + }, + "destinationCidrBlock": "0.0.0.0/0", + "natGatewayId": { + "Ref": "VPCPublicSubnet2NATGateway3C070193" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-ec2.CfnRoute", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-ec2.PrivateSubnet", + "version": "0.0.0" + } + }, + "IGW": { + "id": "IGW", + "path": "redshift-enhancedvpcrouting-integ/VPC/IGW", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::InternetGateway", + "aws:cdk:cloudformation:props": { + "tags": [ + { + "key": "Name", + "value": "redshift-enhancedvpcrouting-integ/VPC" + } + ] + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-ec2.CfnInternetGateway", + "version": "0.0.0" + } + }, + "VPCGW": { + "id": "VPCGW", + "path": "redshift-enhancedvpcrouting-integ/VPC/VPCGW", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::VPCGatewayAttachment", + "aws:cdk:cloudformation:props": { + "vpcId": { + "Ref": "VPCB9E5F0B4" + }, + "internetGatewayId": { + "Ref": "VPCIGWB7E252D3" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-ec2.CfnVPCGatewayAttachment", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-ec2.Vpc", + "version": "0.0.0" + } + }, + "Cluster": { + "id": "Cluster", + "path": "redshift-enhancedvpcrouting-integ/Cluster", + "children": { + "Subnets": { + "id": "Subnets", + "path": "redshift-enhancedvpcrouting-integ/Cluster/Subnets", + "children": { + "Default": { + "id": "Default", + "path": "redshift-enhancedvpcrouting-integ/Cluster/Subnets/Default", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::Redshift::ClusterSubnetGroup", + "aws:cdk:cloudformation:props": { + "description": "Subnets for Cluster Redshift cluster", + "subnetIds": [ + { + "Ref": "VPCPublicSubnet1SubnetB4246D30" + }, + { + "Ref": "VPCPublicSubnet2Subnet74179F39" + } + ] + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-redshift.CfnClusterSubnetGroup", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-redshift.ClusterSubnetGroup", + "version": "0.0.0" + } + }, + "SecurityGroup": { + "id": "SecurityGroup", + "path": "redshift-enhancedvpcrouting-integ/Cluster/SecurityGroup", + "children": { + "Resource": { + "id": "Resource", + "path": "redshift-enhancedvpcrouting-integ/Cluster/SecurityGroup/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::SecurityGroup", + "aws:cdk:cloudformation:props": { + "groupDescription": "Redshift security group", + "securityGroupEgress": [ + { + "cidrIp": "0.0.0.0/0", + "description": "Allow all outbound traffic by default", + "ipProtocol": "-1" + } + ], + "vpcId": { + "Ref": "VPCB9E5F0B4" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-ec2.CfnSecurityGroup", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-ec2.SecurityGroup", + "version": "0.0.0" + } + }, + "Secret": { + "id": "Secret", + "path": "redshift-enhancedvpcrouting-integ/Cluster/Secret", + "children": { + "Resource": { + "id": "Resource", + "path": "redshift-enhancedvpcrouting-integ/Cluster/Secret/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::SecretsManager::Secret", + "aws:cdk:cloudformation:props": { + "generateSecretString": { + "passwordLength": 30, + "secretStringTemplate": "{\"username\":\"admin\"}", + "generateStringKey": "password", + "excludeCharacters": "\"@/\\ '" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-secretsmanager.CfnSecret", + "version": "0.0.0" + } + }, + "Attachment": { + "id": "Attachment", + "path": "redshift-enhancedvpcrouting-integ/Cluster/Secret/Attachment", + "children": { + "Resource": { + "id": "Resource", + "path": "redshift-enhancedvpcrouting-integ/Cluster/Secret/Attachment/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::SecretsManager::SecretTargetAttachment", + "aws:cdk:cloudformation:props": { + "secretId": { + "Ref": "ClusterSecret6368BD0F" + }, + "targetId": { + "Ref": "ClusterEB0386A7" + }, + "targetType": "AWS::Redshift::Cluster" + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-secretsmanager.CfnSecretTargetAttachment", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-secretsmanager.SecretTargetAttachment", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-redshift.DatabaseSecret", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "redshift-enhancedvpcrouting-integ/Cluster/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::Redshift::Cluster", + "aws:cdk:cloudformation:props": { + "clusterType": "multi-node", + "dbName": "default_db", + "masterUsername": { + "Fn::Join": [ + "", + [ + "{{resolve:secretsmanager:", + { + "Ref": "ClusterSecret6368BD0F" + }, + ":SecretString:username::}}" + ] + ] + }, + "masterUserPassword": { + "Fn::Join": [ + "", + [ + "{{resolve:secretsmanager:", + { + "Ref": "ClusterSecret6368BD0F" + }, + ":SecretString:password::}}" + ] + ] + }, + "nodeType": "dc2.large", + "allowVersionUpgrade": true, + "automatedSnapshotRetentionPeriod": 1, + "clusterSubnetGroupName": { + "Ref": "ClusterSubnetsDCFA5CB7" + }, + "encrypted": true, + "enhancedVpcRouting": true, + "numberOfNodes": 2, + "publiclyAccessible": false, + "vpcSecurityGroupIds": [ + { + "Fn::GetAtt": [ + "ClusterSecurityGroup0921994B", + "GroupId" + ] + } + ] + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-redshift.CfnCluster", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-redshift.Cluster", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/core.Stack", + "version": "0.0.0" + } + }, + "EnhancedVpcRouting": { + "id": "EnhancedVpcRouting", + "path": "EnhancedVpcRouting", + "children": { + "DefaultTest": { + "id": "DefaultTest", + "path": "EnhancedVpcRouting/DefaultTest", + "children": { + "Default": { + "id": "Default", + "path": "EnhancedVpcRouting/DefaultTest/Default", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.129" + } + }, + "DeployAssert": { + "id": "DeployAssert", + "path": "EnhancedVpcRouting/DefaultTest/DeployAssert", + "constructInfo": { + "fqn": "@aws-cdk/core.Stack", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests.IntegTestCase", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests.IntegTest", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/core.App", + "version": "0.0.0" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-redshift/test/integ.cluster-enhancedvpcrouting.ts b/packages/@aws-cdk/aws-redshift/test/integ.cluster-enhancedvpcrouting.ts new file mode 100644 index 0000000000000..394e334ecdd45 --- /dev/null +++ b/packages/@aws-cdk/aws-redshift/test/integ.cluster-enhancedvpcrouting.ts @@ -0,0 +1,33 @@ +#!/usr/bin/env node +import * as ec2 from '@aws-cdk/aws-ec2'; +import { Stack, App, StackProps } from '@aws-cdk/core'; +import * as integ from '@aws-cdk/integ-tests'; +import { Construct } from 'constructs'; +import * as redshift from '../lib'; + +class RedshiftEnv extends Stack { + constructor(scope: Construct, id: string, props?: StackProps) { + super(scope, id, props); + + const vpc = new ec2.Vpc(this, 'VPC'); + + new redshift.Cluster(this, 'Cluster', { + vpc: vpc, + vpcSubnets: { + subnetType: ec2.SubnetType.PUBLIC, + }, + masterUser: { + masterUsername: 'admin', + }, + enhancedVpcRouting: true, + }); + } +} + +const app = new App(); + +new integ.IntegTest(app, 'EnhancedVpcRouting', { + testCases: [new RedshiftEnv(app, 'redshift-enhancedvpcrouting-integ')], +}); + +app.synth(); diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/package.json b/packages/@aws-cdk/aws-stepfunctions-tasks/package.json index f4070e9932ceb..665bc5f50054e 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/package.json +++ b/packages/@aws-cdk/aws-stepfunctions-tasks/package.json @@ -79,7 +79,6 @@ }, "license": "Apache-2.0", "devDependencies": { - "@aws-cdk/integ-tests": "0.0.0", "@aws-cdk/assertions": "0.0.0", "@aws-cdk/aws-apigatewayv2": "0.0.0", "@aws-cdk/aws-apigatewayv2-integrations": "0.0.0", @@ -91,6 +90,7 @@ "@aws-cdk/aws-sns-subscriptions": "0.0.0", "@aws-cdk/cdk-build-tools": "0.0.0", "@aws-cdk/integ-runner": "0.0.0", + "@aws-cdk/integ-tests": "^0.0.0", "@aws-cdk/pkglint": "0.0.0", "@types/jest": "^27.5.2", "jest": "^27.5.1" diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/dynamodb/integ.stringset-after-parallel.ts b/packages/@aws-cdk/aws-stepfunctions-tasks/test/dynamodb/integ.stringset-after-parallel.ts new file mode 100644 index 0000000000000..d369ef0b6e826 --- /dev/null +++ b/packages/@aws-cdk/aws-stepfunctions-tasks/test/dynamodb/integ.stringset-after-parallel.ts @@ -0,0 +1,46 @@ +import * as ddb from '@aws-cdk/aws-dynamodb'; +import * as sfn from '@aws-cdk/aws-stepfunctions'; +import * as cdk from '@aws-cdk/core'; +import * as integ from '@aws-cdk/integ-tests'; +import * as tasks from '../../lib'; + +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'stringset-after-parallel'); + +const table = new ddb.Table(stack, 'Table', { + partitionKey: { name: 'pk', type: ddb.AttributeType.STRING }, + removalPolicy: cdk.RemovalPolicy.DESTROY, +}); + +const passPK = new sfn.Pass(stack, 'passPK', { + parameters: { 'pk.$': '$.pk' }, +}); +const passStringSet = new sfn.Pass(stack, 'PassStringSet', { + parameters: { 'stringset.$': '$.stringset' }, +}); + +const parallel = new sfn.Parallel(stack, 'Parallel', { + resultPath: '$', +}); +parallel.branch(passPK) + .branch(passStringSet); + +const putItem = new tasks.DynamoPutItem(stack, 'PutItem', { + table: table, + item: { + pk: tasks.DynamoAttributeValue.fromString('$[0].pk'), + stringset: tasks.DynamoAttributeValue.fromStringSet(sfn.JsonPath.listAt('$[1].stringset')), + }, +}); + +const definition = sfn.Chain.start(parallel).next(putItem); + +new sfn.StateMachine(stack, 'StateMachine', { + definition: definition, +}); + +new integ.IntegTest(app, 'StringSetAfterParallel', { + testCases: [stack], +}); + +app.synth(); \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/dynamodb/stringset-after-parallel.integ.snapshot/StringSetAfterParallelDefaultTestDeployAssert649ABBB9.assets.json b/packages/@aws-cdk/aws-stepfunctions-tasks/test/dynamodb/stringset-after-parallel.integ.snapshot/StringSetAfterParallelDefaultTestDeployAssert649ABBB9.assets.json new file mode 100644 index 0000000000000..a7d54b83a84ba --- /dev/null +++ b/packages/@aws-cdk/aws-stepfunctions-tasks/test/dynamodb/stringset-after-parallel.integ.snapshot/StringSetAfterParallelDefaultTestDeployAssert649ABBB9.assets.json @@ -0,0 +1,19 @@ +{ + "version": "21.0.0", + "files": { + "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { + "source": { + "path": "StringSetAfterParallelDefaultTestDeployAssert649ABBB9.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/dynamodb/stringset-after-parallel.integ.snapshot/StringSetAfterParallelDefaultTestDeployAssert649ABBB9.template.json b/packages/@aws-cdk/aws-stepfunctions-tasks/test/dynamodb/stringset-after-parallel.integ.snapshot/StringSetAfterParallelDefaultTestDeployAssert649ABBB9.template.json new file mode 100644 index 0000000000000..ad9d0fb73d1dd --- /dev/null +++ b/packages/@aws-cdk/aws-stepfunctions-tasks/test/dynamodb/stringset-after-parallel.integ.snapshot/StringSetAfterParallelDefaultTestDeployAssert649ABBB9.template.json @@ -0,0 +1,36 @@ +{ + "Parameters": { + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" + } + }, + "Rules": { + "CheckBootstrapVersion": { + "Assertions": [ + { + "Assert": { + "Fn::Not": [ + { + "Fn::Contains": [ + [ + "1", + "2", + "3", + "4", + "5" + ], + { + "Ref": "BootstrapVersion" + } + ] + } + ] + }, + "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." + } + ] + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/dynamodb/stringset-after-parallel.integ.snapshot/cdk.out b/packages/@aws-cdk/aws-stepfunctions-tasks/test/dynamodb/stringset-after-parallel.integ.snapshot/cdk.out new file mode 100644 index 0000000000000..8ecc185e9dbee --- /dev/null +++ b/packages/@aws-cdk/aws-stepfunctions-tasks/test/dynamodb/stringset-after-parallel.integ.snapshot/cdk.out @@ -0,0 +1 @@ +{"version":"21.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/dynamodb/stringset-after-parallel.integ.snapshot/integ.json b/packages/@aws-cdk/aws-stepfunctions-tasks/test/dynamodb/stringset-after-parallel.integ.snapshot/integ.json new file mode 100644 index 0000000000000..66d63b50ac63b --- /dev/null +++ b/packages/@aws-cdk/aws-stepfunctions-tasks/test/dynamodb/stringset-after-parallel.integ.snapshot/integ.json @@ -0,0 +1,12 @@ +{ + "version": "21.0.0", + "testCases": { + "StringSetAfterParallel/DefaultTest": { + "stacks": [ + "stringset-after-parallel" + ], + "assertionStack": "StringSetAfterParallel/DefaultTest/DeployAssert", + "assertionStackName": "StringSetAfterParallelDefaultTestDeployAssert649ABBB9" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/dynamodb/stringset-after-parallel.integ.snapshot/manifest.json b/packages/@aws-cdk/aws-stepfunctions-tasks/test/dynamodb/stringset-after-parallel.integ.snapshot/manifest.json new file mode 100644 index 0000000000000..55b9cc1dc0b09 --- /dev/null +++ b/packages/@aws-cdk/aws-stepfunctions-tasks/test/dynamodb/stringset-after-parallel.integ.snapshot/manifest.json @@ -0,0 +1,135 @@ +{ + "version": "21.0.0", + "artifacts": { + "Tree": { + "type": "cdk:tree", + "properties": { + "file": "tree.json" + } + }, + "stringset-after-parallel.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "stringset-after-parallel.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "stringset-after-parallel": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "stringset-after-parallel.template.json", + "validateOnSynth": false, + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/30011aca79761d24d65d6f3f8af03bf4a54f58ac4a5fdbadcb2d1fb0fa225066.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "stringset-after-parallel.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dependencies": [ + "stringset-after-parallel.assets" + ], + "metadata": { + "/stringset-after-parallel/Table/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "TableCD117FA1" + } + ], + "/stringset-after-parallel/StateMachine/Role/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "StateMachineRoleB840431D" + } + ], + "/stringset-after-parallel/StateMachine/Role/DefaultPolicy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "StateMachineRoleDefaultPolicyDF1E6607" + } + ], + "/stringset-after-parallel/StateMachine/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "StateMachine2E01A3A5" + } + ], + "/stringset-after-parallel/Service-principalMap": [ + { + "type": "aws:cdk:logicalId", + "data": "ServiceprincipalMap" + } + ], + "/stringset-after-parallel/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/stringset-after-parallel/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "stringset-after-parallel" + }, + "StringSetAfterParallelDefaultTestDeployAssert649ABBB9.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "StringSetAfterParallelDefaultTestDeployAssert649ABBB9.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "StringSetAfterParallelDefaultTestDeployAssert649ABBB9": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "StringSetAfterParallelDefaultTestDeployAssert649ABBB9.template.json", + "validateOnSynth": false, + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "StringSetAfterParallelDefaultTestDeployAssert649ABBB9.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dependencies": [ + "StringSetAfterParallelDefaultTestDeployAssert649ABBB9.assets" + ], + "metadata": { + "/StringSetAfterParallel/DefaultTest/DeployAssert/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/StringSetAfterParallel/DefaultTest/DeployAssert/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "StringSetAfterParallel/DefaultTest/DeployAssert" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/dynamodb/stringset-after-parallel.integ.snapshot/stringset-after-parallel.assets.json b/packages/@aws-cdk/aws-stepfunctions-tasks/test/dynamodb/stringset-after-parallel.integ.snapshot/stringset-after-parallel.assets.json new file mode 100644 index 0000000000000..a5e56277f024e --- /dev/null +++ b/packages/@aws-cdk/aws-stepfunctions-tasks/test/dynamodb/stringset-after-parallel.integ.snapshot/stringset-after-parallel.assets.json @@ -0,0 +1,19 @@ +{ + "version": "21.0.0", + "files": { + "30011aca79761d24d65d6f3f8af03bf4a54f58ac4a5fdbadcb2d1fb0fa225066": { + "source": { + "path": "stringset-after-parallel.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "30011aca79761d24d65d6f3f8af03bf4a54f58ac4a5fdbadcb2d1fb0fa225066.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/dynamodb/stringset-after-parallel.integ.snapshot/stringset-after-parallel.template.json b/packages/@aws-cdk/aws-stepfunctions-tasks/test/dynamodb/stringset-after-parallel.integ.snapshot/stringset-after-parallel.template.json new file mode 100644 index 0000000000000..12da0403f354e --- /dev/null +++ b/packages/@aws-cdk/aws-stepfunctions-tasks/test/dynamodb/stringset-after-parallel.integ.snapshot/stringset-after-parallel.template.json @@ -0,0 +1,254 @@ +{ + "Resources": { + "TableCD117FA1": { + "Type": "AWS::DynamoDB::Table", + "Properties": { + "KeySchema": [ + { + "AttributeName": "pk", + "KeyType": "HASH" + } + ], + "AttributeDefinitions": [ + { + "AttributeName": "pk", + "AttributeType": "S" + } + ], + "ProvisionedThroughput": { + "ReadCapacityUnits": 5, + "WriteCapacityUnits": 5 + } + }, + "UpdateReplacePolicy": "Delete", + "DeletionPolicy": "Delete" + }, + "StateMachineRoleB840431D": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": { + "Fn::FindInMap": [ + "ServiceprincipalMap", + { + "Ref": "AWS::Region" + }, + "states" + ] + } + } + } + ], + "Version": "2012-10-17" + } + } + }, + "StateMachineRoleDefaultPolicyDF1E6607": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": "dynamodb:PutItem", + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":dynamodb:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":table/", + { + "Ref": "TableCD117FA1" + } + ] + ] + } + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "StateMachineRoleDefaultPolicyDF1E6607", + "Roles": [ + { + "Ref": "StateMachineRoleB840431D" + } + ] + } + }, + "StateMachine2E01A3A5": { + "Type": "AWS::StepFunctions::StateMachine", + "Properties": { + "RoleArn": { + "Fn::GetAtt": [ + "StateMachineRoleB840431D", + "Arn" + ] + }, + "DefinitionString": { + "Fn::Join": [ + "", + [ + "{\"StartAt\":\"Parallel\",\"States\":{\"Parallel\":{\"Type\":\"Parallel\",\"ResultPath\":\"$\",\"Next\":\"PutItem\",\"Branches\":[{\"StartAt\":\"passPK\",\"States\":{\"passPK\":{\"Type\":\"Pass\",\"Parameters\":{\"pk.$\":\"$.pk\"},\"End\":true}}},{\"StartAt\":\"PassStringSet\",\"States\":{\"PassStringSet\":{\"Type\":\"Pass\",\"Parameters\":{\"stringset.$\":\"$.stringset\"},\"End\":true}}}]},\"PutItem\":{\"End\":true,\"Type\":\"Task\",\"Resource\":\"arn:", + { + "Ref": "AWS::Partition" + }, + ":states:::dynamodb:putItem\",\"Parameters\":{\"Item\":{\"pk\":{\"S\":\"$[0].pk\"},\"stringset\":{\"SS.$\":\"$[1].stringset\"}},\"TableName\":\"", + { + "Ref": "TableCD117FA1" + }, + "\"}}}}" + ] + ] + } + }, + "DependsOn": [ + "StateMachineRoleDefaultPolicyDF1E6607", + "StateMachineRoleB840431D" + ] + } + }, + "Mappings": { + "ServiceprincipalMap": { + "af-south-1": { + "states": "states.af-south-1.amazonaws.com" + }, + "ap-east-1": { + "states": "states.ap-east-1.amazonaws.com" + }, + "ap-northeast-1": { + "states": "states.ap-northeast-1.amazonaws.com" + }, + "ap-northeast-2": { + "states": "states.ap-northeast-2.amazonaws.com" + }, + "ap-northeast-3": { + "states": "states.ap-northeast-3.amazonaws.com" + }, + "ap-south-1": { + "states": "states.ap-south-1.amazonaws.com" + }, + "ap-southeast-1": { + "states": "states.ap-southeast-1.amazonaws.com" + }, + "ap-southeast-2": { + "states": "states.ap-southeast-2.amazonaws.com" + }, + "ap-southeast-3": { + "states": "states.ap-southeast-3.amazonaws.com" + }, + "ca-central-1": { + "states": "states.ca-central-1.amazonaws.com" + }, + "cn-north-1": { + "states": "states.cn-north-1.amazonaws.com" + }, + "cn-northwest-1": { + "states": "states.cn-northwest-1.amazonaws.com" + }, + "eu-central-1": { + "states": "states.eu-central-1.amazonaws.com" + }, + "eu-north-1": { + "states": "states.eu-north-1.amazonaws.com" + }, + "eu-south-1": { + "states": "states.eu-south-1.amazonaws.com" + }, + "eu-south-2": { + "states": "states.eu-south-2.amazonaws.com" + }, + "eu-west-1": { + "states": "states.eu-west-1.amazonaws.com" + }, + "eu-west-2": { + "states": "states.eu-west-2.amazonaws.com" + }, + "eu-west-3": { + "states": "states.eu-west-3.amazonaws.com" + }, + "me-south-1": { + "states": "states.me-south-1.amazonaws.com" + }, + "sa-east-1": { + "states": "states.sa-east-1.amazonaws.com" + }, + "us-east-1": { + "states": "states.us-east-1.amazonaws.com" + }, + "us-east-2": { + "states": "states.us-east-2.amazonaws.com" + }, + "us-gov-east-1": { + "states": "states.us-gov-east-1.amazonaws.com" + }, + "us-gov-west-1": { + "states": "states.us-gov-west-1.amazonaws.com" + }, + "us-iso-east-1": { + "states": "states.amazonaws.com" + }, + "us-iso-west-1": { + "states": "states.amazonaws.com" + }, + "us-isob-east-1": { + "states": "states.amazonaws.com" + }, + "us-west-1": { + "states": "states.us-west-1.amazonaws.com" + }, + "us-west-2": { + "states": "states.us-west-2.amazonaws.com" + } + } + }, + "Parameters": { + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" + } + }, + "Rules": { + "CheckBootstrapVersion": { + "Assertions": [ + { + "Assert": { + "Fn::Not": [ + { + "Fn::Contains": [ + [ + "1", + "2", + "3", + "4", + "5" + ], + { + "Ref": "BootstrapVersion" + } + ] + } + ] + }, + "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." + } + ] + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/dynamodb/stringset-after-parallel.integ.snapshot/tree.json b/packages/@aws-cdk/aws-stepfunctions-tasks/test/dynamodb/stringset-after-parallel.integ.snapshot/tree.json new file mode 100644 index 0000000000000..83d2ffb859970 --- /dev/null +++ b/packages/@aws-cdk/aws-stepfunctions-tasks/test/dynamodb/stringset-after-parallel.integ.snapshot/tree.json @@ -0,0 +1,303 @@ +{ + "version": "tree-0.1", + "tree": { + "id": "App", + "path": "", + "children": { + "Tree": { + "id": "Tree", + "path": "Tree", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.123" + } + }, + "stringset-after-parallel": { + "id": "stringset-after-parallel", + "path": "stringset-after-parallel", + "children": { + "Table": { + "id": "Table", + "path": "stringset-after-parallel/Table", + "children": { + "Resource": { + "id": "Resource", + "path": "stringset-after-parallel/Table/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::DynamoDB::Table", + "aws:cdk:cloudformation:props": { + "keySchema": [ + { + "attributeName": "pk", + "keyType": "HASH" + } + ], + "attributeDefinitions": [ + { + "attributeName": "pk", + "attributeType": "S" + } + ], + "provisionedThroughput": { + "readCapacityUnits": 5, + "writeCapacityUnits": 5 + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-dynamodb.CfnTable", + "version": "0.0.0" + } + }, + "ScalingRole": { + "id": "ScalingRole", + "path": "stringset-after-parallel/Table/ScalingRole", + "constructInfo": { + "fqn": "@aws-cdk/core.Resource", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-dynamodb.Table", + "version": "0.0.0" + } + }, + "passPK": { + "id": "passPK", + "path": "stringset-after-parallel/passPK", + "constructInfo": { + "fqn": "@aws-cdk/aws-stepfunctions.Pass", + "version": "0.0.0" + } + }, + "PassStringSet": { + "id": "PassStringSet", + "path": "stringset-after-parallel/PassStringSet", + "constructInfo": { + "fqn": "@aws-cdk/aws-stepfunctions.Pass", + "version": "0.0.0" + } + }, + "Parallel": { + "id": "Parallel", + "path": "stringset-after-parallel/Parallel", + "constructInfo": { + "fqn": "@aws-cdk/aws-stepfunctions.Parallel", + "version": "0.0.0" + } + }, + "PutItem": { + "id": "PutItem", + "path": "stringset-after-parallel/PutItem", + "constructInfo": { + "fqn": "@aws-cdk/aws-stepfunctions-tasks.DynamoPutItem", + "version": "0.0.0" + } + }, + "StateMachine": { + "id": "StateMachine", + "path": "stringset-after-parallel/StateMachine", + "children": { + "Role": { + "id": "Role", + "path": "stringset-after-parallel/StateMachine/Role", + "children": { + "Resource": { + "id": "Resource", + "path": "stringset-after-parallel/StateMachine/Role/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": { + "Fn::FindInMap": [ + "ServiceprincipalMap", + { + "Ref": "AWS::Region" + }, + "states" + ] + } + } + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-iam.CfnRole", + "version": "0.0.0" + } + }, + "DefaultPolicy": { + "id": "DefaultPolicy", + "path": "stringset-after-parallel/StateMachine/Role/DefaultPolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "stringset-after-parallel/StateMachine/Role/DefaultPolicy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": "dynamodb:PutItem", + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":dynamodb:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":table/", + { + "Ref": "TableCD117FA1" + } + ] + ] + } + } + ], + "Version": "2012-10-17" + }, + "policyName": "StateMachineRoleDefaultPolicyDF1E6607", + "roles": [ + { + "Ref": "StateMachineRoleB840431D" + } + ] + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-iam.CfnPolicy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-iam.Policy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-iam.Role", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "stringset-after-parallel/StateMachine/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::StepFunctions::StateMachine", + "aws:cdk:cloudformation:props": { + "roleArn": { + "Fn::GetAtt": [ + "StateMachineRoleB840431D", + "Arn" + ] + }, + "definitionString": { + "Fn::Join": [ + "", + [ + "{\"StartAt\":\"Parallel\",\"States\":{\"Parallel\":{\"Type\":\"Parallel\",\"ResultPath\":\"$\",\"Next\":\"PutItem\",\"Branches\":[{\"StartAt\":\"passPK\",\"States\":{\"passPK\":{\"Type\":\"Pass\",\"Parameters\":{\"pk.$\":\"$.pk\"},\"End\":true}}},{\"StartAt\":\"PassStringSet\",\"States\":{\"PassStringSet\":{\"Type\":\"Pass\",\"Parameters\":{\"stringset.$\":\"$.stringset\"},\"End\":true}}}]},\"PutItem\":{\"End\":true,\"Type\":\"Task\",\"Resource\":\"arn:", + { + "Ref": "AWS::Partition" + }, + ":states:::dynamodb:putItem\",\"Parameters\":{\"Item\":{\"pk\":{\"S\":\"$[0].pk\"},\"stringset\":{\"SS.$\":\"$[1].stringset\"}},\"TableName\":\"", + { + "Ref": "TableCD117FA1" + }, + "\"}}}}" + ] + ] + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-stepfunctions.CfnStateMachine", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-stepfunctions.StateMachine", + "version": "0.0.0" + } + }, + "Service-principalMap": { + "id": "Service-principalMap", + "path": "stringset-after-parallel/Service-principalMap", + "constructInfo": { + "fqn": "@aws-cdk/core.CfnMapping", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/core.Stack", + "version": "0.0.0" + } + }, + "StringSetAfterParallel": { + "id": "StringSetAfterParallel", + "path": "StringSetAfterParallel", + "children": { + "DefaultTest": { + "id": "DefaultTest", + "path": "StringSetAfterParallel/DefaultTest", + "children": { + "Default": { + "id": "Default", + "path": "StringSetAfterParallel/DefaultTest/Default", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.123" + } + }, + "DeployAssert": { + "id": "DeployAssert", + "path": "StringSetAfterParallel/DefaultTest/DeployAssert", + "constructInfo": { + "fqn": "@aws-cdk/core.Stack", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests.IntegTestCase", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests.IntegTest", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/core.App", + "version": "0.0.0" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions/lib/fields.ts b/packages/@aws-cdk/aws-stepfunctions/lib/fields.ts index e78c026293798..485b92b62337c 100644 --- a/packages/@aws-cdk/aws-stepfunctions/lib/fields.ts +++ b/packages/@aws-cdk/aws-stepfunctions/lib/fields.ts @@ -310,8 +310,10 @@ function validateJsonPath(path: string) { } function validateDataPath(path: string) { - if (path !== '$' && !path.startsWith('$.')) { - throw new Error("Data JSON path values must either be exactly equal to '$' or start with '$.'"); + if (path !== '$' + && !path.startsWith('$[') + && !path.startsWith('$.')) { + throw new Error("Data JSON path values must either be exactly equal to '$', start with '$[' or start with '$.'"); } } diff --git a/packages/@aws-cdk/aws-stepfunctions/package.json b/packages/@aws-cdk/aws-stepfunctions/package.json index f9cedd6d66502..536249cc16f44 100644 --- a/packages/@aws-cdk/aws-stepfunctions/package.json +++ b/packages/@aws-cdk/aws-stepfunctions/package.json @@ -82,8 +82,9 @@ "devDependencies": { "@aws-cdk/assertions": "0.0.0", "@aws-cdk/cdk-build-tools": "0.0.0", - "@aws-cdk/integ-runner": "0.0.0", "@aws-cdk/cfn2ts": "0.0.0", + "@aws-cdk/integ-runner": "0.0.0", + "@aws-cdk/integ-tests": "^0.0.0", "@aws-cdk/pkglint": "0.0.0", "@types/jest": "^27.5.2" }, diff --git a/packages/@aws-cdk/aws-stepfunctions/test/fields.test.ts b/packages/@aws-cdk/aws-stepfunctions/test/fields.test.ts index eec3864f938e6..3acbb95036924 100644 --- a/packages/@aws-cdk/aws-stepfunctions/test/fields.test.ts +++ b/packages/@aws-cdk/aws-stepfunctions/test/fields.test.ts @@ -63,6 +63,13 @@ describe('Fields', () => { }), ).toStrictEqual(['$.listField', '$.numField', '$.stringField']); }), + test('JsonPath.listAt before Parallel', () => { + expect( + FieldUtils.findReferencedPaths({ + listAt: JsonPath.listAt('$[0].stringList'), + }), + ).toStrictEqual(['$[0].stringList']); + }); test('cannot have JsonPath fields in arrays', () => { expect(() => FieldUtils.renderObject({ deep: [JsonPath.stringAt('$.hello')], diff --git a/packages/@aws-cdk/aws-stepfunctions/test/integ.listAt-after-parallel.ts b/packages/@aws-cdk/aws-stepfunctions/test/integ.listAt-after-parallel.ts new file mode 100644 index 0000000000000..8c11f2805dd32 --- /dev/null +++ b/packages/@aws-cdk/aws-stepfunctions/test/integ.listAt-after-parallel.ts @@ -0,0 +1,38 @@ +import * as cdk from '@aws-cdk/core'; +import * as integ from '@aws-cdk/integ-tests'; +import * as sfn from '../lib'; + +const app = new cdk.App(); +const stack = new cdk.Stack(app, 'listAt-after-parallel'); + +const passStringList = new sfn.Pass(stack, 'PSL', { + parameters: { 'newStringList.$': '$.stringList' }, +}); +const passSingleString = new sfn.Pass(stack, 'PSS', { + parameters: { 'newSingleString.$': '$.singleString' }, +}); + +const parallel = new sfn.Parallel(stack, 'PRL', { + resultPath: '$', +}); +parallel.branch(passStringList).branch(passSingleString); + +const joinPass = new sfn.Pass(stack, 'JP', { + parameters: { + 'resultStringList.$': sfn.JsonPath.listAt('$[0].newStringList'), + 'newSingleString.$': '$[1].newSingleString', + }, +}); + +const chain = sfn.Chain.start(parallel).next(joinPass); + +new sfn.StateMachine(stack, 'StateMachine', { + definition: chain, + timeout: cdk.Duration.seconds(30), +}); + +new integ.IntegTest(app, 'ListAtAfterParallel', { + testCases: [stack], +}); + +app.synth(); \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions/test/listAt-after-parallel.integ.snapshot/ListAtAfterParallelDefaultTestDeployAssert1589F6AD.assets.json b/packages/@aws-cdk/aws-stepfunctions/test/listAt-after-parallel.integ.snapshot/ListAtAfterParallelDefaultTestDeployAssert1589F6AD.assets.json new file mode 100644 index 0000000000000..aaf63db40d5de --- /dev/null +++ b/packages/@aws-cdk/aws-stepfunctions/test/listAt-after-parallel.integ.snapshot/ListAtAfterParallelDefaultTestDeployAssert1589F6AD.assets.json @@ -0,0 +1,19 @@ +{ + "version": "21.0.0", + "files": { + "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { + "source": { + "path": "ListAtAfterParallelDefaultTestDeployAssert1589F6AD.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions/test/listAt-after-parallel.integ.snapshot/ListAtAfterParallelDefaultTestDeployAssert1589F6AD.template.json b/packages/@aws-cdk/aws-stepfunctions/test/listAt-after-parallel.integ.snapshot/ListAtAfterParallelDefaultTestDeployAssert1589F6AD.template.json new file mode 100644 index 0000000000000..ad9d0fb73d1dd --- /dev/null +++ b/packages/@aws-cdk/aws-stepfunctions/test/listAt-after-parallel.integ.snapshot/ListAtAfterParallelDefaultTestDeployAssert1589F6AD.template.json @@ -0,0 +1,36 @@ +{ + "Parameters": { + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" + } + }, + "Rules": { + "CheckBootstrapVersion": { + "Assertions": [ + { + "Assert": { + "Fn::Not": [ + { + "Fn::Contains": [ + [ + "1", + "2", + "3", + "4", + "5" + ], + { + "Ref": "BootstrapVersion" + } + ] + } + ] + }, + "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." + } + ] + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions/test/listAt-after-parallel.integ.snapshot/cdk.out b/packages/@aws-cdk/aws-stepfunctions/test/listAt-after-parallel.integ.snapshot/cdk.out new file mode 100644 index 0000000000000..8ecc185e9dbee --- /dev/null +++ b/packages/@aws-cdk/aws-stepfunctions/test/listAt-after-parallel.integ.snapshot/cdk.out @@ -0,0 +1 @@ +{"version":"21.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions/test/listAt-after-parallel.integ.snapshot/integ.json b/packages/@aws-cdk/aws-stepfunctions/test/listAt-after-parallel.integ.snapshot/integ.json new file mode 100644 index 0000000000000..07fc44ed5a9df --- /dev/null +++ b/packages/@aws-cdk/aws-stepfunctions/test/listAt-after-parallel.integ.snapshot/integ.json @@ -0,0 +1,12 @@ +{ + "version": "21.0.0", + "testCases": { + "ListAtAfterParallel/DefaultTest": { + "stacks": [ + "listAt-after-parallel" + ], + "assertionStack": "ListAtAfterParallel/DefaultTest/DeployAssert", + "assertionStackName": "ListAtAfterParallelDefaultTestDeployAssert1589F6AD" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions/test/listAt-after-parallel.integ.snapshot/listAt-after-parallel.assets.json b/packages/@aws-cdk/aws-stepfunctions/test/listAt-after-parallel.integ.snapshot/listAt-after-parallel.assets.json new file mode 100644 index 0000000000000..1d8dd325aa4f5 --- /dev/null +++ b/packages/@aws-cdk/aws-stepfunctions/test/listAt-after-parallel.integ.snapshot/listAt-after-parallel.assets.json @@ -0,0 +1,19 @@ +{ + "version": "21.0.0", + "files": { + "8592ad3f6e37d2850470ef96a1d28b5ebb1369d631d8817cdf7c22e0652ffbdd": { + "source": { + "path": "listAt-after-parallel.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "8592ad3f6e37d2850470ef96a1d28b5ebb1369d631d8817cdf7c22e0652ffbdd.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions/test/listAt-after-parallel.integ.snapshot/listAt-after-parallel.template.json b/packages/@aws-cdk/aws-stepfunctions/test/listAt-after-parallel.integ.snapshot/listAt-after-parallel.template.json new file mode 100644 index 0000000000000..1f87a9bf99d3b --- /dev/null +++ b/packages/@aws-cdk/aws-stepfunctions/test/listAt-after-parallel.integ.snapshot/listAt-after-parallel.template.json @@ -0,0 +1,172 @@ +{ + "Resources": { + "StateMachineRoleB840431D": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": { + "Fn::FindInMap": [ + "ServiceprincipalMap", + { + "Ref": "AWS::Region" + }, + "states" + ] + } + } + } + ], + "Version": "2012-10-17" + } + } + }, + "StateMachine2E01A3A5": { + "Type": "AWS::StepFunctions::StateMachine", + "Properties": { + "RoleArn": { + "Fn::GetAtt": [ + "StateMachineRoleB840431D", + "Arn" + ] + }, + "DefinitionString": "{\"StartAt\":\"PRL\",\"States\":{\"PRL\":{\"Type\":\"Parallel\",\"ResultPath\":\"$\",\"Next\":\"JP\",\"Branches\":[{\"StartAt\":\"PSL\",\"States\":{\"PSL\":{\"Type\":\"Pass\",\"Parameters\":{\"newStringList.$\":\"$.stringList\"},\"End\":true}}},{\"StartAt\":\"PSS\",\"States\":{\"PSS\":{\"Type\":\"Pass\",\"Parameters\":{\"newSingleString.$\":\"$.singleString\"},\"End\":true}}}]},\"JP\":{\"Type\":\"Pass\",\"Parameters\":{\"resultStringList.$.$\":\"$[0].newStringList\",\"newSingleString.$\":\"$[1].newSingleString\"},\"End\":true}},\"TimeoutSeconds\":30}" + }, + "DependsOn": [ + "StateMachineRoleB840431D" + ] + } + }, + "Mappings": { + "ServiceprincipalMap": { + "af-south-1": { + "states": "states.af-south-1.amazonaws.com" + }, + "ap-east-1": { + "states": "states.ap-east-1.amazonaws.com" + }, + "ap-northeast-1": { + "states": "states.ap-northeast-1.amazonaws.com" + }, + "ap-northeast-2": { + "states": "states.ap-northeast-2.amazonaws.com" + }, + "ap-northeast-3": { + "states": "states.ap-northeast-3.amazonaws.com" + }, + "ap-south-1": { + "states": "states.ap-south-1.amazonaws.com" + }, + "ap-southeast-1": { + "states": "states.ap-southeast-1.amazonaws.com" + }, + "ap-southeast-2": { + "states": "states.ap-southeast-2.amazonaws.com" + }, + "ap-southeast-3": { + "states": "states.ap-southeast-3.amazonaws.com" + }, + "ca-central-1": { + "states": "states.ca-central-1.amazonaws.com" + }, + "cn-north-1": { + "states": "states.cn-north-1.amazonaws.com" + }, + "cn-northwest-1": { + "states": "states.cn-northwest-1.amazonaws.com" + }, + "eu-central-1": { + "states": "states.eu-central-1.amazonaws.com" + }, + "eu-north-1": { + "states": "states.eu-north-1.amazonaws.com" + }, + "eu-south-1": { + "states": "states.eu-south-1.amazonaws.com" + }, + "eu-south-2": { + "states": "states.eu-south-2.amazonaws.com" + }, + "eu-west-1": { + "states": "states.eu-west-1.amazonaws.com" + }, + "eu-west-2": { + "states": "states.eu-west-2.amazonaws.com" + }, + "eu-west-3": { + "states": "states.eu-west-3.amazonaws.com" + }, + "me-south-1": { + "states": "states.me-south-1.amazonaws.com" + }, + "sa-east-1": { + "states": "states.sa-east-1.amazonaws.com" + }, + "us-east-1": { + "states": "states.us-east-1.amazonaws.com" + }, + "us-east-2": { + "states": "states.us-east-2.amazonaws.com" + }, + "us-gov-east-1": { + "states": "states.us-gov-east-1.amazonaws.com" + }, + "us-gov-west-1": { + "states": "states.us-gov-west-1.amazonaws.com" + }, + "us-iso-east-1": { + "states": "states.amazonaws.com" + }, + "us-iso-west-1": { + "states": "states.amazonaws.com" + }, + "us-isob-east-1": { + "states": "states.amazonaws.com" + }, + "us-west-1": { + "states": "states.us-west-1.amazonaws.com" + }, + "us-west-2": { + "states": "states.us-west-2.amazonaws.com" + } + } + }, + "Parameters": { + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" + } + }, + "Rules": { + "CheckBootstrapVersion": { + "Assertions": [ + { + "Assert": { + "Fn::Not": [ + { + "Fn::Contains": [ + [ + "1", + "2", + "3", + "4", + "5" + ], + { + "Ref": "BootstrapVersion" + } + ] + } + ] + }, + "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." + } + ] + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions/test/listAt-after-parallel.integ.snapshot/manifest.json b/packages/@aws-cdk/aws-stepfunctions/test/listAt-after-parallel.integ.snapshot/manifest.json new file mode 100644 index 0000000000000..c9a04242e0d95 --- /dev/null +++ b/packages/@aws-cdk/aws-stepfunctions/test/listAt-after-parallel.integ.snapshot/manifest.json @@ -0,0 +1,123 @@ +{ + "version": "21.0.0", + "artifacts": { + "Tree": { + "type": "cdk:tree", + "properties": { + "file": "tree.json" + } + }, + "listAt-after-parallel.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "listAt-after-parallel.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "listAt-after-parallel": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "listAt-after-parallel.template.json", + "validateOnSynth": false, + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/8592ad3f6e37d2850470ef96a1d28b5ebb1369d631d8817cdf7c22e0652ffbdd.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "listAt-after-parallel.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dependencies": [ + "listAt-after-parallel.assets" + ], + "metadata": { + "/listAt-after-parallel/StateMachine/Role/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "StateMachineRoleB840431D" + } + ], + "/listAt-after-parallel/StateMachine/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "StateMachine2E01A3A5" + } + ], + "/listAt-after-parallel/Service-principalMap": [ + { + "type": "aws:cdk:logicalId", + "data": "ServiceprincipalMap" + } + ], + "/listAt-after-parallel/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/listAt-after-parallel/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "listAt-after-parallel" + }, + "ListAtAfterParallelDefaultTestDeployAssert1589F6AD.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "ListAtAfterParallelDefaultTestDeployAssert1589F6AD.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "ListAtAfterParallelDefaultTestDeployAssert1589F6AD": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "ListAtAfterParallelDefaultTestDeployAssert1589F6AD.template.json", + "validateOnSynth": false, + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "ListAtAfterParallelDefaultTestDeployAssert1589F6AD.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dependencies": [ + "ListAtAfterParallelDefaultTestDeployAssert1589F6AD.assets" + ], + "metadata": { + "/ListAtAfterParallel/DefaultTest/DeployAssert/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/ListAtAfterParallel/DefaultTest/DeployAssert/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "ListAtAfterParallel/DefaultTest/DeployAssert" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-stepfunctions/test/listAt-after-parallel.integ.snapshot/tree.json b/packages/@aws-cdk/aws-stepfunctions/test/listAt-after-parallel.integ.snapshot/tree.json new file mode 100644 index 0000000000000..55f066de95e45 --- /dev/null +++ b/packages/@aws-cdk/aws-stepfunctions/test/listAt-after-parallel.integ.snapshot/tree.json @@ -0,0 +1,180 @@ +{ + "version": "tree-0.1", + "tree": { + "id": "App", + "path": "", + "children": { + "Tree": { + "id": "Tree", + "path": "Tree", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.123" + } + }, + "listAt-after-parallel": { + "id": "listAt-after-parallel", + "path": "listAt-after-parallel", + "children": { + "PSL": { + "id": "PSL", + "path": "listAt-after-parallel/PSL", + "constructInfo": { + "fqn": "@aws-cdk/aws-stepfunctions.Pass", + "version": "0.0.0" + } + }, + "PSS": { + "id": "PSS", + "path": "listAt-after-parallel/PSS", + "constructInfo": { + "fqn": "@aws-cdk/aws-stepfunctions.Pass", + "version": "0.0.0" + } + }, + "PRL": { + "id": "PRL", + "path": "listAt-after-parallel/PRL", + "constructInfo": { + "fqn": "@aws-cdk/aws-stepfunctions.Parallel", + "version": "0.0.0" + } + }, + "JP": { + "id": "JP", + "path": "listAt-after-parallel/JP", + "constructInfo": { + "fqn": "@aws-cdk/aws-stepfunctions.Pass", + "version": "0.0.0" + } + }, + "StateMachine": { + "id": "StateMachine", + "path": "listAt-after-parallel/StateMachine", + "children": { + "Role": { + "id": "Role", + "path": "listAt-after-parallel/StateMachine/Role", + "children": { + "Resource": { + "id": "Resource", + "path": "listAt-after-parallel/StateMachine/Role/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": { + "Fn::FindInMap": [ + "ServiceprincipalMap", + { + "Ref": "AWS::Region" + }, + "states" + ] + } + } + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-iam.CfnRole", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-iam.Role", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "listAt-after-parallel/StateMachine/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::StepFunctions::StateMachine", + "aws:cdk:cloudformation:props": { + "roleArn": { + "Fn::GetAtt": [ + "StateMachineRoleB840431D", + "Arn" + ] + }, + "definitionString": "{\"StartAt\":\"PRL\",\"States\":{\"PRL\":{\"Type\":\"Parallel\",\"ResultPath\":\"$\",\"Next\":\"JP\",\"Branches\":[{\"StartAt\":\"PSL\",\"States\":{\"PSL\":{\"Type\":\"Pass\",\"Parameters\":{\"newStringList.$\":\"$.stringList\"},\"End\":true}}},{\"StartAt\":\"PSS\",\"States\":{\"PSS\":{\"Type\":\"Pass\",\"Parameters\":{\"newSingleString.$\":\"$.singleString\"},\"End\":true}}}]},\"JP\":{\"Type\":\"Pass\",\"Parameters\":{\"resultStringList.$.$\":\"$[0].newStringList\",\"newSingleString.$\":\"$[1].newSingleString\"},\"End\":true}},\"TimeoutSeconds\":30}" + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-stepfunctions.CfnStateMachine", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-stepfunctions.StateMachine", + "version": "0.0.0" + } + }, + "Service-principalMap": { + "id": "Service-principalMap", + "path": "listAt-after-parallel/Service-principalMap", + "constructInfo": { + "fqn": "@aws-cdk/core.CfnMapping", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/core.Stack", + "version": "0.0.0" + } + }, + "ListAtAfterParallel": { + "id": "ListAtAfterParallel", + "path": "ListAtAfterParallel", + "children": { + "DefaultTest": { + "id": "DefaultTest", + "path": "ListAtAfterParallel/DefaultTest", + "children": { + "Default": { + "id": "Default", + "path": "ListAtAfterParallel/DefaultTest/Default", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.1.123" + } + }, + "DeployAssert": { + "id": "DeployAssert", + "path": "ListAtAfterParallel/DefaultTest/DeployAssert", + "constructInfo": { + "fqn": "@aws-cdk/core.Stack", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests.IntegTestCase", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests.IntegTest", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/core.App", + "version": "0.0.0" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk/integ-runner/lib/runner/runner-base.ts b/packages/@aws-cdk/integ-runner/lib/runner/runner-base.ts index 9ddaf2e7e4de4..dc99952509714 100644 --- a/packages/@aws-cdk/integ-runner/lib/runner/runner-base.ts +++ b/packages/@aws-cdk/integ-runner/lib/runner/runner-base.ts @@ -420,5 +420,6 @@ export const DEFAULT_SYNTH_OPTIONS = { CDK_INTEG_HOSTED_ZONE_ID: 'Z23ABC4XYZL05B', CDK_INTEG_HOSTED_ZONE_NAME: 'example.com', CDK_INTEG_DOMAIN_NAME: '*.example.com', + CDK_INTEG_CERT_ARN: 'arn:aws:acm:test-region:12345678:certificate/86468209-a272-595d-b831-0efb6421265z', }, }; diff --git a/packages/@aws-cdk/lambda-layer-awscli/test/awscli-layer.integ.snapshot/asset.3b263c2ad043fd069ef446753788c36e595c82b51a70478e58258c8ef7471671/cfn-response.js b/packages/@aws-cdk/lambda-layer-awscli/test/awscli-layer.integ.snapshot/asset.3b263c2ad043fd069ef446753788c36e595c82b51a70478e58258c8ef7471671/cfn-response.js deleted file mode 100644 index 6319e06391def..0000000000000 --- a/packages/@aws-cdk/lambda-layer-awscli/test/awscli-layer.integ.snapshot/asset.3b263c2ad043fd069ef446753788c36e595c82b51a70478e58258c8ef7471671/cfn-response.js +++ /dev/null @@ -1,83 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.Retry = exports.safeHandler = exports.includeStackTraces = exports.submitResponse = exports.MISSING_PHYSICAL_ID_MARKER = exports.CREATE_FAILED_PHYSICAL_ID_MARKER = void 0; -/* eslint-disable max-len */ -/* eslint-disable no-console */ -const url = require("url"); -const outbound_1 = require("./outbound"); -const util_1 = require("./util"); -exports.CREATE_FAILED_PHYSICAL_ID_MARKER = 'AWSCDK::CustomResourceProviderFramework::CREATE_FAILED'; -exports.MISSING_PHYSICAL_ID_MARKER = 'AWSCDK::CustomResourceProviderFramework::MISSING_PHYSICAL_ID'; -async function submitResponse(status, event, options = {}) { - const json = { - Status: status, - Reason: options.reason || status, - StackId: event.StackId, - RequestId: event.RequestId, - PhysicalResourceId: event.PhysicalResourceId || exports.MISSING_PHYSICAL_ID_MARKER, - LogicalResourceId: event.LogicalResourceId, - NoEcho: options.noEcho, - Data: event.Data, - }; - util_1.log('submit response to cloudformation', json); - const responseBody = JSON.stringify(json); - const parsedUrl = url.parse(event.ResponseURL); - await outbound_1.httpRequest({ - hostname: parsedUrl.hostname, - path: parsedUrl.path, - method: 'PUT', - headers: { - 'content-type': '', - 'content-length': responseBody.length, - }, - }, responseBody); -} -exports.submitResponse = submitResponse; -exports.includeStackTraces = true; // for unit tests -function safeHandler(block) { - return async (event) => { - // ignore DELETE event when the physical resource ID is the marker that - // indicates that this DELETE is a subsequent DELETE to a failed CREATE - // operation. - if (event.RequestType === 'Delete' && event.PhysicalResourceId === exports.CREATE_FAILED_PHYSICAL_ID_MARKER) { - util_1.log('ignoring DELETE event caused by a failed CREATE event'); - await submitResponse('SUCCESS', event); - return; - } - try { - await block(event); - } - catch (e) { - // tell waiter state machine to retry - if (e instanceof Retry) { - util_1.log('retry requested by handler'); - throw e; - } - if (!event.PhysicalResourceId) { - // special case: if CREATE fails, which usually implies, we usually don't - // have a physical resource id. in this case, the subsequent DELETE - // operation does not have any meaning, and will likely fail as well. to - // address this, we use a marker so the provider framework can simply - // ignore the subsequent DELETE. - if (event.RequestType === 'Create') { - util_1.log('CREATE failed, responding with a marker physical resource id so that the subsequent DELETE will be ignored'); - event.PhysicalResourceId = exports.CREATE_FAILED_PHYSICAL_ID_MARKER; - } - else { - // otherwise, if PhysicalResourceId is not specified, something is - // terribly wrong because all other events should have an ID. - util_1.log(`ERROR: Malformed event. "PhysicalResourceId" is required: ${JSON.stringify({ ...event, ResponseURL: '...' })}`); - } - } - // this is an actual error, fail the activity altogether and exist. - await submitResponse('FAILED', event, { - reason: exports.includeStackTraces ? e.stack : e.message, - }); - } - }; -} -exports.safeHandler = safeHandler; -class Retry extends Error { -} -exports.Retry = Retry; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2ZuLXJlc3BvbnNlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiY2ZuLXJlc3BvbnNlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFBLDRCQUE0QjtBQUM1QiwrQkFBK0I7QUFDL0IsMkJBQTJCO0FBQzNCLHlDQUF5QztBQUN6QyxpQ0FBNkI7QUFFaEIsUUFBQSxnQ0FBZ0MsR0FBRyx3REFBd0QsQ0FBQztBQUM1RixRQUFBLDBCQUEwQixHQUFHLDhEQUE4RCxDQUFDO0FBZ0JsRyxLQUFLLFVBQVUsY0FBYyxDQUFDLE1BQTRCLEVBQUUsS0FBaUMsRUFBRSxVQUF5QyxFQUFHO0lBQ2hKLE1BQU0sSUFBSSxHQUFtRDtRQUMzRCxNQUFNLEVBQUUsTUFBTTtRQUNkLE1BQU0sRUFBRSxPQUFPLENBQUMsTUFBTSxJQUFJLE1BQU07UUFDaEMsT0FBTyxFQUFFLEtBQUssQ0FBQyxPQUFPO1FBQ3RCLFNBQVMsRUFBRSxLQUFLLENBQUMsU0FBUztRQUMxQixrQkFBa0IsRUFBRSxLQUFLLENBQUMsa0JBQWtCLElBQUksa0NBQTBCO1FBQzFFLGlCQUFpQixFQUFFLEtBQUssQ0FBQyxpQkFBaUI7UUFDMUMsTUFBTSxFQUFFLE9BQU8sQ0FBQyxNQUFNO1FBQ3RCLElBQUksRUFBRSxLQUFLLENBQUMsSUFBSTtLQUNqQixDQUFDO0lBRUYsVUFBRyxDQUFDLG1DQUFtQyxFQUFFLElBQUksQ0FBQyxDQUFDO0lBRS9DLE1BQU0sWUFBWSxHQUFHLElBQUksQ0FBQyxTQUFTLENBQUMsSUFBSSxDQUFDLENBQUM7SUFFMUMsTUFBTSxTQUFTLEdBQUcsR0FBRyxDQUFDLEtBQUssQ0FBQyxLQUFLLENBQUMsV0FBVyxDQUFDLENBQUM7SUFDL0MsTUFBTSxzQkFBVyxDQUFDO1FBQ2hCLFFBQVEsRUFBRSxTQUFTLENBQUMsUUFBUTtRQUM1QixJQUFJLEVBQUUsU0FBUyxDQUFDLElBQUk7UUFDcEIsTUFBTSxFQUFFLEtBQUs7UUFDYixPQUFPLEVBQUU7WUFDUCxjQUFjLEVBQUUsRUFBRTtZQUNsQixnQkFBZ0IsRUFBRSxZQUFZLENBQUMsTUFBTTtTQUN0QztLQUNGLEVBQUUsWUFBWSxDQUFDLENBQUM7QUFDbkIsQ0FBQztBQTFCRCx3Q0EwQkM7QUFFVSxRQUFBLGtCQUFrQixHQUFHLElBQUksQ0FBQyxDQUFDLGlCQUFpQjtBQUV2RCxTQUFnQixXQUFXLENBQUMsS0FBb0M7SUFDOUQsT0FBTyxLQUFLLEVBQUUsS0FBVSxFQUFFLEVBQUU7UUFFMUIsdUVBQXVFO1FBQ3ZFLHVFQUF1RTtRQUN2RSxhQUFhO1FBQ2IsSUFBSSxLQUFLLENBQUMsV0FBVyxLQUFLLFFBQVEsSUFBSSxLQUFLLENBQUMsa0JBQWtCLEtBQUssd0NBQWdDLEVBQUU7WUFDbkcsVUFBRyxDQUFDLHVEQUF1RCxDQUFDLENBQUM7WUFDN0QsTUFBTSxjQUFjLENBQUMsU0FBUyxFQUFFLEtBQUssQ0FBQyxDQUFDO1lBQ3ZDLE9BQU87U0FDUjtRQUVELElBQUk7WUFDRixNQUFNLEtBQUssQ0FBQyxLQUFLLENBQUMsQ0FBQztTQUNwQjtRQUFDLE9BQU8sQ0FBQyxFQUFFO1lBQ1YscUNBQXFDO1lBQ3JDLElBQUksQ0FBQyxZQUFZLEtBQUssRUFBRTtnQkFDdEIsVUFBRyxDQUFDLDRCQUE0QixDQUFDLENBQUM7Z0JBQ2xDLE1BQU0sQ0FBQyxDQUFDO2FBQ1Q7WUFFRCxJQUFJLENBQUMsS0FBSyxDQUFDLGtCQUFrQixFQUFFO2dCQUM3Qix5RUFBeUU7Z0JBQ3pFLG1FQUFtRTtnQkFDbkUsd0VBQXdFO2dCQUN4RSxxRUFBcUU7Z0JBQ3JFLGdDQUFnQztnQkFDaEMsSUFBSSxLQUFLLENBQUMsV0FBVyxLQUFLLFFBQVEsRUFBRTtvQkFDbEMsVUFBRyxDQUFDLDRHQUE0RyxDQUFDLENBQUM7b0JBQ2xILEtBQUssQ0FBQyxrQkFBa0IsR0FBRyx3Q0FBZ0MsQ0FBQztpQkFDN0Q7cUJBQU07b0JBQ0wsa0VBQWtFO29CQUNsRSw2REFBNkQ7b0JBQzdELFVBQUcsQ0FBQyw2REFBNkQsSUFBSSxDQUFDLFNBQVMsQ0FBQyxFQUFFLEdBQUcsS0FBSyxFQUFFLFdBQVcsRUFBRSxLQUFLLEVBQUUsQ0FBQyxFQUFFLENBQUMsQ0FBQztpQkFDdEg7YUFDRjtZQUVELG1FQUFtRTtZQUNuRSxNQUFNLGNBQWMsQ0FBQyxRQUFRLEVBQUUsS0FBSyxFQUFFO2dCQUNwQyxNQUFNLEVBQUUsMEJBQWtCLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQyxLQUFLLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQyxPQUFPO2FBQ2pELENBQUMsQ0FBQztTQUNKO0lBQ0gsQ0FBQyxDQUFDO0FBQ0osQ0FBQztBQTNDRCxrQ0EyQ0M7QUFFRCxNQUFhLEtBQU0sU0FBUSxLQUFLO0NBQUk7QUFBcEMsc0JBQW9DIiwic291cmNlc0NvbnRlbnQiOlsiLyogZXNsaW50LWRpc2FibGUgbWF4LWxlbiAqL1xuLyogZXNsaW50LWRpc2FibGUgbm8tY29uc29sZSAqL1xuaW1wb3J0ICogYXMgdXJsIGZyb20gJ3VybCc7XG5pbXBvcnQgeyBodHRwUmVxdWVzdCB9IGZyb20gJy4vb3V0Ym91bmQnO1xuaW1wb3J0IHsgbG9nIH0gZnJvbSAnLi91dGlsJztcblxuZXhwb3J0IGNvbnN0IENSRUFURV9GQUlMRURfUEhZU0lDQUxfSURfTUFSS0VSID0gJ0FXU0NESzo6Q3VzdG9tUmVzb3VyY2VQcm92aWRlckZyYW1ld29yazo6Q1JFQVRFX0ZBSUxFRCc7XG5leHBvcnQgY29uc3QgTUlTU0lOR19QSFlTSUNBTF9JRF9NQVJLRVIgPSAnQVdTQ0RLOjpDdXN0b21SZXNvdXJjZVByb3ZpZGVyRnJhbWV3b3JrOjpNSVNTSU5HX1BIWVNJQ0FMX0lEJztcblxuZXhwb3J0IGludGVyZmFjZSBDbG91ZEZvcm1hdGlvblJlc3BvbnNlT3B0aW9ucyB7XG4gIHJlYWRvbmx5IHJlYXNvbj86IHN0cmluZztcbiAgcmVhZG9ubHkgbm9FY2hvPzogYm9vbGVhbjtcbn1cblxuZXhwb3J0IGludGVyZmFjZSBDbG91ZEZvcm1hdGlvbkV2ZW50Q29udGV4dCB7XG4gIFN0YWNrSWQ6IHN0cmluZztcbiAgUmVxdWVzdElkOiBzdHJpbmc7XG4gIFBoeXNpY2FsUmVzb3VyY2VJZD86IHN0cmluZztcbiAgTG9naWNhbFJlc291cmNlSWQ6IHN0cmluZztcbiAgUmVzcG9uc2VVUkw6IHN0cmluZztcbiAgRGF0YT86IGFueVxufVxuXG5leHBvcnQgYXN5bmMgZnVuY3Rpb24gc3VibWl0UmVzcG9uc2Uoc3RhdHVzOiAnU1VDQ0VTUycgfCAnRkFJTEVEJywgZXZlbnQ6IENsb3VkRm9ybWF0aW9uRXZlbnRDb250ZXh0LCBvcHRpb25zOiBDbG91ZEZvcm1hdGlvblJlc3BvbnNlT3B0aW9ucyA9IHsgfSkge1xuICBjb25zdCBqc29uOiBBV1NMYW1iZGEuQ2xvdWRGb3JtYXRpb25DdXN0b21SZXNvdXJjZVJlc3BvbnNlID0ge1xuICAgIFN0YXR1czogc3RhdHVzLFxuICAgIFJlYXNvbjogb3B0aW9ucy5yZWFzb24gfHwgc3RhdHVzLFxuICAgIFN0YWNrSWQ6IGV2ZW50LlN0YWNrSWQsXG4gICAgUmVxdWVzdElkOiBldmVudC5SZXF1ZXN0SWQsXG4gICAgUGh5c2ljYWxSZXNvdXJjZUlkOiBldmVudC5QaHlzaWNhbFJlc291cmNlSWQgfHwgTUlTU0lOR19QSFlTSUNBTF9JRF9NQVJLRVIsXG4gICAgTG9naWNhbFJlc291cmNlSWQ6IGV2ZW50LkxvZ2ljYWxSZXNvdXJjZUlkLFxuICAgIE5vRWNobzogb3B0aW9ucy5ub0VjaG8sXG4gICAgRGF0YTogZXZlbnQuRGF0YSxcbiAgfTtcblxuICBsb2coJ3N1Ym1pdCByZXNwb25zZSB0byBjbG91ZGZvcm1hdGlvbicsIGpzb24pO1xuXG4gIGNvbnN0IHJlc3BvbnNlQm9keSA9IEpTT04uc3RyaW5naWZ5KGpzb24pO1xuXG4gIGNvbnN0IHBhcnNlZFVybCA9IHVybC5wYXJzZShldmVudC5SZXNwb25zZVVSTCk7XG4gIGF3YWl0IGh0dHBSZXF1ZXN0KHtcbiAgICBob3N0bmFtZTogcGFyc2VkVXJsLmhvc3RuYW1lLFxuICAgIHBhdGg6IHBhcnNlZFVybC5wYXRoLFxuICAgIG1ldGhvZDogJ1BVVCcsXG4gICAgaGVhZGVyczoge1xuICAgICAgJ2NvbnRlbnQtdHlwZSc6ICcnLFxuICAgICAgJ2NvbnRlbnQtbGVuZ3RoJzogcmVzcG9uc2VCb2R5Lmxlbmd0aCxcbiAgICB9LFxuICB9LCByZXNwb25zZUJvZHkpO1xufVxuXG5leHBvcnQgbGV0IGluY2x1ZGVTdGFja1RyYWNlcyA9IHRydWU7IC8vIGZvciB1bml0IHRlc3RzXG5cbmV4cG9ydCBmdW5jdGlvbiBzYWZlSGFuZGxlcihibG9jazogKGV2ZW50OiBhbnkpID0+IFByb21pc2U8dm9pZD4pIHtcbiAgcmV0dXJuIGFzeW5jIChldmVudDogYW55KSA9PiB7XG5cbiAgICAvLyBpZ25vcmUgREVMRVRFIGV2ZW50IHdoZW4gdGhlIHBoeXNpY2FsIHJlc291cmNlIElEIGlzIHRoZSBtYXJrZXIgdGhhdFxuICAgIC8vIGluZGljYXRlcyB0aGF0IHRoaXMgREVMRVRFIGlzIGEgc3Vic2VxdWVudCBERUxFVEUgdG8gYSBmYWlsZWQgQ1JFQVRFXG4gICAgLy8gb3BlcmF0aW9uLlxuICAgIGlmIChldmVudC5SZXF1ZXN0VHlwZSA9PT0gJ0RlbGV0ZScgJiYgZXZlbnQuUGh5c2ljYWxSZXNvdXJjZUlkID09PSBDUkVBVEVfRkFJTEVEX1BIWVNJQ0FMX0lEX01BUktFUikge1xuICAgICAgbG9nKCdpZ25vcmluZyBERUxFVEUgZXZlbnQgY2F1c2VkIGJ5IGEgZmFpbGVkIENSRUFURSBldmVudCcpO1xuICAgICAgYXdhaXQgc3VibWl0UmVzcG9uc2UoJ1NVQ0NFU1MnLCBldmVudCk7XG4gICAgICByZXR1cm47XG4gICAgfVxuXG4gICAgdHJ5IHtcbiAgICAgIGF3YWl0IGJsb2NrKGV2ZW50KTtcbiAgICB9IGNhdGNoIChlKSB7XG4gICAgICAvLyB0ZWxsIHdhaXRlciBzdGF0ZSBtYWNoaW5lIHRvIHJldHJ5XG4gICAgICBpZiAoZSBpbnN0YW5jZW9mIFJldHJ5KSB7XG4gICAgICAgIGxvZygncmV0cnkgcmVxdWVzdGVkIGJ5IGhhbmRsZXInKTtcbiAgICAgICAgdGhyb3cgZTtcbiAgICAgIH1cblxuICAgICAgaWYgKCFldmVudC5QaHlzaWNhbFJlc291cmNlSWQpIHtcbiAgICAgICAgLy8gc3BlY2lhbCBjYXNlOiBpZiBDUkVBVEUgZmFpbHMsIHdoaWNoIHVzdWFsbHkgaW1wbGllcywgd2UgdXN1YWxseSBkb24ndFxuICAgICAgICAvLyBoYXZlIGEgcGh5c2ljYWwgcmVzb3VyY2UgaWQuIGluIHRoaXMgY2FzZSwgdGhlIHN1YnNlcXVlbnQgREVMRVRFXG4gICAgICAgIC8vIG9wZXJhdGlvbiBkb2VzIG5vdCBoYXZlIGFueSBtZWFuaW5nLCBhbmQgd2lsbCBsaWtlbHkgZmFpbCBhcyB3ZWxsLiB0b1xuICAgICAgICAvLyBhZGRyZXNzIHRoaXMsIHdlIHVzZSBhIG1hcmtlciBzbyB0aGUgcHJvdmlkZXIgZnJhbWV3b3JrIGNhbiBzaW1wbHlcbiAgICAgICAgLy8gaWdub3JlIHRoZSBzdWJzZXF1ZW50IERFTEVURS5cbiAgICAgICAgaWYgKGV2ZW50LlJlcXVlc3RUeXBlID09PSAnQ3JlYXRlJykge1xuICAgICAgICAgIGxvZygnQ1JFQVRFIGZhaWxlZCwgcmVzcG9uZGluZyB3aXRoIGEgbWFya2VyIHBoeXNpY2FsIHJlc291cmNlIGlkIHNvIHRoYXQgdGhlIHN1YnNlcXVlbnQgREVMRVRFIHdpbGwgYmUgaWdub3JlZCcpO1xuICAgICAgICAgIGV2ZW50LlBoeXNpY2FsUmVzb3VyY2VJZCA9IENSRUFURV9GQUlMRURfUEhZU0lDQUxfSURfTUFSS0VSO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgIC8vIG90aGVyd2lzZSwgaWYgUGh5c2ljYWxSZXNvdXJjZUlkIGlzIG5vdCBzcGVjaWZpZWQsIHNvbWV0aGluZyBpc1xuICAgICAgICAgIC8vIHRlcnJpYmx5IHdyb25nIGJlY2F1c2UgYWxsIG90aGVyIGV2ZW50cyBzaG91bGQgaGF2ZSBhbiBJRC5cbiAgICAgICAgICBsb2coYEVSUk9SOiBNYWxmb3JtZWQgZXZlbnQuIFwiUGh5c2ljYWxSZXNvdXJjZUlkXCIgaXMgcmVxdWlyZWQ6ICR7SlNPTi5zdHJpbmdpZnkoeyAuLi5ldmVudCwgUmVzcG9uc2VVUkw6ICcuLi4nIH0pfWApO1xuICAgICAgICB9XG4gICAgICB9XG5cbiAgICAgIC8vIHRoaXMgaXMgYW4gYWN0dWFsIGVycm9yLCBmYWlsIHRoZSBhY3Rpdml0eSBhbHRvZ2V0aGVyIGFuZCBleGlzdC5cbiAgICAgIGF3YWl0IHN1Ym1pdFJlc3BvbnNlKCdGQUlMRUQnLCBldmVudCwge1xuICAgICAgICByZWFzb246IGluY2x1ZGVTdGFja1RyYWNlcyA/IGUuc3RhY2sgOiBlLm1lc3NhZ2UsXG4gICAgICB9KTtcbiAgICB9XG4gIH07XG59XG5cbmV4cG9ydCBjbGFzcyBSZXRyeSBleHRlbmRzIEVycm9yIHsgfVxuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/lambda-layer-awscli/test/awscli-layer.integ.snapshot/asset.3b263c2ad043fd069ef446753788c36e595c82b51a70478e58258c8ef7471671/util.js b/packages/@aws-cdk/lambda-layer-awscli/test/awscli-layer.integ.snapshot/asset.3b263c2ad043fd069ef446753788c36e595c82b51a70478e58258c8ef7471671/util.js deleted file mode 100644 index ee4c6e9c9ddeb..0000000000000 --- a/packages/@aws-cdk/lambda-layer-awscli/test/awscli-layer.integ.snapshot/asset.3b263c2ad043fd069ef446753788c36e595c82b51a70478e58258c8ef7471671/util.js +++ /dev/null @@ -1,17 +0,0 @@ -"use strict"; -/* eslint-disable no-console */ -Object.defineProperty(exports, "__esModule", { value: true }); -exports.log = exports.getEnv = void 0; -function getEnv(name) { - const value = process.env[name]; - if (!value) { - throw new Error(`The environment variable "${name}" is not defined`); - } - return value; -} -exports.getEnv = getEnv; -function log(title, ...args) { - console.log('[provider-framework]', title, ...args.map(x => typeof (x) === 'object' ? JSON.stringify(x, undefined, 2) : x)); -} -exports.log = log; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXRpbC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbInV0aWwudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLCtCQUErQjs7O0FBRS9CLFNBQWdCLE1BQU0sQ0FBQyxJQUFZO0lBQ2pDLE1BQU0sS0FBSyxHQUFHLE9BQU8sQ0FBQyxHQUFHLENBQUMsSUFBSSxDQUFDLENBQUM7SUFDaEMsSUFBSSxDQUFDLEtBQUssRUFBRTtRQUNWLE1BQU0sSUFBSSxLQUFLLENBQUMsNkJBQTZCLElBQUksa0JBQWtCLENBQUMsQ0FBQztLQUN0RTtJQUNELE9BQU8sS0FBSyxDQUFDO0FBQ2YsQ0FBQztBQU5ELHdCQU1DO0FBRUQsU0FBZ0IsR0FBRyxDQUFDLEtBQVUsRUFBRSxHQUFHLElBQVc7SUFDNUMsT0FBTyxDQUFDLEdBQUcsQ0FBQyxzQkFBc0IsRUFBRSxLQUFLLEVBQUUsR0FBRyxJQUFJLENBQUMsR0FBRyxDQUFDLENBQUMsQ0FBQyxFQUFFLENBQUMsT0FBTSxDQUFDLENBQUMsQ0FBQyxLQUFLLFFBQVEsQ0FBQyxDQUFDLENBQUMsSUFBSSxDQUFDLFNBQVMsQ0FBQyxDQUFDLEVBQUUsU0FBUyxFQUFFLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDO0FBQzdILENBQUM7QUFGRCxrQkFFQyIsInNvdXJjZXNDb250ZW50IjpbIi8qIGVzbGludC1kaXNhYmxlIG5vLWNvbnNvbGUgKi9cblxuZXhwb3J0IGZ1bmN0aW9uIGdldEVudihuYW1lOiBzdHJpbmcpOiBzdHJpbmcge1xuICBjb25zdCB2YWx1ZSA9IHByb2Nlc3MuZW52W25hbWVdO1xuICBpZiAoIXZhbHVlKSB7XG4gICAgdGhyb3cgbmV3IEVycm9yKGBUaGUgZW52aXJvbm1lbnQgdmFyaWFibGUgXCIke25hbWV9XCIgaXMgbm90IGRlZmluZWRgKTtcbiAgfVxuICByZXR1cm4gdmFsdWU7XG59XG5cbmV4cG9ydCBmdW5jdGlvbiBsb2codGl0bGU6IGFueSwgLi4uYXJnczogYW55W10pIHtcbiAgY29uc29sZS5sb2coJ1twcm92aWRlci1mcmFtZXdvcmtdJywgdGl0bGUsIC4uLmFyZ3MubWFwKHggPT4gdHlwZW9mKHgpID09PSAnb2JqZWN0JyA/IEpTT04uc3RyaW5naWZ5KHgsIHVuZGVmaW5lZCwgMikgOiB4KSk7XG59XG4iXX0= \ No newline at end of file diff --git a/packages/@aws-cdk/lambda-layer-awscli/test/awscli-layer.integ.snapshot/asset.7215c88dd3e638d28329d4538b36cdbfb54233a4d972181795814f8b904d1037/cfn-response.js b/packages/@aws-cdk/lambda-layer-awscli/test/awscli-layer.integ.snapshot/asset.7215c88dd3e638d28329d4538b36cdbfb54233a4d972181795814f8b904d1037/cfn-response.js new file mode 100644 index 0000000000000..1966567b21646 --- /dev/null +++ b/packages/@aws-cdk/lambda-layer-awscli/test/awscli-layer.integ.snapshot/asset.7215c88dd3e638d28329d4538b36cdbfb54233a4d972181795814f8b904d1037/cfn-response.js @@ -0,0 +1,87 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Retry = exports.safeHandler = exports.includeStackTraces = exports.submitResponse = exports.MISSING_PHYSICAL_ID_MARKER = exports.CREATE_FAILED_PHYSICAL_ID_MARKER = void 0; +/* eslint-disable max-len */ +/* eslint-disable no-console */ +const url = require("url"); +const outbound_1 = require("./outbound"); +const util_1 = require("./util"); +exports.CREATE_FAILED_PHYSICAL_ID_MARKER = 'AWSCDK::CustomResourceProviderFramework::CREATE_FAILED'; +exports.MISSING_PHYSICAL_ID_MARKER = 'AWSCDK::CustomResourceProviderFramework::MISSING_PHYSICAL_ID'; +async function submitResponse(status, event, options = {}) { + const json = { + Status: status, + Reason: options.reason || status, + StackId: event.StackId, + RequestId: event.RequestId, + PhysicalResourceId: event.PhysicalResourceId || exports.MISSING_PHYSICAL_ID_MARKER, + LogicalResourceId: event.LogicalResourceId, + NoEcho: options.noEcho, + Data: event.Data, + }; + util_1.log('submit response to cloudformation', json); + const responseBody = JSON.stringify(json); + const parsedUrl = url.parse(event.ResponseURL); + const retryOptions = { + attempts: 5, + sleep: 1000, + }; + await util_1.withRetries(retryOptions, outbound_1.httpRequest)({ + hostname: parsedUrl.hostname, + path: parsedUrl.path, + method: 'PUT', + headers: { + 'content-type': '', + 'content-length': responseBody.length, + }, + }, responseBody); +} +exports.submitResponse = submitResponse; +exports.includeStackTraces = true; // for unit tests +function safeHandler(block) { + return async (event) => { + // ignore DELETE event when the physical resource ID is the marker that + // indicates that this DELETE is a subsequent DELETE to a failed CREATE + // operation. + if (event.RequestType === 'Delete' && event.PhysicalResourceId === exports.CREATE_FAILED_PHYSICAL_ID_MARKER) { + util_1.log('ignoring DELETE event caused by a failed CREATE event'); + await submitResponse('SUCCESS', event); + return; + } + try { + await block(event); + } + catch (e) { + // tell waiter state machine to retry + if (e instanceof Retry) { + util_1.log('retry requested by handler'); + throw e; + } + if (!event.PhysicalResourceId) { + // special case: if CREATE fails, which usually implies, we usually don't + // have a physical resource id. in this case, the subsequent DELETE + // operation does not have any meaning, and will likely fail as well. to + // address this, we use a marker so the provider framework can simply + // ignore the subsequent DELETE. + if (event.RequestType === 'Create') { + util_1.log('CREATE failed, responding with a marker physical resource id so that the subsequent DELETE will be ignored'); + event.PhysicalResourceId = exports.CREATE_FAILED_PHYSICAL_ID_MARKER; + } + else { + // otherwise, if PhysicalResourceId is not specified, something is + // terribly wrong because all other events should have an ID. + util_1.log(`ERROR: Malformed event. "PhysicalResourceId" is required: ${JSON.stringify({ ...event, ResponseURL: '...' })}`); + } + } + // this is an actual error, fail the activity altogether and exist. + await submitResponse('FAILED', event, { + reason: exports.includeStackTraces ? e.stack : e.message, + }); + } + }; +} +exports.safeHandler = safeHandler; +class Retry extends Error { +} +exports.Retry = Retry; +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2ZuLXJlc3BvbnNlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiY2ZuLXJlc3BvbnNlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFBLDRCQUE0QjtBQUM1QiwrQkFBK0I7QUFDL0IsMkJBQTJCO0FBQzNCLHlDQUF5QztBQUN6QyxpQ0FBMEM7QUFFN0IsUUFBQSxnQ0FBZ0MsR0FBRyx3REFBd0QsQ0FBQztBQUM1RixRQUFBLDBCQUEwQixHQUFHLDhEQUE4RCxDQUFDO0FBZ0JsRyxLQUFLLFVBQVUsY0FBYyxDQUFDLE1BQTRCLEVBQUUsS0FBaUMsRUFBRSxVQUF5QyxFQUFHO0lBQ2hKLE1BQU0sSUFBSSxHQUFtRDtRQUMzRCxNQUFNLEVBQUUsTUFBTTtRQUNkLE1BQU0sRUFBRSxPQUFPLENBQUMsTUFBTSxJQUFJLE1BQU07UUFDaEMsT0FBTyxFQUFFLEtBQUssQ0FBQyxPQUFPO1FBQ3RCLFNBQVMsRUFBRSxLQUFLLENBQUMsU0FBUztRQUMxQixrQkFBa0IsRUFBRSxLQUFLLENBQUMsa0JBQWtCLElBQUksa0NBQTBCO1FBQzFFLGlCQUFpQixFQUFFLEtBQUssQ0FBQyxpQkFBaUI7UUFDMUMsTUFBTSxFQUFFLE9BQU8sQ0FBQyxNQUFNO1FBQ3RCLElBQUksRUFBRSxLQUFLLENBQUMsSUFBSTtLQUNqQixDQUFDO0lBRUYsVUFBRyxDQUFDLG1DQUFtQyxFQUFFLElBQUksQ0FBQyxDQUFDO0lBRS9DLE1BQU0sWUFBWSxHQUFHLElBQUksQ0FBQyxTQUFTLENBQUMsSUFBSSxDQUFDLENBQUM7SUFFMUMsTUFBTSxTQUFTLEdBQUcsR0FBRyxDQUFDLEtBQUssQ0FBQyxLQUFLLENBQUMsV0FBVyxDQUFDLENBQUM7SUFFL0MsTUFBTSxZQUFZLEdBQUc7UUFDbkIsUUFBUSxFQUFFLENBQUM7UUFDWCxLQUFLLEVBQUUsSUFBSTtLQUNaLENBQUM7SUFDRixNQUFNLGtCQUFXLENBQUMsWUFBWSxFQUFFLHNCQUFXLENBQUMsQ0FBQztRQUMzQyxRQUFRLEVBQUUsU0FBUyxDQUFDLFFBQVE7UUFDNUIsSUFBSSxFQUFFLFNBQVMsQ0FBQyxJQUFJO1FBQ3BCLE1BQU0sRUFBRSxLQUFLO1FBQ2IsT0FBTyxFQUFFO1lBQ1AsY0FBYyxFQUFFLEVBQUU7WUFDbEIsZ0JBQWdCLEVBQUUsWUFBWSxDQUFDLE1BQU07U0FDdEM7S0FDRixFQUFFLFlBQVksQ0FBQyxDQUFDO0FBQ25CLENBQUM7QUEvQkQsd0NBK0JDO0FBRVUsUUFBQSxrQkFBa0IsR0FBRyxJQUFJLENBQUMsQ0FBQyxpQkFBaUI7QUFFdkQsU0FBZ0IsV0FBVyxDQUFDLEtBQW9DO0lBQzlELE9BQU8sS0FBSyxFQUFFLEtBQVUsRUFBRSxFQUFFO1FBRTFCLHVFQUF1RTtRQUN2RSx1RUFBdUU7UUFDdkUsYUFBYTtRQUNiLElBQUksS0FBSyxDQUFDLFdBQVcsS0FBSyxRQUFRLElBQUksS0FBSyxDQUFDLGtCQUFrQixLQUFLLHdDQUFnQyxFQUFFO1lBQ25HLFVBQUcsQ0FBQyx1REFBdUQsQ0FBQyxDQUFDO1lBQzdELE1BQU0sY0FBYyxDQUFDLFNBQVMsRUFBRSxLQUFLLENBQUMsQ0FBQztZQUN2QyxPQUFPO1NBQ1I7UUFFRCxJQUFJO1lBQ0YsTUFBTSxLQUFLLENBQUMsS0FBSyxDQUFDLENBQUM7U0FDcEI7UUFBQyxPQUFPLENBQUMsRUFBRTtZQUNWLHFDQUFxQztZQUNyQyxJQUFJLENBQUMsWUFBWSxLQUFLLEVBQUU7Z0JBQ3RCLFVBQUcsQ0FBQyw0QkFBNEIsQ0FBQyxDQUFDO2dCQUNsQyxNQUFNLENBQUMsQ0FBQzthQUNUO1lBRUQsSUFBSSxDQUFDLEtBQUssQ0FBQyxrQkFBa0IsRUFBRTtnQkFDN0IseUVBQXlFO2dCQUN6RSxtRUFBbUU7Z0JBQ25FLHdFQUF3RTtnQkFDeEUscUVBQXFFO2dCQUNyRSxnQ0FBZ0M7Z0JBQ2hDLElBQUksS0FBSyxDQUFDLFdBQVcsS0FBSyxRQUFRLEVBQUU7b0JBQ2xDLFVBQUcsQ0FBQyw0R0FBNEcsQ0FBQyxDQUFDO29CQUNsSCxLQUFLLENBQUMsa0JBQWtCLEdBQUcsd0NBQWdDLENBQUM7aUJBQzdEO3FCQUFNO29CQUNMLGtFQUFrRTtvQkFDbEUsNkRBQTZEO29CQUM3RCxVQUFHLENBQUMsNkRBQTZELElBQUksQ0FBQyxTQUFTLENBQUMsRUFBRSxHQUFHLEtBQUssRUFBRSxXQUFXLEVBQUUsS0FBSyxFQUFFLENBQUMsRUFBRSxDQUFDLENBQUM7aUJBQ3RIO2FBQ0Y7WUFFRCxtRUFBbUU7WUFDbkUsTUFBTSxjQUFjLENBQUMsUUFBUSxFQUFFLEtBQUssRUFBRTtnQkFDcEMsTUFBTSxFQUFFLDBCQUFrQixDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUMsS0FBSyxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUMsT0FBTzthQUNqRCxDQUFDLENBQUM7U0FDSjtJQUNILENBQUMsQ0FBQztBQUNKLENBQUM7QUEzQ0Qsa0NBMkNDO0FBRUQsTUFBYSxLQUFNLFNBQVEsS0FBSztDQUFJO0FBQXBDLHNCQUFvQyIsInNvdXJjZXNDb250ZW50IjpbIi8qIGVzbGludC1kaXNhYmxlIG1heC1sZW4gKi9cbi8qIGVzbGludC1kaXNhYmxlIG5vLWNvbnNvbGUgKi9cbmltcG9ydCAqIGFzIHVybCBmcm9tICd1cmwnO1xuaW1wb3J0IHsgaHR0cFJlcXVlc3QgfSBmcm9tICcuL291dGJvdW5kJztcbmltcG9ydCB7IGxvZywgd2l0aFJldHJpZXMgfSBmcm9tICcuL3V0aWwnO1xuXG5leHBvcnQgY29uc3QgQ1JFQVRFX0ZBSUxFRF9QSFlTSUNBTF9JRF9NQVJLRVIgPSAnQVdTQ0RLOjpDdXN0b21SZXNvdXJjZVByb3ZpZGVyRnJhbWV3b3JrOjpDUkVBVEVfRkFJTEVEJztcbmV4cG9ydCBjb25zdCBNSVNTSU5HX1BIWVNJQ0FMX0lEX01BUktFUiA9ICdBV1NDREs6OkN1c3RvbVJlc291cmNlUHJvdmlkZXJGcmFtZXdvcms6Ok1JU1NJTkdfUEhZU0lDQUxfSUQnO1xuXG5leHBvcnQgaW50ZXJmYWNlIENsb3VkRm9ybWF0aW9uUmVzcG9uc2VPcHRpb25zIHtcbiAgcmVhZG9ubHkgcmVhc29uPzogc3RyaW5nO1xuICByZWFkb25seSBub0VjaG8/OiBib29sZWFuO1xufVxuXG5leHBvcnQgaW50ZXJmYWNlIENsb3VkRm9ybWF0aW9uRXZlbnRDb250ZXh0IHtcbiAgU3RhY2tJZDogc3RyaW5nO1xuICBSZXF1ZXN0SWQ6IHN0cmluZztcbiAgUGh5c2ljYWxSZXNvdXJjZUlkPzogc3RyaW5nO1xuICBMb2dpY2FsUmVzb3VyY2VJZDogc3RyaW5nO1xuICBSZXNwb25zZVVSTDogc3RyaW5nO1xuICBEYXRhPzogYW55XG59XG5cbmV4cG9ydCBhc3luYyBmdW5jdGlvbiBzdWJtaXRSZXNwb25zZShzdGF0dXM6ICdTVUNDRVNTJyB8ICdGQUlMRUQnLCBldmVudDogQ2xvdWRGb3JtYXRpb25FdmVudENvbnRleHQsIG9wdGlvbnM6IENsb3VkRm9ybWF0aW9uUmVzcG9uc2VPcHRpb25zID0geyB9KSB7XG4gIGNvbnN0IGpzb246IEFXU0xhbWJkYS5DbG91ZEZvcm1hdGlvbkN1c3RvbVJlc291cmNlUmVzcG9uc2UgPSB7XG4gICAgU3RhdHVzOiBzdGF0dXMsXG4gICAgUmVhc29uOiBvcHRpb25zLnJlYXNvbiB8fCBzdGF0dXMsXG4gICAgU3RhY2tJZDogZXZlbnQuU3RhY2tJZCxcbiAgICBSZXF1ZXN0SWQ6IGV2ZW50LlJlcXVlc3RJZCxcbiAgICBQaHlzaWNhbFJlc291cmNlSWQ6IGV2ZW50LlBoeXNpY2FsUmVzb3VyY2VJZCB8fCBNSVNTSU5HX1BIWVNJQ0FMX0lEX01BUktFUixcbiAgICBMb2dpY2FsUmVzb3VyY2VJZDogZXZlbnQuTG9naWNhbFJlc291cmNlSWQsXG4gICAgTm9FY2hvOiBvcHRpb25zLm5vRWNobyxcbiAgICBEYXRhOiBldmVudC5EYXRhLFxuICB9O1xuXG4gIGxvZygnc3VibWl0IHJlc3BvbnNlIHRvIGNsb3VkZm9ybWF0aW9uJywganNvbik7XG5cbiAgY29uc3QgcmVzcG9uc2VCb2R5ID0gSlNPTi5zdHJpbmdpZnkoanNvbik7XG5cbiAgY29uc3QgcGFyc2VkVXJsID0gdXJsLnBhcnNlKGV2ZW50LlJlc3BvbnNlVVJMKTtcblxuICBjb25zdCByZXRyeU9wdGlvbnMgPSB7XG4gICAgYXR0ZW1wdHM6IDUsXG4gICAgc2xlZXA6IDEwMDAsXG4gIH07XG4gIGF3YWl0IHdpdGhSZXRyaWVzKHJldHJ5T3B0aW9ucywgaHR0cFJlcXVlc3QpKHtcbiAgICBob3N0bmFtZTogcGFyc2VkVXJsLmhvc3RuYW1lLFxuICAgIHBhdGg6IHBhcnNlZFVybC5wYXRoLFxuICAgIG1ldGhvZDogJ1BVVCcsXG4gICAgaGVhZGVyczoge1xuICAgICAgJ2NvbnRlbnQtdHlwZSc6ICcnLFxuICAgICAgJ2NvbnRlbnQtbGVuZ3RoJzogcmVzcG9uc2VCb2R5Lmxlbmd0aCxcbiAgICB9LFxuICB9LCByZXNwb25zZUJvZHkpO1xufVxuXG5leHBvcnQgbGV0IGluY2x1ZGVTdGFja1RyYWNlcyA9IHRydWU7IC8vIGZvciB1bml0IHRlc3RzXG5cbmV4cG9ydCBmdW5jdGlvbiBzYWZlSGFuZGxlcihibG9jazogKGV2ZW50OiBhbnkpID0+IFByb21pc2U8dm9pZD4pIHtcbiAgcmV0dXJuIGFzeW5jIChldmVudDogYW55KSA9PiB7XG5cbiAgICAvLyBpZ25vcmUgREVMRVRFIGV2ZW50IHdoZW4gdGhlIHBoeXNpY2FsIHJlc291cmNlIElEIGlzIHRoZSBtYXJrZXIgdGhhdFxuICAgIC8vIGluZGljYXRlcyB0aGF0IHRoaXMgREVMRVRFIGlzIGEgc3Vic2VxdWVudCBERUxFVEUgdG8gYSBmYWlsZWQgQ1JFQVRFXG4gICAgLy8gb3BlcmF0aW9uLlxuICAgIGlmIChldmVudC5SZXF1ZXN0VHlwZSA9PT0gJ0RlbGV0ZScgJiYgZXZlbnQuUGh5c2ljYWxSZXNvdXJjZUlkID09PSBDUkVBVEVfRkFJTEVEX1BIWVNJQ0FMX0lEX01BUktFUikge1xuICAgICAgbG9nKCdpZ25vcmluZyBERUxFVEUgZXZlbnQgY2F1c2VkIGJ5IGEgZmFpbGVkIENSRUFURSBldmVudCcpO1xuICAgICAgYXdhaXQgc3VibWl0UmVzcG9uc2UoJ1NVQ0NFU1MnLCBldmVudCk7XG4gICAgICByZXR1cm47XG4gICAgfVxuXG4gICAgdHJ5IHtcbiAgICAgIGF3YWl0IGJsb2NrKGV2ZW50KTtcbiAgICB9IGNhdGNoIChlKSB7XG4gICAgICAvLyB0ZWxsIHdhaXRlciBzdGF0ZSBtYWNoaW5lIHRvIHJldHJ5XG4gICAgICBpZiAoZSBpbnN0YW5jZW9mIFJldHJ5KSB7XG4gICAgICAgIGxvZygncmV0cnkgcmVxdWVzdGVkIGJ5IGhhbmRsZXInKTtcbiAgICAgICAgdGhyb3cgZTtcbiAgICAgIH1cblxuICAgICAgaWYgKCFldmVudC5QaHlzaWNhbFJlc291cmNlSWQpIHtcbiAgICAgICAgLy8gc3BlY2lhbCBjYXNlOiBpZiBDUkVBVEUgZmFpbHMsIHdoaWNoIHVzdWFsbHkgaW1wbGllcywgd2UgdXN1YWxseSBkb24ndFxuICAgICAgICAvLyBoYXZlIGEgcGh5c2ljYWwgcmVzb3VyY2UgaWQuIGluIHRoaXMgY2FzZSwgdGhlIHN1YnNlcXVlbnQgREVMRVRFXG4gICAgICAgIC8vIG9wZXJhdGlvbiBkb2VzIG5vdCBoYXZlIGFueSBtZWFuaW5nLCBhbmQgd2lsbCBsaWtlbHkgZmFpbCBhcyB3ZWxsLiB0b1xuICAgICAgICAvLyBhZGRyZXNzIHRoaXMsIHdlIHVzZSBhIG1hcmtlciBzbyB0aGUgcHJvdmlkZXIgZnJhbWV3b3JrIGNhbiBzaW1wbHlcbiAgICAgICAgLy8gaWdub3JlIHRoZSBzdWJzZXF1ZW50IERFTEVURS5cbiAgICAgICAgaWYgKGV2ZW50LlJlcXVlc3RUeXBlID09PSAnQ3JlYXRlJykge1xuICAgICAgICAgIGxvZygnQ1JFQVRFIGZhaWxlZCwgcmVzcG9uZGluZyB3aXRoIGEgbWFya2VyIHBoeXNpY2FsIHJlc291cmNlIGlkIHNvIHRoYXQgdGhlIHN1YnNlcXVlbnQgREVMRVRFIHdpbGwgYmUgaWdub3JlZCcpO1xuICAgICAgICAgIGV2ZW50LlBoeXNpY2FsUmVzb3VyY2VJZCA9IENSRUFURV9GQUlMRURfUEhZU0lDQUxfSURfTUFSS0VSO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgIC8vIG90aGVyd2lzZSwgaWYgUGh5c2ljYWxSZXNvdXJjZUlkIGlzIG5vdCBzcGVjaWZpZWQsIHNvbWV0aGluZyBpc1xuICAgICAgICAgIC8vIHRlcnJpYmx5IHdyb25nIGJlY2F1c2UgYWxsIG90aGVyIGV2ZW50cyBzaG91bGQgaGF2ZSBhbiBJRC5cbiAgICAgICAgICBsb2coYEVSUk9SOiBNYWxmb3JtZWQgZXZlbnQuIFwiUGh5c2ljYWxSZXNvdXJjZUlkXCIgaXMgcmVxdWlyZWQ6ICR7SlNPTi5zdHJpbmdpZnkoeyAuLi5ldmVudCwgUmVzcG9uc2VVUkw6ICcuLi4nIH0pfWApO1xuICAgICAgICB9XG4gICAgICB9XG5cbiAgICAgIC8vIHRoaXMgaXMgYW4gYWN0dWFsIGVycm9yLCBmYWlsIHRoZSBhY3Rpdml0eSBhbHRvZ2V0aGVyIGFuZCBleGlzdC5cbiAgICAgIGF3YWl0IHN1Ym1pdFJlc3BvbnNlKCdGQUlMRUQnLCBldmVudCwge1xuICAgICAgICByZWFzb246IGluY2x1ZGVTdGFja1RyYWNlcyA/IGUuc3RhY2sgOiBlLm1lc3NhZ2UsXG4gICAgICB9KTtcbiAgICB9XG4gIH07XG59XG5cbmV4cG9ydCBjbGFzcyBSZXRyeSBleHRlbmRzIEVycm9yIHsgfVxuIl19 \ No newline at end of file diff --git a/packages/@aws-cdk/lambda-layer-awscli/test/awscli-layer.integ.snapshot/asset.3b263c2ad043fd069ef446753788c36e595c82b51a70478e58258c8ef7471671/consts.js b/packages/@aws-cdk/lambda-layer-awscli/test/awscli-layer.integ.snapshot/asset.7215c88dd3e638d28329d4538b36cdbfb54233a4d972181795814f8b904d1037/consts.js similarity index 100% rename from packages/@aws-cdk/lambda-layer-awscli/test/awscli-layer.integ.snapshot/asset.3b263c2ad043fd069ef446753788c36e595c82b51a70478e58258c8ef7471671/consts.js rename to packages/@aws-cdk/lambda-layer-awscli/test/awscli-layer.integ.snapshot/asset.7215c88dd3e638d28329d4538b36cdbfb54233a4d972181795814f8b904d1037/consts.js diff --git a/packages/@aws-cdk/lambda-layer-awscli/test/awscli-layer.integ.snapshot/asset.3b263c2ad043fd069ef446753788c36e595c82b51a70478e58258c8ef7471671/framework.js b/packages/@aws-cdk/lambda-layer-awscli/test/awscli-layer.integ.snapshot/asset.7215c88dd3e638d28329d4538b36cdbfb54233a4d972181795814f8b904d1037/framework.js similarity index 100% rename from packages/@aws-cdk/lambda-layer-awscli/test/awscli-layer.integ.snapshot/asset.3b263c2ad043fd069ef446753788c36e595c82b51a70478e58258c8ef7471671/framework.js rename to packages/@aws-cdk/lambda-layer-awscli/test/awscli-layer.integ.snapshot/asset.7215c88dd3e638d28329d4538b36cdbfb54233a4d972181795814f8b904d1037/framework.js diff --git a/packages/@aws-cdk/lambda-layer-awscli/test/awscli-layer.integ.snapshot/asset.3b263c2ad043fd069ef446753788c36e595c82b51a70478e58258c8ef7471671/outbound.js b/packages/@aws-cdk/lambda-layer-awscli/test/awscli-layer.integ.snapshot/asset.7215c88dd3e638d28329d4538b36cdbfb54233a4d972181795814f8b904d1037/outbound.js similarity index 100% rename from packages/@aws-cdk/lambda-layer-awscli/test/awscli-layer.integ.snapshot/asset.3b263c2ad043fd069ef446753788c36e595c82b51a70478e58258c8ef7471671/outbound.js rename to packages/@aws-cdk/lambda-layer-awscli/test/awscli-layer.integ.snapshot/asset.7215c88dd3e638d28329d4538b36cdbfb54233a4d972181795814f8b904d1037/outbound.js diff --git a/packages/@aws-cdk/lambda-layer-awscli/test/awscli-layer.integ.snapshot/asset.7215c88dd3e638d28329d4538b36cdbfb54233a4d972181795814f8b904d1037/util.js b/packages/@aws-cdk/lambda-layer-awscli/test/awscli-layer.integ.snapshot/asset.7215c88dd3e638d28329d4538b36cdbfb54233a4d972181795814f8b904d1037/util.js new file mode 100644 index 0000000000000..f09276d40ac91 --- /dev/null +++ b/packages/@aws-cdk/lambda-layer-awscli/test/awscli-layer.integ.snapshot/asset.7215c88dd3e638d28329d4538b36cdbfb54233a4d972181795814f8b904d1037/util.js @@ -0,0 +1,39 @@ +"use strict"; +/* eslint-disable no-console */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.withRetries = exports.log = exports.getEnv = void 0; +function getEnv(name) { + const value = process.env[name]; + if (!value) { + throw new Error(`The environment variable "${name}" is not defined`); + } + return value; +} +exports.getEnv = getEnv; +function log(title, ...args) { + console.log('[provider-framework]', title, ...args.map(x => typeof (x) === 'object' ? JSON.stringify(x, undefined, 2) : x)); +} +exports.log = log; +function withRetries(options, fn) { + return async (...xs) => { + let attempts = options.attempts; + let ms = options.sleep; + while (true) { + try { + return await fn(...xs); + } + catch (e) { + if (attempts-- <= 0) { + throw e; + } + await sleep(Math.floor(Math.random() * ms)); + ms *= 2; + } + } + }; +} +exports.withRetries = withRetries; +async function sleep(ms) { + return new Promise((ok) => setTimeout(ok, ms)); +} +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXRpbC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbInV0aWwudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLCtCQUErQjs7O0FBRS9CLFNBQWdCLE1BQU0sQ0FBQyxJQUFZO0lBQ2pDLE1BQU0sS0FBSyxHQUFHLE9BQU8sQ0FBQyxHQUFHLENBQUMsSUFBSSxDQUFDLENBQUM7SUFDaEMsSUFBSSxDQUFDLEtBQUssRUFBRTtRQUNWLE1BQU0sSUFBSSxLQUFLLENBQUMsNkJBQTZCLElBQUksa0JBQWtCLENBQUMsQ0FBQztLQUN0RTtJQUNELE9BQU8sS0FBSyxDQUFDO0FBQ2YsQ0FBQztBQU5ELHdCQU1DO0FBRUQsU0FBZ0IsR0FBRyxDQUFDLEtBQVUsRUFBRSxHQUFHLElBQVc7SUFDNUMsT0FBTyxDQUFDLEdBQUcsQ0FBQyxzQkFBc0IsRUFBRSxLQUFLLEVBQUUsR0FBRyxJQUFJLENBQUMsR0FBRyxDQUFDLENBQUMsQ0FBQyxFQUFFLENBQUMsT0FBTSxDQUFDLENBQUMsQ0FBQyxLQUFLLFFBQVEsQ0FBQyxDQUFDLENBQUMsSUFBSSxDQUFDLFNBQVMsQ0FBQyxDQUFDLEVBQUUsU0FBUyxFQUFFLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDO0FBQzdILENBQUM7QUFGRCxrQkFFQztBQVNELFNBQWdCLFdBQVcsQ0FBMEIsT0FBcUIsRUFBRSxFQUE0QjtJQUN0RyxPQUFPLEtBQUssRUFBRSxHQUFHLEVBQUssRUFBRSxFQUFFO1FBQ3hCLElBQUksUUFBUSxHQUFHLE9BQU8sQ0FBQyxRQUFRLENBQUM7UUFDaEMsSUFBSSxFQUFFLEdBQUcsT0FBTyxDQUFDLEtBQUssQ0FBQztRQUN2QixPQUFPLElBQUksRUFBRTtZQUNYLElBQUk7Z0JBQ0YsT0FBTyxNQUFNLEVBQUUsQ0FBQyxHQUFHLEVBQUUsQ0FBQyxDQUFDO2FBQ3hCO1lBQUMsT0FBTyxDQUFDLEVBQUU7Z0JBQ1YsSUFBSSxRQUFRLEVBQUUsSUFBSSxDQUFDLEVBQUU7b0JBQ25CLE1BQU0sQ0FBQyxDQUFDO2lCQUNUO2dCQUNELE1BQU0sS0FBSyxDQUFDLElBQUksQ0FBQyxLQUFLLENBQUMsSUFBSSxDQUFDLE1BQU0sRUFBRSxHQUFHLEVBQUUsQ0FBQyxDQUFDLENBQUM7Z0JBQzVDLEVBQUUsSUFBSSxDQUFDLENBQUM7YUFDVDtTQUNGO0lBQ0gsQ0FBQyxDQUFDO0FBQ0osQ0FBQztBQWhCRCxrQ0FnQkM7QUFFRCxLQUFLLFVBQVUsS0FBSyxDQUFDLEVBQVU7SUFDN0IsT0FBTyxJQUFJLE9BQU8sQ0FBQyxDQUFDLEVBQUUsRUFBRSxFQUFFLENBQUMsVUFBVSxDQUFDLEVBQUUsRUFBRSxFQUFFLENBQUMsQ0FBQyxDQUFDO0FBQ2pELENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyIvKiBlc2xpbnQtZGlzYWJsZSBuby1jb25zb2xlICovXG5cbmV4cG9ydCBmdW5jdGlvbiBnZXRFbnYobmFtZTogc3RyaW5nKTogc3RyaW5nIHtcbiAgY29uc3QgdmFsdWUgPSBwcm9jZXNzLmVudltuYW1lXTtcbiAgaWYgKCF2YWx1ZSkge1xuICAgIHRocm93IG5ldyBFcnJvcihgVGhlIGVudmlyb25tZW50IHZhcmlhYmxlIFwiJHtuYW1lfVwiIGlzIG5vdCBkZWZpbmVkYCk7XG4gIH1cbiAgcmV0dXJuIHZhbHVlO1xufVxuXG5leHBvcnQgZnVuY3Rpb24gbG9nKHRpdGxlOiBhbnksIC4uLmFyZ3M6IGFueVtdKSB7XG4gIGNvbnNvbGUubG9nKCdbcHJvdmlkZXItZnJhbWV3b3JrXScsIHRpdGxlLCAuLi5hcmdzLm1hcCh4ID0+IHR5cGVvZih4KSA9PT0gJ29iamVjdCcgPyBKU09OLnN0cmluZ2lmeSh4LCB1bmRlZmluZWQsIDIpIDogeCkpO1xufVxuXG5leHBvcnQgaW50ZXJmYWNlIFJldHJ5T3B0aW9ucyB7XG4gIC8qKiBIb3cgbWFueSByZXRyaWVzICh3aWxsIGF0IGxlYXN0IHRyeSBvbmNlKSAqL1xuICByZWFkb25seSBhdHRlbXB0czogbnVtYmVyO1xuICAvKiogU2xlZXAgYmFzZSwgaW4gbXMgKi9cbiAgcmVhZG9ubHkgc2xlZXA6IG51bWJlcjtcbn1cblxuZXhwb3J0IGZ1bmN0aW9uIHdpdGhSZXRyaWVzPEEgZXh0ZW5kcyBBcnJheTxhbnk+LCBCPihvcHRpb25zOiBSZXRyeU9wdGlvbnMsIGZuOiAoLi4ueHM6IEEpID0+IFByb21pc2U8Qj4pOiAoLi4ueHM6IEEpID0+IFByb21pc2U8Qj4ge1xuICByZXR1cm4gYXN5bmMgKC4uLnhzOiBBKSA9PiB7XG4gICAgbGV0IGF0dGVtcHRzID0gb3B0aW9ucy5hdHRlbXB0cztcbiAgICBsZXQgbXMgPSBvcHRpb25zLnNsZWVwO1xuICAgIHdoaWxlICh0cnVlKSB7XG4gICAgICB0cnkge1xuICAgICAgICByZXR1cm4gYXdhaXQgZm4oLi4ueHMpO1xuICAgICAgfSBjYXRjaCAoZSkge1xuICAgICAgICBpZiAoYXR0ZW1wdHMtLSA8PSAwKSB7XG4gICAgICAgICAgdGhyb3cgZTtcbiAgICAgICAgfVxuICAgICAgICBhd2FpdCBzbGVlcChNYXRoLmZsb29yKE1hdGgucmFuZG9tKCkgKiBtcykpO1xuICAgICAgICBtcyAqPSAyO1xuICAgICAgfVxuICAgIH1cbiAgfTtcbn1cblxuYXN5bmMgZnVuY3Rpb24gc2xlZXAobXM6IG51bWJlcik6IFByb21pc2U8dm9pZD4ge1xuICByZXR1cm4gbmV3IFByb21pc2UoKG9rKSA9PiBzZXRUaW1lb3V0KG9rLCBtcykpO1xufSJdfQ== \ No newline at end of file diff --git a/packages/@aws-cdk/lambda-layer-awscli/test/awscli-layer.integ.snapshot/asset.c409e6c5845f1f349df8cd84e160bf6f1c35d2b060b63e1f032f9bd39d4542cc.zip b/packages/@aws-cdk/lambda-layer-awscli/test/awscli-layer.integ.snapshot/asset.c409e6c5845f1f349df8cd84e160bf6f1c35d2b060b63e1f032f9bd39d4542cc.zip new file mode 100644 index 0000000000000..d04ef9af4b889 Binary files /dev/null and b/packages/@aws-cdk/lambda-layer-awscli/test/awscli-layer.integ.snapshot/asset.c409e6c5845f1f349df8cd84e160bf6f1c35d2b060b63e1f032f9bd39d4542cc.zip differ diff --git a/packages/@aws-cdk/lambda-layer-awscli/test/awscli-layer.integ.snapshot/cdk.out b/packages/@aws-cdk/lambda-layer-awscli/test/awscli-layer.integ.snapshot/cdk.out index 588d7b269d34f..8ecc185e9dbee 100644 --- a/packages/@aws-cdk/lambda-layer-awscli/test/awscli-layer.integ.snapshot/cdk.out +++ b/packages/@aws-cdk/lambda-layer-awscli/test/awscli-layer.integ.snapshot/cdk.out @@ -1 +1 @@ -{"version":"20.0.0"} \ No newline at end of file +{"version":"21.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk/lambda-layer-awscli/test/awscli-layer.integ.snapshot/integ.json b/packages/@aws-cdk/lambda-layer-awscli/test/awscli-layer.integ.snapshot/integ.json index fb1d127e9c33f..ae6afef00cc42 100644 --- a/packages/@aws-cdk/lambda-layer-awscli/test/awscli-layer.integ.snapshot/integ.json +++ b/packages/@aws-cdk/lambda-layer-awscli/test/awscli-layer.integ.snapshot/integ.json @@ -1,11 +1,20 @@ { - "version": "20.0.0", + "version": "21.0.0", "testCases": { "lambda-layer-awscli-integ-test/DefaultTest": { "stacks": [ "lambda-layer-awscli-integ-stack" ], - "assertionStack": "lambda-layer-awscli-integ-test/DefaultTest/DeployAssert" + "diffAssets": true, + "cdkCommandOptions": { + "deploy": { + "args": { + "rollback": true + } + } + }, + "assertionStack": "lambda-layer-awscli-integ-test/DefaultTest/DeployAssert", + "assertionStackName": "lambdalayerawscliintegtestDefaultTestDeployAssert8E1153D3" } } } \ No newline at end of file diff --git a/packages/@aws-cdk/lambda-layer-awscli/test/awscli-layer.integ.snapshot/lambda-layer-awscli-integ-stack.assets.json b/packages/@aws-cdk/lambda-layer-awscli/test/awscli-layer.integ.snapshot/lambda-layer-awscli-integ-stack.assets.json index d4bf4113e7234..1203c557898c2 100644 --- a/packages/@aws-cdk/lambda-layer-awscli/test/awscli-layer.integ.snapshot/lambda-layer-awscli-integ-stack.assets.json +++ b/packages/@aws-cdk/lambda-layer-awscli/test/awscli-layer.integ.snapshot/lambda-layer-awscli-integ-stack.assets.json @@ -1,15 +1,15 @@ { - "version": "20.0.0", + "version": "21.0.0", "files": { - "39ee629321f531fffd853b944b2d6f3fa7b5276431c9a4fd4dc681303ab15080": { + "c409e6c5845f1f349df8cd84e160bf6f1c35d2b060b63e1f032f9bd39d4542cc": { "source": { - "path": "asset.39ee629321f531fffd853b944b2d6f3fa7b5276431c9a4fd4dc681303ab15080.zip", + "path": "asset.c409e6c5845f1f349df8cd84e160bf6f1c35d2b060b63e1f032f9bd39d4542cc.zip", "packaging": "file" }, "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "39ee629321f531fffd853b944b2d6f3fa7b5276431c9a4fd4dc681303ab15080.zip", + "objectKey": "c409e6c5845f1f349df8cd84e160bf6f1c35d2b060b63e1f032f9bd39d4542cc.zip", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } @@ -27,20 +27,20 @@ } } }, - "3b263c2ad043fd069ef446753788c36e595c82b51a70478e58258c8ef7471671": { + "7215c88dd3e638d28329d4538b36cdbfb54233a4d972181795814f8b904d1037": { "source": { - "path": "asset.3b263c2ad043fd069ef446753788c36e595c82b51a70478e58258c8ef7471671", + "path": "asset.7215c88dd3e638d28329d4538b36cdbfb54233a4d972181795814f8b904d1037", "packaging": "zip" }, "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "3b263c2ad043fd069ef446753788c36e595c82b51a70478e58258c8ef7471671.zip", + "objectKey": "7215c88dd3e638d28329d4538b36cdbfb54233a4d972181795814f8b904d1037.zip", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } }, - "cbfb3f44e370cb298ac580944166c6f9d98591b67f297aa9cabc3b719613cbf1": { + "41a1734c33fd9c3cc7261b90655668aa62e16d78502a59eb764d96d8aca10c59": { "source": { "path": "lambda-layer-awscli-integ-stack.template.json", "packaging": "file" @@ -48,7 +48,7 @@ "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "cbfb3f44e370cb298ac580944166c6f9d98591b67f297aa9cabc3b719613cbf1.json", + "objectKey": "41a1734c33fd9c3cc7261b90655668aa62e16d78502a59eb764d96d8aca10c59.json", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } diff --git a/packages/@aws-cdk/lambda-layer-awscli/test/awscli-layer.integ.snapshot/lambda-layer-awscli-integ-stack.template.json b/packages/@aws-cdk/lambda-layer-awscli/test/awscli-layer.integ.snapshot/lambda-layer-awscli-integ-stack.template.json index 6ac5cf0d1dd75..a1ccb2c51099f 100644 --- a/packages/@aws-cdk/lambda-layer-awscli/test/awscli-layer.integ.snapshot/lambda-layer-awscli-integ-stack.template.json +++ b/packages/@aws-cdk/lambda-layer-awscli/test/awscli-layer.integ.snapshot/lambda-layer-awscli-integ-stack.template.json @@ -7,7 +7,7 @@ "S3Bucket": { "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" }, - "S3Key": "39ee629321f531fffd853b944b2d6f3fa7b5276431c9a4fd4dc681303ab15080.zip" + "S3Key": "c409e6c5845f1f349df8cd84e160bf6f1c35d2b060b63e1f032f9bd39d4542cc.zip" }, "Description": "/opt/awscli/aws" } @@ -152,7 +152,7 @@ "S3Bucket": { "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" }, - "S3Key": "3b263c2ad043fd069ef446753788c36e595c82b51a70478e58258c8ef7471671.zip" + "S3Key": "7215c88dd3e638d28329d4538b36cdbfb54233a4d972181795814f8b904d1037.zip" }, "Role": { "Fn::GetAtt": [ @@ -333,7 +333,7 @@ "S3Bucket": { "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" }, - "S3Key": "3b263c2ad043fd069ef446753788c36e595c82b51a70478e58258c8ef7471671.zip" + "S3Key": "7215c88dd3e638d28329d4538b36cdbfb54233a4d972181795814f8b904d1037.zip" }, "Role": { "Fn::GetAtt": [ diff --git a/packages/@aws-cdk/lambda-layer-awscli/test/awscli-layer.integ.snapshot/lambdalayerawscliintegtestDefaultTestDeployAssert8E1153D3.assets.json b/packages/@aws-cdk/lambda-layer-awscli/test/awscli-layer.integ.snapshot/lambdalayerawscliintegtestDefaultTestDeployAssert8E1153D3.assets.json index ce8e5f9dc99be..a05ce77e50c09 100644 --- a/packages/@aws-cdk/lambda-layer-awscli/test/awscli-layer.integ.snapshot/lambdalayerawscliintegtestDefaultTestDeployAssert8E1153D3.assets.json +++ b/packages/@aws-cdk/lambda-layer-awscli/test/awscli-layer.integ.snapshot/lambdalayerawscliintegtestDefaultTestDeployAssert8E1153D3.assets.json @@ -1,5 +1,5 @@ { - "version": "20.0.0", + "version": "21.0.0", "files": { "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { "source": { diff --git a/packages/@aws-cdk/lambda-layer-awscli/test/awscli-layer.integ.snapshot/manifest.json b/packages/@aws-cdk/lambda-layer-awscli/test/awscli-layer.integ.snapshot/manifest.json index 44a4ddb89f84d..f6aaf0e4a16d8 100644 --- a/packages/@aws-cdk/lambda-layer-awscli/test/awscli-layer.integ.snapshot/manifest.json +++ b/packages/@aws-cdk/lambda-layer-awscli/test/awscli-layer.integ.snapshot/manifest.json @@ -1,5 +1,5 @@ { - "version": "20.0.0", + "version": "21.0.0", "artifacts": { "Tree": { "type": "cdk:tree", @@ -23,7 +23,7 @@ "validateOnSynth": false, "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/cbfb3f44e370cb298ac580944166c6f9d98591b67f297aa9cabc3b719613cbf1.json", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/41a1734c33fd9c3cc7261b90655668aa62e16d78502a59eb764d96d8aca10c59.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", "additionalDependencies": [ @@ -42,10 +42,7 @@ "/lambda-layer-awscli-integ-stack/AwsCliLayer/Resource": [ { "type": "aws:cdk:logicalId", - "data": "AwsCliLayerF44AAF94", - "trace": [ - "!!DESTRUCTIVE_CHANGES: WILL_REPLACE" - ] + "data": "AwsCliLayerF44AAF94" } ], "/lambda-layer-awscli-integ-stack/Lambda$python3.7/ServiceRole/Resource": [ diff --git a/packages/@aws-cdk/lambda-layer-awscli/test/awscli-layer.integ.snapshot/tree.json b/packages/@aws-cdk/lambda-layer-awscli/test/awscli-layer.integ.snapshot/tree.json index e26b65019edc7..910fdf4267cd3 100644 --- a/packages/@aws-cdk/lambda-layer-awscli/test/awscli-layer.integ.snapshot/tree.json +++ b/packages/@aws-cdk/lambda-layer-awscli/test/awscli-layer.integ.snapshot/tree.json @@ -9,7 +9,7 @@ "path": "Tree", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.1.85" + "version": "10.1.129" } }, "lambda-layer-awscli-integ-stack": { @@ -28,8 +28,8 @@ "id": "Stage", "path": "lambda-layer-awscli-integ-stack/AwsCliLayer/Code/Stage", "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.85" + "fqn": "@aws-cdk/core.AssetStaging", + "version": "0.0.0" } }, "AssetBucket": { @@ -56,7 +56,7 @@ "s3Bucket": { "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" }, - "s3Key": "39ee629321f531fffd853b944b2d6f3fa7b5276431c9a4fd4dc681303ab15080.zip" + "s3Key": "c409e6c5845f1f349df8cd84e160bf6f1c35d2b060b63e1f032f9bd39d4542cc.zip" }, "description": "/opt/awscli/aws" } @@ -133,8 +133,8 @@ "id": "Stage", "path": "lambda-layer-awscli-integ-stack/Lambda$python3.7/Code/Stage", "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.85" + "fqn": "@aws-cdk/core.AssetStaging", + "version": "0.0.0" } }, "AssetBucket": { @@ -316,8 +316,8 @@ "id": "Stage", "path": "lambda-layer-awscli-integ-stack/Providerpython3.7/framework-onEvent/Code/Stage", "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.85" + "fqn": "@aws-cdk/core.AssetStaging", + "version": "0.0.0" } }, "AssetBucket": { @@ -344,7 +344,7 @@ "s3Bucket": { "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" }, - "s3Key": "3b263c2ad043fd069ef446753788c36e595c82b51a70478e58258c8ef7471671.zip" + "s3Key": "7215c88dd3e638d28329d4538b36cdbfb54233a4d972181795814f8b904d1037.zip" }, "role": { "Fn::GetAtt": [ @@ -393,14 +393,14 @@ "id": "Default", "path": "lambda-layer-awscli-integ-stack/CustomResourcepython3.7/Default", "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.85" + "fqn": "@aws-cdk/core.CfnResource", + "version": "0.0.0" } } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.85" + "fqn": "@aws-cdk/core.CustomResource", + "version": "0.0.0" } }, "Lambda$python3.9": { @@ -464,8 +464,8 @@ "id": "Stage", "path": "lambda-layer-awscli-integ-stack/Lambda$python3.9/Code/Stage", "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.85" + "fqn": "@aws-cdk/core.AssetStaging", + "version": "0.0.0" } }, "AssetBucket": { @@ -647,8 +647,8 @@ "id": "Stage", "path": "lambda-layer-awscli-integ-stack/Providerpython3.9/framework-onEvent/Code/Stage", "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.85" + "fqn": "@aws-cdk/core.AssetStaging", + "version": "0.0.0" } }, "AssetBucket": { @@ -675,7 +675,7 @@ "s3Bucket": { "Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}" }, - "s3Key": "3b263c2ad043fd069ef446753788c36e595c82b51a70478e58258c8ef7471671.zip" + "s3Key": "7215c88dd3e638d28329d4538b36cdbfb54233a4d972181795814f8b904d1037.zip" }, "role": { "Fn::GetAtt": [ @@ -724,20 +724,20 @@ "id": "Default", "path": "lambda-layer-awscli-integ-stack/CustomResourcepython3.9/Default", "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.85" + "fqn": "@aws-cdk/core.CfnResource", + "version": "0.0.0" } } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.85" + "fqn": "@aws-cdk/core.CustomResource", + "version": "0.0.0" } } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.85" + "fqn": "@aws-cdk/core.Stack", + "version": "0.0.0" } }, "lambda-layer-awscli-integ-test": { @@ -753,15 +753,15 @@ "path": "lambda-layer-awscli-integ-test/DefaultTest/Default", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.1.85" + "version": "10.1.129" } }, "DeployAssert": { "id": "DeployAssert", "path": "lambda-layer-awscli-integ-test/DefaultTest/DeployAssert", "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.85" + "fqn": "@aws-cdk/core.Stack", + "version": "0.0.0" } } }, @@ -778,8 +778,8 @@ } }, "constructInfo": { - "fqn": "constructs.Construct", - "version": "10.1.85" + "fqn": "@aws-cdk/core.App", + "version": "0.0.0" } } } \ No newline at end of file diff --git a/packages/@aws-cdk/lambda-layer-awscli/test/integ.awscli-layer.ts b/packages/@aws-cdk/lambda-layer-awscli/test/integ.awscli-layer.ts index d98a5d0e36237..16367ed5a9a0c 100644 --- a/packages/@aws-cdk/lambda-layer-awscli/test/integ.awscli-layer.ts +++ b/packages/@aws-cdk/lambda-layer-awscli/test/integ.awscli-layer.ts @@ -38,6 +38,12 @@ for (const runtime of runtimes) { new integ.IntegTest(app, 'lambda-layer-awscli-integ-test', { testCases: [stack], + diffAssets: true, + cdkCommandOptions: { + deploy: { + args: { + rollback: true, + }, + }, + }, }); - -app.synth(); diff --git a/tools/@aws-cdk/prlint/lint.ts b/tools/@aws-cdk/prlint/lint.ts index d4c38e04a4b73..9f7904f4c501f 100644 --- a/tools/@aws-cdk/prlint/lint.ts +++ b/tools/@aws-cdk/prlint/lint.ts @@ -275,7 +275,7 @@ export class PullRequestLinter { const pr = (await this.client.pulls.get(this.prParams)).data; console.log(`⌛ Fetching files for PR number ${number}`); - const files = (await this.client.pulls.listFiles(this.prParams)).data; + const files = await this.client.paginate(this.client.pulls.listFiles, this.prParams); console.log("⌛ Validating..."); diff --git a/tools/@aws-cdk/prlint/test/lint.test.ts b/tools/@aws-cdk/prlint/test/lint.test.ts index 9a22289c7589d..ca417917af878 100644 --- a/tools/@aws-cdk/prlint/test/lint.test.ts +++ b/tools/@aws-cdk/prlint/test/lint.test.ts @@ -379,6 +379,7 @@ function configureMock(pr: linter.GitHubPr, prFiles?: linter.GitHubFile[]): lint client: { pulls: pullsClient as any, issues: issuesClient as any, + paginate: (method: any, args: any) => { return method(args).data }, } as any, }) }