Skip to content

Commit

Permalink
Merge branch 'main' of github.com:aws/aws-cdk into metrics-config
Browse files Browse the repository at this point in the history
  • Loading branch information
roger-zhangg committed Nov 20, 2024
2 parents 2577ec1 + e1a2f68 commit dcb71fe
Show file tree
Hide file tree
Showing 108 changed files with 113,596 additions and 10,668 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.v2.alpha.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## [2.167.2-alpha.0](https://github.com/aws/aws-cdk/compare/v2.167.1-alpha.0...v2.167.2-alpha.0) (2024-11-18)

## [2.167.1-alpha.0](https://github.com/aws/aws-cdk/compare/v2.167.0-alpha.0...v2.167.1-alpha.0) (2024-11-14)

## [2.167.0-alpha.0](https://github.com/aws/aws-cdk/compare/v2.166.0-alpha.0...v2.167.0-alpha.0) (2024-11-13)
Expand Down
9 changes: 9 additions & 0 deletions CHANGELOG.v2.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## [2.167.2](https://github.com/aws/aws-cdk/compare/v2.167.1...v2.167.2) (2024-11-18)


### Bug Fixes

* **cli:** `cdk diff` always falls back to template only diff ([#32165](https://github.com/aws/aws-cdk/issues/32165)) ([3fd9699](https://github.com/aws/aws-cdk/commit/3fd969988c599bf15b9b68d718505fcf92045b3a))
* **cli:** externally managed stack notification arns are deleted on `deploy` ([#32163](https://github.com/aws/aws-cdk/issues/32163)) ([465da31](https://github.com/aws/aws-cdk/commit/465da319ea173fba8ae395b8b897607cf2075eaa))
* **cli:** the LoadBalancerProvider doesn't match LBs when querying by a subset of tags ([#32164](https://github.com/aws/aws-cdk/issues/32164)) ([a0b47c5](https://github.com/aws/aws-cdk/commit/a0b47c5b530abe13b547d7263f437997148eb630))

## [2.167.1](https://github.com/aws/aws-cdk/compare/v2.167.0...v2.167.1) (2024-11-14)


Expand Down
8 changes: 7 additions & 1 deletion allowed-breaking-changes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -936,4 +936,10 @@ removed:aws-cdk-lib.aws_ec2.WindowsVersion.WINDOWS_SERVER_2022_TURKISH_FULL_BASE

# null() return a [] which is invalid filter rule. It should return [null].
# Hence the return type changes from string[] to any
change-return-type:aws-cdk-lib.aws_lambda.FilterRule.null
change-return-type:aws-cdk-lib.aws_lambda.FilterRule.null


# output property was mistakenly marked as required even though it should have allowed
# for undefined, i.e optional
changed-type:@aws-cdk/cx-api.CloudFormationStackArtifact.notificationArns
changed-type:aws-cdk-lib.cx_api.CloudFormationStackArtifact.notificationArns
21 changes: 15 additions & 6 deletions packages/@aws-cdk-testing/cli-integ/resources/cdk-apps/app/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -742,12 +742,23 @@ class BuiltinLambdaStack extends cdk.Stack {
}
}

class NotificationArnPropStack extends cdk.Stack {
class NotificationArnsStack extends cdk.Stack {
constructor(parent, id, props) {
super(parent, id, props);
new sns.Topic(this, 'topic');

const arnsFromEnv = process.env.INTEG_NOTIFICATION_ARNS;
super(parent, id, {
...props,
// comma separated list of arns.
// empty string means empty list.
// undefined means undefined
notificationArns: arnsFromEnv == '' ? [] : (arnsFromEnv ? arnsFromEnv.split(',') : undefined)
});

new cdk.CfnWaitConditionHandle(this, 'WaitConditionHandle');

}
}

class AppSyncHotswapStack extends cdk.Stack {
constructor(parent, id, props) {
super(parent, id, props);
Expand Down Expand Up @@ -839,9 +850,7 @@ switch (stackSet) {
new DockerInUseStack(app, `${stackPrefix}-docker-in-use`);
new DockerStackWithCustomFile(app, `${stackPrefix}-docker-with-custom-file`);

new NotificationArnPropStack(app, `${stackPrefix}-notification-arn-prop`, {
notificationArns: [`arn:aws:sns:${defaultEnv.region}:${defaultEnv.account}:${stackPrefix}-test-topic-prop`],
});
new NotificationArnsStack(app, `${stackPrefix}-notification-arns`);

// SSO stacks
new SsoInstanceAccessControlConfig(app, `${stackPrefix}-sso-access-control`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import {
DescribeStacksCommand,
GetTemplateCommand,
ListChangeSetsCommand,
UpdateStackCommand,
waitUntilStackUpdateComplete,
} from '@aws-sdk/client-cloudformation';
import { DescribeServicesCommand } from '@aws-sdk/client-ecs';
import {
Expand Down Expand Up @@ -633,14 +635,14 @@ integTest(
const topicArn = response.TopicArn!;

try {
await fixture.cdkDeploy('test-2', {
await fixture.cdkDeploy('notification-arns', {
options: ['--notification-arns', topicArn],
});

// verify that the stack we deployed has our notification ARN
const describeResponse = await fixture.aws.cloudFormation.send(
new DescribeStacksCommand({
StackName: fixture.fullStackName('test-2'),
StackName: fixture.fullStackName('notification-arns'),
}),
);
expect(describeResponse.Stacks?.[0].NotificationARNs).toEqual([topicArn]);
Expand All @@ -661,12 +663,63 @@ integTest('deploy with notification ARN as prop', withDefaultFixture(async (fixt
const topicArn = response.TopicArn!;

try {
await fixture.cdkDeploy('notification-arn-prop');
await fixture.cdkDeploy('notification-arns', {
modEnv: {
INTEG_NOTIFICATION_ARNS: topicArn,

},
});

// verify that the stack we deployed has our notification ARN
const describeResponse = await fixture.aws.cloudFormation.send(
new DescribeStacksCommand({
StackName: fixture.fullStackName('notification-arn-prop'),
StackName: fixture.fullStackName('notification-arns'),
}),
);
expect(describeResponse.Stacks?.[0].NotificationARNs).toEqual([topicArn]);
} finally {
await fixture.aws.sns.send(
new DeleteTopicCommand({
TopicArn: topicArn,
}),
);
}
}));

// https://github.com/aws/aws-cdk/issues/32153
integTest('deploy preserves existing notification arns when not specified', withDefaultFixture(async (fixture) => {
const topicName = `${fixture.stackNamePrefix}-topic`;

const response = await fixture.aws.sns.send(new CreateTopicCommand({ Name: topicName }));
const topicArn = response.TopicArn!;

try {
await fixture.cdkDeploy('notification-arns');

// add notification arns externally to cdk
await fixture.aws.cloudFormation.send(
new UpdateStackCommand({
StackName: fixture.fullStackName('notification-arns'),
UsePreviousTemplate: true,
NotificationARNs: [topicArn],
}),
);

await waitUntilStackUpdateComplete(
{
client: fixture.aws.cloudFormation,
maxWaitTime: 600,
},
{ StackName: fixture.fullStackName('notification-arns') },
);

// deploy again
await fixture.cdkDeploy('notification-arns');

// make sure the notification arn is preserved
const describeResponse = await fixture.aws.cloudFormation.send(
new DescribeStacksCommand({
StackName: fixture.fullStackName('notification-arns'),
}),
);
expect(describeResponse.Stacks?.[0].NotificationARNs).toEqual([topicArn]);
Expand All @@ -679,6 +732,87 @@ integTest('deploy with notification ARN as prop', withDefaultFixture(async (fixt
}
}));

integTest('deploy deletes ALL notification arns when empty array is passed', withDefaultFixture(async (fixture) => {
const topicName = `${fixture.stackNamePrefix}-topic`;

const response = await fixture.aws.sns.send(new CreateTopicCommand({ Name: topicName }));
const topicArn = response.TopicArn!;

try {
await fixture.cdkDeploy('notification-arns', {
modEnv: {
INTEG_NOTIFICATION_ARNS: topicArn,
},
});

// make sure the arn was added
let describeResponse = await fixture.aws.cloudFormation.send(
new DescribeStacksCommand({
StackName: fixture.fullStackName('notification-arns'),
}),
);
expect(describeResponse.Stacks?.[0].NotificationARNs).toEqual([topicArn]);

// deploy again with empty array
await fixture.cdkDeploy('notification-arns', {
modEnv: {
INTEG_NOTIFICATION_ARNS: '',
},
});

// make sure the arn was deleted
describeResponse = await fixture.aws.cloudFormation.send(
new DescribeStacksCommand({
StackName: fixture.fullStackName('notification-arns'),
}),
);
expect(describeResponse.Stacks?.[0].NotificationARNs).toEqual([]);
} finally {
await fixture.aws.sns.send(
new DeleteTopicCommand({
TopicArn: topicArn,
}),
);
}
}));

integTest('deploy with notification ARN as prop and flag', withDefaultFixture(async (fixture) => {
const topic1Name = `${fixture.stackNamePrefix}-topic1`;
const topic2Name = `${fixture.stackNamePrefix}-topic1`;

const topic1Arn = (await fixture.aws.sns.send(new CreateTopicCommand({ Name: topic1Name }))).TopicArn!;
const topic2Arn = (await fixture.aws.sns.send(new CreateTopicCommand({ Name: topic2Name }))).TopicArn!;

try {
await fixture.cdkDeploy('notification-arns', {
modEnv: {
INTEG_NOTIFICATION_ARNS: topic1Arn,

},
options: ['--notification-arns', topic2Arn],
});

// verify that the stack we deployed has our notification ARN
const describeResponse = await fixture.aws.cloudFormation.send(
new DescribeStacksCommand({
StackName: fixture.fullStackName('notification-arns'),
}),
);
expect(describeResponse.Stacks?.[0].NotificationARNs).toEqual([topic1Arn, topic2Arn]);
} finally {
await fixture.aws.sns.send(
new DeleteTopicCommand({
TopicArn: topic1Arn,
}),
);
await fixture.aws.sns.send(
new DeleteTopicCommand({
TopicArn: topic2Arn,
}),
);
}
}));

// NOTE: this doesn't currently work with modern-style synthesis, as the bootstrap
// role by default will not have permission to iam:PassRole the created role.
integTest(
Expand Down
Loading

0 comments on commit dcb71fe

Please sign in to comment.