Skip to content

Commit

Permalink
Merge branch 'master' into huijbers/fix-exportvalue-physicalname
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored Feb 16, 2021
2 parents bf00d02 + d043084 commit 9364364
Show file tree
Hide file tree
Showing 86 changed files with 1,189 additions and 359 deletions.
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@
"fs-extra": "^9.1.0",
"graceful-fs": "^4.2.6",
"jest-junit": "^12.0.0",
"jsii-diff": "^1.20.1",
"jsii-pacmak": "^1.20.1",
"jsii-rosetta": "^1.20.1",
"jsii-diff": "^1.21.0",
"jsii-pacmak": "^1.21.0",
"jsii-rosetta": "^1.21.0",
"lerna": "^3.22.1",
"standard-version": "^9.1.0",
"typescript": "~3.9.7"
"typescript": "~3.9.9"
},
"resolutions-comment": "should be removed or reviewed when nodeunit dependency is dropped or adjusted",
"resolutions": {
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/app-delivery/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"@types/nodeunit": "^0.0.31",
"cdk-build-tools": "0.0.0",
"cdk-integ-tools": "0.0.0",
"fast-check": "^2.12.1",
"fast-check": "^2.13.0",
"nodeunit": "^0.11.3",
"pkglint": "0.0.0"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-apigateway/lib/access-log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ export class AccessLogField {
* not from the backend Lambda function.
*/
public static contextIntegrationStatus() {
return '$context.integrationStatus.';
return '$context.integrationStatus';
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,14 @@
[
"integrations/",
{
"Ref": "MyHttpApiHttpIntegration6f095b8469365f72e33fa33d9711b140C45F3B26"
"Ref": "MyHttpApiGETHttpIntegration6f095b8469365f72e33fa33d9711b140516EBE31"
}
]
]
}
}
},
"MyHttpApiHttpIntegration6f095b8469365f72e33fa33d9711b140C45F3B26": {
"MyHttpApiGETHttpIntegration6f095b8469365f72e33fa33d9711b140516EBE31": {
"Type": "AWS::ApiGatewayV2::Integration",
"Properties": {
"ApiId": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,7 @@
[
"integrations/",
{
"Ref": "HttpProxyPrivateApiHttpIntegration1a580b19954e4317026ffbce1f7d5ade82925DF0"
"Ref": "HttpProxyPrivateApiDefaultRouteHttpIntegration1a580b19954e4317026ffbce1f7d5ade7A32685B"
}
]
]
Expand All @@ -647,7 +647,7 @@
"SecurityGroupIds": []
}
},
"HttpProxyPrivateApiHttpIntegration1a580b19954e4317026ffbce1f7d5ade82925DF0": {
"HttpProxyPrivateApiDefaultRouteHttpIntegration1a580b19954e4317026ffbce1f7d5ade7A32685B": {
"Type": "AWS::ApiGatewayV2::Integration",
"Properties": {
"ApiId": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,14 @@
[
"integrations/",
{
"Ref": "LambdaProxyApiHttpIntegration70df0ec52c3e3b6bbc96e64ce3a05f24467606A4"
"Ref": "LambdaProxyApiDefaultRouteHttpIntegration70df0ec52c3e3b6bbc96e64ce3a05f24EE575CBA"
}
]
]
}
}
},
"LambdaProxyApiHttpIntegration70df0ec52c3e3b6bbc96e64ce3a05f24467606A4": {
"LambdaProxyApiDefaultRouteHttpIntegration70df0ec52c3e3b6bbc96e64ce3a05f24EE575CBA": {
"Type": "AWS::ApiGatewayV2::Integration",
"Properties": {
"ApiId": {
Expand Down Expand Up @@ -162,14 +162,14 @@
[
"integrations/",
{
"Ref": "HttpProxyApiHttpIntegration8eeecf9ecdb91f31bebf6bd54fb711a4F32A389A"
"Ref": "HttpProxyApiDefaultRouteHttpIntegration8eeecf9ecdb91f31bebf6bd54fb711a41921AB82"
}
]
]
}
}
},
"HttpProxyApiHttpIntegration8eeecf9ecdb91f31bebf6bd54fb711a4F32A389A": {
"HttpProxyApiDefaultRouteHttpIntegration8eeecf9ecdb91f31bebf6bd54fb711a41921AB82": {
"Type": "AWS::ApiGatewayV2::Integration",
"Properties": {
"ApiId": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,14 @@
[
"integrations/",
{
"Ref": "LambdaProxyApiHttpIntegration70df0ec52c3e3b6bbc96e64ce3a05f24467606A4"
"Ref": "LambdaProxyApiDefaultRouteHttpIntegration70df0ec52c3e3b6bbc96e64ce3a05f24EE575CBA"
}
]
]
}
}
},
"LambdaProxyApiHttpIntegration70df0ec52c3e3b6bbc96e64ce3a05f24467606A4": {
"LambdaProxyApiDefaultRouteHttpIntegration70df0ec52c3e3b6bbc96e64ce3a05f24EE575CBA": {
"Type": "AWS::ApiGatewayV2::Integration",
"Properties": {
"ApiId": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,7 @@
[
"integrations/",
{
"Ref": "HttpProxyPrivateApiHttpIntegration1a580b19954e4317026ffbce1f7d5ade82925DF0"
"Ref": "HttpProxyPrivateApiDefaultRouteHttpIntegration1a580b19954e4317026ffbce1f7d5ade7A32685B"
}
]
]
Expand All @@ -612,7 +612,7 @@
"SecurityGroupIds": []
}
},
"HttpProxyPrivateApiHttpIntegration1a580b19954e4317026ffbce1f7d5ade82925DF0": {
"HttpProxyPrivateApiDefaultRouteHttpIntegration1a580b19954e4317026ffbce1f7d5ade7A32685B": {
"Type": "AWS::ApiGatewayV2::Integration",
"Properties": {
"ApiId": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -588,14 +588,14 @@
[
"integrations/",
{
"Ref": "HttpProxyPrivateApiHttpIntegrationa5ec5390ca688d567e9449daf58afc6fB75CE02B"
"Ref": "HttpProxyPrivateApiDefaultRouteHttpIntegrationa5ec5390ca688d567e9449daf58afc6f6DEAA8A8"
}
]
]
}
}
},
"HttpProxyPrivateApiHttpIntegrationa5ec5390ca688d567e9449daf58afc6fB75CE02B": {
"HttpProxyPrivateApiDefaultRouteHttpIntegrationa5ec5390ca688d567e9449daf58afc6f6DEAA8A8": {
"Type": "AWS::ApiGatewayV2::Integration",
"Properties": {
"ApiId": {
Expand Down
8 changes: 4 additions & 4 deletions packages/@aws-cdk/aws-apigatewayv2/lib/http/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export interface IHttpApi extends IResource {
* Add a http integration
* @internal
*/
_addIntegration(config: HttpRouteIntegrationConfig): HttpIntegration;
_addIntegration(scope: Construct, config: HttpRouteIntegrationConfig): HttpIntegration;
}

/**
Expand Down Expand Up @@ -274,15 +274,15 @@ abstract class HttpApiBase extends Resource implements IHttpApi { // note that t
/**
* @internal
*/
public _addIntegration(config: HttpRouteIntegrationConfig): HttpIntegration {
const stringifiedConfig = JSON.stringify(Stack.of(this).resolve(config));
public _addIntegration(scope: Construct, config: HttpRouteIntegrationConfig): HttpIntegration {
const stringifiedConfig = JSON.stringify(Stack.of(scope).resolve(config));
const configHash = crypto.createHash('md5').update(stringifiedConfig).digest('hex');

if (configHash in this.httpIntegrations) {
return this.httpIntegrations[configHash];
}

const integration = new HttpIntegration(this, `HttpIntegration-${configHash}`, {
const integration = new HttpIntegration(scope, `HttpIntegration-${configHash}`, {
httpApi: this,
integrationType: config.type,
integrationUri: config.uri,
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-apigatewayv2/lib/http/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ export class HttpRoute extends Resource implements IHttpRoute {
scope: this,
});

const integration = props.httpApi._addIntegration(config);
const integration = props.httpApi._addIntegration(this, config);

const authBindResult = props.authorizer ? props.authorizer.bind({
route: this,
Expand Down
1 change: 0 additions & 1 deletion packages/@aws-cdk/aws-apigatewayv2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@
"license": "Apache-2.0",
"devDependencies": {
"@aws-cdk/assert": "0.0.0",
"@aws-cdk/aws-cognito": "0.0.0",
"cdk-build-tools": "0.0.0",
"cdk-integ-tools": "0.0.0",
"cfn2ts": "0.0.0",
Expand Down
27 changes: 24 additions & 3 deletions packages/@aws-cdk/aws-apigatewayv2/test/http/route.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import '@aws-cdk/assert/jest';
import { Stack } from '@aws-cdk/core';
import { Stack, App } from '@aws-cdk/core';
import {
HttpApi, HttpAuthorizer, HttpAuthorizerType, HttpConnectionType, HttpIntegrationType, HttpMethod, HttpRoute, HttpRouteAuthorizerBindOptions,
HttpRouteAuthorizerConfig, HttpRouteIntegrationConfig, HttpRouteKey, IHttpRouteAuthorizer, IHttpRouteIntegration, PayloadFormatVersion,
Expand All @@ -25,7 +25,7 @@ describe('HttpRoute', () => {
[
'integrations/',
{
Ref: 'HttpApiHttpIntegrationcff2618c192d3bd8581dd2a4093464f6CDB667B8',
Ref: 'HttpRouteHttpIntegrationcff2618c192d3bd8581dd2a4093464f6FB1097D0',
},
],
],
Expand Down Expand Up @@ -115,6 +115,27 @@ describe('HttpRoute', () => {
expect(stack2).toCountResources('AWS::ApiGatewayV2::Integration', 1);
});

test('route defined in a separate stack does not create cycles', () => {
// GIVEN
const integration = new DummyIntegration();

// WHEN
const app = new App();
const stack1 = new Stack(app, 'ApiStack');
const httpApi = new HttpApi(stack1, 'HttpApi');

const stack2 = new Stack(app, 'RouteStack');
new HttpRoute(stack2, 'HttpRoute1', {
httpApi,
integration,
routeKey: HttpRouteKey.with('/books', HttpMethod.GET),
});

// THEN
expect(stack1).toCountResources('AWS::ApiGatewayV2::Integration', 0);
expect(stack2).toCountResources('AWS::ApiGatewayV2::Integration', 1);
});

test('throws when path not start with /', () => {
const stack = new Stack();
const httpApi = new HttpApi(stack, 'HttpApi');
Expand Down Expand Up @@ -253,4 +274,4 @@ class DummyAuthorizer implements IHttpRouteAuthorizer {
authorizationType: HttpAuthorizerType.JWT,
};
}
}
}
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-applicationautoscaling/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
"@types/nodeunit": "^0.0.31",
"cdk-build-tools": "0.0.0",
"cfn2ts": "0.0.0",
"fast-check": "^2.12.1",
"fast-check": "^2.13.0",
"nodeunit": "^0.11.3",
"pkglint": "0.0.0"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-autoscaling-common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"@types/nodeunit": "^0.0.31",
"cdk-build-tools": "0.0.0",
"cdk-integ-tools": "0.0.0",
"fast-check": "^2.12.1",
"fast-check": "^2.13.0",
"nodeunit": "^0.11.3",
"pkglint": "0.0.0"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@
"devDependencies": {
"aws-sdk": "^2.596.0",
"aws-sdk-mock": "^5.1.0",
"eslint": "^7.19.0",
"eslint": "^7.20.0",
"eslint-config-standard": "^14.1.1",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-promise": "^4.3.1",
"eslint-plugin-standard": "^4.1.0",
"jest": "^26.6.3",
"lambda-tester": "^3.6.0",
"nock": "^13.0.7",
"ts-jest": "^26.5.0"
"ts-jest": "^26.5.1"
}
}
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-cloudformation/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
"@aws-cdk/aws-sns-subscriptions": "0.0.0",
"@aws-cdk/aws-sqs": "0.0.0",
"@aws-cdk/aws-ssm": "0.0.0",
"@types/aws-lambda": "^8.10.71",
"@types/aws-lambda": "^8.10.72",
"@types/nodeunit": "^0.0.31",
"cdk-build-tools": "0.0.0",
"cdk-integ-tools": "0.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-cloudfront-origins/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
"devDependencies": {
"@aws-cdk/assert": "0.0.0",
"@aws-cdk/aws-ec2": "0.0.0",
"aws-sdk": "^2.842.0",
"aws-sdk": "^2.844.0",
"cdk-build-tools": "0.0.0",
"cdk-integ-tools": "0.0.0",
"pkglint": "0.0.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,10 @@ export class EdgeFunction extends Resource implements lambda.IVersion {
let edgeStack = stage.node.tryFindChild(edgeStackId) as Stack;
if (!edgeStack) {
edgeStack = new Stack(stage, edgeStackId, {
env: { region: EdgeFunction.EDGE_REGION },
env: {
region: EdgeFunction.EDGE_REGION,
account: Stack.of(this).account,
},
});
}
this.stack.addDependency(edgeStack);
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-cloudfront/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
"license": "Apache-2.0",
"devDependencies": {
"@aws-cdk/assert": "0.0.0",
"aws-sdk": "^2.842.0",
"aws-sdk": "^2.844.0",
"cdk-build-tools": "0.0.0",
"cdk-integ-tools": "0.0.0",
"cfn2ts": "0.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,25 @@ describe('stacks', () => {
});
});

test('us-east-1 stack inherits account of parent stack', () => {
new cloudfront.experimental.EdgeFunction(stack, 'MyFn', defaultEdgeFunctionProps());

const fnStack = getFnStack();

expect(fnStack.account).toEqual('111111111111');
});

test('us-east-1 stack inherits account of parent stack, when parent stack account is undefined', () => {
stack = new cdk.Stack(app, 'StackWithDefaultAccount', {
env: { region: 'testregion' },
});
new cloudfront.experimental.EdgeFunction(stack, 'MyFn', defaultEdgeFunctionProps());

const fnStack = getFnStack();

expect(fnStack.account).toEqual(cdk.Aws.ACCOUNT_ID);
});

test('creates minimal constructs if scope region is us-east-1', () => {
app = new cdk.App();
stack = new cdk.Stack(app, 'Stack', {
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-cloudtrail/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
"license": "Apache-2.0",
"devDependencies": {
"@aws-cdk/assert": "0.0.0",
"aws-sdk": "^2.842.0",
"aws-sdk": "^2.844.0",
"cdk-build-tools": "0.0.0",
"cdk-integ-tools": "0.0.0",
"cfn2ts": "0.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-codebuild/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
"@aws-cdk/aws-sns": "0.0.0",
"@aws-cdk/aws-sqs": "0.0.0",
"@types/nodeunit": "^0.0.31",
"aws-sdk": "^2.842.0",
"aws-sdk": "^2.844.0",
"cdk-build-tools": "0.0.0",
"cdk-integ-tools": "0.0.0",
"cfn2ts": "0.0.0",
Expand Down
5 changes: 4 additions & 1 deletion packages/@aws-cdk/aws-codecommit/lib/repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,10 @@ export class Repository extends RepositoryBase {
public readonly repositoryCloneUrlGrc = makeCloneUrl(stack, repositoryName, 'grc', region);
}

return new Import(scope, id);
return new Import(scope, id, {
account: arn.account,
region,
});
}

public static fromRepositoryName(scope: Construct, id: string, repositoryName: string): IRepository {
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-codecommit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
"@aws-cdk/assert": "0.0.0",
"@aws-cdk/aws-sns": "0.0.0",
"@types/nodeunit": "^0.0.31",
"aws-sdk": "^2.842.0",
"aws-sdk": "^2.844.0",
"cdk-build-tools": "0.0.0",
"cdk-integ-tools": "0.0.0",
"cfn2ts": "0.0.0",
Expand Down
Loading

0 comments on commit 9364364

Please sign in to comment.