From ccc8371e46ecb1cbb5d96f82c0238cafe74b30c6 Mon Sep 17 00:00:00 2001 From: Sumu Date: Fri, 20 Sep 2024 12:00:13 -0400 Subject: [PATCH 01/10] add accountId to LogQueryGroupProps and MetricWidgetProps; initialize prop in LogQueryWidget and the 4 Metrics Widgets (AlarmWidget, GaugeWidget, GraphWidget, and SingleValueSidget ) Signed-off-by: Sumu --- packages/aws-cdk-lib/aws-cloudwatch/lib/graph.ts | 12 ++++++++++++ packages/aws-cdk-lib/aws-cloudwatch/lib/log-query.ts | 8 ++++++++ 2 files changed, 20 insertions(+) diff --git a/packages/aws-cdk-lib/aws-cloudwatch/lib/graph.ts b/packages/aws-cdk-lib/aws-cloudwatch/lib/graph.ts index 008513b30d9cc..0c56f03d652f1 100644 --- a/packages/aws-cdk-lib/aws-cloudwatch/lib/graph.ts +++ b/packages/aws-cdk-lib/aws-cloudwatch/lib/graph.ts @@ -15,6 +15,13 @@ export interface MetricWidgetProps { */ readonly title?: string; + /** + * Account ID for the metrics of this widget + * + * @default - None + */ + readonly accountId?: string; + /** * The region the metrics of this graph should be taken from * @@ -108,6 +115,7 @@ export class AlarmWidget extends ConcreteWidget { y: this.y, properties: { view: 'timeSeries', + accountId: this.props.accountId, title: this.props.title, region: this.props.region || cdk.Aws.REGION, annotations: { @@ -274,6 +282,7 @@ export class GaugeWidget extends ConcreteWidget { properties: { view: 'gauge', title: this.props.title, + accountId: this.props.accountId, region: this.props.region || cdk.Aws.REGION, metrics: metrics.length > 0 ? metrics : undefined, annotations: (this.props.annotations ?? []).length > 0 ? { horizontal: this.props.annotations } : undefined, @@ -499,6 +508,7 @@ export class GraphWidget extends ConcreteWidget { properties: { view: this.props.view ?? GraphWidgetView.TIME_SERIES, title: this.props.title, + accountId: this.props.accountId, region: this.props.region || cdk.Aws.REGION, stacked: this.props.stacked, metrics: metrics.length > 0 ? metrics : undefined, @@ -787,6 +797,7 @@ export class TableWidget extends ConcreteWidget { x: this.x, y: this.y, properties: { + accountId: this.props.accountId, title: this.props.title, view: 'table', table: { @@ -907,6 +918,7 @@ export class SingleValueWidget extends ConcreteWidget { properties: { view: 'singleValue', title: this.props.title, + accountId: this.props.accountId, region: this.props.region || cdk.Aws.REGION, sparkline: this.props.sparkline, metrics: allMetricsGraphJson(this.props.metrics, []), diff --git a/packages/aws-cdk-lib/aws-cloudwatch/lib/log-query.ts b/packages/aws-cdk-lib/aws-cloudwatch/lib/log-query.ts index 042d65e0b5048..610303434c516 100644 --- a/packages/aws-cdk-lib/aws-cloudwatch/lib/log-query.ts +++ b/packages/aws-cdk-lib/aws-cloudwatch/lib/log-query.ts @@ -38,6 +38,13 @@ export interface LogQueryWidgetProps { */ readonly title?: string; + /** + * Account ID for the logs of this widget + * + * @default None + */ + readonly accountId?: string; + /** * Names of log groups to query */ @@ -119,6 +126,7 @@ export class LogQueryWidget extends ConcreteWidget { const properties: any = { view: this.props.view? this.props.view : LogQueryVisualizationType.TABLE, title: this.props.title, + accountId: this.props.accountId, region: this.props.region || cdk.Aws.REGION, query: `${sources} | ${query}`, }; From ef71d77d866280d78c128067f0638cdf77a6ff11 Mon Sep 17 00:00:00 2001 From: Sumu Date: Fri, 20 Sep 2024 12:22:39 -0400 Subject: [PATCH 02/10] add accountId to LogQueryGroupProps and MetricWidgetProps; initialize prop in LogQueryWidget and the 4 Metrics Widgets (AlarmWidget, GaugeWidget, GraphWidget, and SingleValueSidget )cd Signed-off-by: Sumu --- packages/@aws-cdk/cx-api/FEATURE_FLAGS.md | 22 ++++++++++++++++++- .../aws-cloudwatch/test/graphs.test.ts | 7 ++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/packages/@aws-cdk/cx-api/FEATURE_FLAGS.md b/packages/@aws-cdk/cx-api/FEATURE_FLAGS.md index 634630f6e9b41..beadd60aa4ed2 100644 --- a/packages/@aws-cdk/cx-api/FEATURE_FLAGS.md +++ b/packages/@aws-cdk/cx-api/FEATURE_FLAGS.md @@ -73,6 +73,7 @@ Flags come in three types: | [@aws-cdk/custom-resources:logApiResponseDataPropertyTrueDefault](#aws-cdkcustom-resourceslogapiresponsedatapropertytruedefault) | When enabled, the custom resource used for `AwsCustomResource` will configure the `logApiResponseData` property as true by default | 2.145.0 | (fix) | | [@aws-cdk/aws-s3:keepNotificationInImportedBucket](#aws-cdkaws-s3keepnotificationinimportedbucket) | When enabled, Adding notifications to a bucket in the current stack will not remove notification from imported stack. | 2.155.0 | (fix) | | [@aws-cdk/aws-stepfunctions-tasks:useNewS3UriParametersForBedrockInvokeModelTask](#aws-cdkaws-stepfunctions-tasksusenews3uriparametersforbedrockinvokemodeltask) | When enabled, use new props for S3 URI field in task definition of state machine for bedrock invoke model. | 2.156.0 | (fix) | +| [@aws-cdk/aws-ecs:reduceEc2FargateCloudWatchPermissions](#aws-cdkaws-ecsreduceec2fargatecloudwatchpermissions) | When enabled, we will only grant the necessary permissions when users specify cloudwatch log group through logConfiguration | 2.159.0 | (fix) | @@ -134,7 +135,8 @@ The following json shows the current recommended set of flags, as `cdk init` wou "@aws-cdk/aws-ec2:ebsDefaultGp3Volume": true, "@aws-cdk/aws-ecs:removeDefaultDeploymentAlarm": true, "@aws-cdk/custom-resources:logApiResponseDataPropertyTrueDefault": false, - "@aws-cdk/aws-s3:keepNotificationInImportedBucket": false + "@aws-cdk/aws-s3:keepNotificationInImportedBucket": false, + "@aws-cdk/aws-ecs:reduceEc2FargateCloudWatchPermissions": true } } ``` @@ -1378,4 +1380,22 @@ When this feature flag is enabled, specify newly introduced props 's3InputUri' a **Compatibility with old behavior:** Disable the feature flag to use input and output path fields for s3 URI +### @aws-cdk/aws-ecs:reduceEc2FargateCloudWatchPermissions + +*When enabled, we will only grant the necessary permissions when users specify cloudwatch log group through logConfiguration* (fix) + +Currently, we automatically add a number of cloudwatch permissions to the task role when no cloudwatch log group is +specified as logConfiguration and it will grant 'Resources': ['*'] to the task role. + +When this feature flag is enabled, we will only grant the necessary permissions when users specify cloudwatch log group. + + +| Since | Default | Recommended | +| ----- | ----- | ----- | +| (not in v1) | | | +| 2.159.0 | `false` | `true` | + +**Compatibility with old behavior:** Disable the feature flag to continue grant permissions to log group when no log group is specified + + diff --git a/packages/aws-cdk-lib/aws-cloudwatch/test/graphs.test.ts b/packages/aws-cdk-lib/aws-cloudwatch/test/graphs.test.ts index dd70bce845df0..ba21f14422d0e 100644 --- a/packages/aws-cdk-lib/aws-cloudwatch/test/graphs.test.ts +++ b/packages/aws-cdk-lib/aws-cloudwatch/test/graphs.test.ts @@ -26,6 +26,7 @@ describe('Graphs', () => { const stack = new Stack(); const widget = new GraphWidget({ title: 'Test widget', + accountId: '123456789', stacked: true, }); @@ -35,6 +36,7 @@ describe('Graphs', () => { width: 6, height: 6, properties: { + accountId: '123456789', view: 'timeSeries', title: 'Test widget', region: { Ref: 'AWS::Region' }, @@ -160,6 +162,7 @@ describe('Graphs', () => { // WHEN const widget = new SingleValueWidget({ metrics: [metric], + accountId: '123456789', }); // THEN @@ -168,6 +171,7 @@ describe('Graphs', () => { width: 6, height: 3, properties: { + accountId: '123456789', view: 'singleValue', region: { Ref: 'AWS::Region' }, metrics: [ @@ -336,6 +340,7 @@ describe('Graphs', () => { // WHEN const widget = new AlarmWidget({ alarm, + accountId: '123456789', }); // THEN @@ -1065,6 +1070,7 @@ describe('Graphs', () => { const stack = new Stack(); const widget = new GaugeWidget({ metrics: [new Metric({ namespace: 'CDK', metricName: 'Test' })], + accountId: '123456789', annotations: [ { color: '#b2df8d', @@ -1082,6 +1088,7 @@ describe('Graphs', () => { height: 6, properties: { view: 'gauge', + accountId: '123456789', region: { Ref: 'AWS::Region' }, metrics: [ ['CDK', 'Test'], From b33b32ba4a25df30a0ea25514f0a9c33434a8a66 Mon Sep 17 00:00:00 2001 From: Sumu Date: Fri, 20 Sep 2024 12:24:53 -0400 Subject: [PATCH 03/10] update unit tests, adding accountId property to 5 different snapshot tests for each Widget type Signed-off-by: Sumu --- packages/aws-cdk-lib/aws-cloudwatch/test/graphs.test.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/aws-cdk-lib/aws-cloudwatch/test/graphs.test.ts b/packages/aws-cdk-lib/aws-cloudwatch/test/graphs.test.ts index ba21f14422d0e..13fb8ac80a74b 100644 --- a/packages/aws-cdk-lib/aws-cloudwatch/test/graphs.test.ts +++ b/packages/aws-cdk-lib/aws-cloudwatch/test/graphs.test.ts @@ -194,6 +194,7 @@ describe('Graphs', () => { 'fields @message', 'filter @message like /Error/', ], + accountId: '123456789', }); // THEN @@ -202,6 +203,7 @@ describe('Graphs', () => { width: 6, height: 6, properties: { + accountId: '123456789', view: 'table', region: { Ref: 'AWS::Region' }, query: `SOURCE '${logGroup.logGroupName}' | fields @message\n| filter @message like /Error/`, @@ -349,6 +351,7 @@ describe('Graphs', () => { width: 6, height: 6, properties: { + accountId: '123456789', view: 'timeSeries', region: { Ref: 'AWS::Region' }, annotations: { From ae87c0003411e3913123e70a08888b26599d4584 Mon Sep 17 00:00:00 2001 From: Sumu Date: Fri, 20 Sep 2024 12:50:46 -0400 Subject: [PATCH 04/10] update README Signed-off-by: Sumu --- packages/aws-cdk-lib/aws-cloudwatch/README.md | 26 ++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/packages/aws-cdk-lib/aws-cloudwatch/README.md b/packages/aws-cdk-lib/aws-cloudwatch/README.md index be53d4f3becdd..20d5d1213dd02 100644 --- a/packages/aws-cdk-lib/aws-cloudwatch/README.md +++ b/packages/aws-cdk-lib/aws-cloudwatch/README.md @@ -734,7 +734,7 @@ dashboard.addWidgets(new cloudwatch.LogQueryWidget({ queryLines: [ 'fields @message', 'filter @message like /Error/', - ] + ], })); ``` @@ -907,3 +907,27 @@ const dashboard = new cw.Dashboard(this, 'Dash', { ``` You can add a variable after object instantiation with the method `dashboard.addVariable()`. + +### Cross-Account Visibility + +Both Log and Metric Widget objects support cross-account visibility by allowing you to specify the AWS Account ID that the data (logs or metrics) originates from. For more information, see [Cross-Account Cross-Region CloudWatch Console](https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/Cross-Account-Cross-Region.html). + +To use this feature, you can set the `accountId` property on `LogQueryWidget`, `GraphWidget`, `AlarmWidget`, `SingleValueWidget`, and `GaugeWidget` constructs: + +```ts +declare const dashboard: cloudwatch.Dashboard; + +dashboard.addWidgets(new cloudwatch.GraphWidget({ + // ... + accountId: '123456789', +})); + +dashboard.addWidgets(new cloudwatch.LogQueryWidget({ + logGroupNames: ['my-log-group'], + // ... + accountId: '123456789', + queryLines: [ + 'fields @message', + ], +})); +``` \ No newline at end of file From 48e5acf64ad28fa88943f063bcc7cbbb6cc7e744 Mon Sep 17 00:00:00 2001 From: Sumu Date: Fri, 20 Sep 2024 12:51:11 -0400 Subject: [PATCH 05/10] newline at end of README Signed-off-by: Sumu --- packages/aws-cdk-lib/aws-cloudwatch/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/aws-cdk-lib/aws-cloudwatch/README.md b/packages/aws-cdk-lib/aws-cloudwatch/README.md index 20d5d1213dd02..e6bf359c69069 100644 --- a/packages/aws-cdk-lib/aws-cloudwatch/README.md +++ b/packages/aws-cdk-lib/aws-cloudwatch/README.md @@ -930,4 +930,4 @@ dashboard.addWidgets(new cloudwatch.LogQueryWidget({ 'fields @message', ], })); -``` \ No newline at end of file +``` From 4c2a23aa0c4daa36624715b0da1699237297c085 Mon Sep 17 00:00:00 2001 From: Sumu Date: Fri, 20 Sep 2024 13:22:09 -0400 Subject: [PATCH 06/10] update integ test and snapshots for: integ.math-alarm-and-dashboard.ts Signed-off-by: Sumu --- .../aws-cdk-cloudwatch.assets.json | 6 +-- .../aws-cdk-cloudwatch.template.json | 8 ++-- .../cdk.out | 2 +- ...efaultTestDeployAssertE31ECF03.assets.json | 2 +- .../integ.json | 2 +- .../manifest.json | 6 ++- .../tree.json | 40 +++++++++---------- .../test/integ.math-alarm-and-dashboard.ts | 4 ++ 8 files changed, 38 insertions(+), 32 deletions(-) diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.math-alarm-and-dashboard.js.snapshot/aws-cdk-cloudwatch.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.math-alarm-and-dashboard.js.snapshot/aws-cdk-cloudwatch.assets.json index c4b1e2c7a89c5..7d8a41ac05964 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.math-alarm-and-dashboard.js.snapshot/aws-cdk-cloudwatch.assets.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.math-alarm-and-dashboard.js.snapshot/aws-cdk-cloudwatch.assets.json @@ -1,7 +1,7 @@ { - "version": "30.0.0", + "version": "36.0.24", "files": { - "3601b785219c22585d4d73c03522e2370fb59de8b92f71e943a0a23904539e1d": { + "ade5062bc1ff5a7243892b361ab871882b9f0b696579ad63418729c5d8ff1f87": { "source": { "path": "aws-cdk-cloudwatch.template.json", "packaging": "file" @@ -9,7 +9,7 @@ "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "3601b785219c22585d4d73c03522e2370fb59de8b92f71e943a0a23904539e1d.json", + "objectKey": "ade5062bc1ff5a7243892b361ab871882b9f0b696579ad63418729c5d8ff1f87.json", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.math-alarm-and-dashboard.js.snapshot/aws-cdk-cloudwatch.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.math-alarm-and-dashboard.js.snapshot/aws-cdk-cloudwatch.template.json index 272ca8d614932..ad5f72ccfaf1a 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.math-alarm-and-dashboard.js.snapshot/aws-cdk-cloudwatch.template.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.math-alarm-and-dashboard.js.snapshot/aws-cdk-cloudwatch.template.json @@ -73,7 +73,7 @@ "Fn::Join": [ "", [ - "{\"widgets\":[{\"type\":\"metric\",\"width\":6,\"height\":6,\"x\":0,\"y\":0,\"properties\":{\"view\":\"timeSeries\",\"title\":\"Total messages in queue\",\"region\":\"", + "{\"widgets\":[{\"type\":\"metric\",\"width\":6,\"height\":6,\"x\":0,\"y\":0,\"properties\":{\"view\":\"timeSeries\",\"accountId\":\"123456789\",\"title\":\"Total messages in queue\",\"region\":\"", { "Ref": "AWS::Region" }, @@ -84,7 +84,7 @@ "Arn" ] }, - "\"]},\"yAxis\":{}}},{\"type\":\"metric\",\"width\":6,\"height\":6,\"x\":0,\"y\":6,\"properties\":{\"view\":\"timeSeries\",\"title\":\"More total messages in queue with alarm annotation\",\"region\":\"", + "\"]},\"yAxis\":{}}},{\"type\":\"metric\",\"width\":6,\"height\":6,\"x\":0,\"y\":6,\"properties\":{\"view\":\"timeSeries\",\"title\":\"More total messages in queue with alarm annotation\",\"accountId\":\"123456789\",\"region\":\"", { "Ref": "AWS::Region" }, @@ -116,7 +116,7 @@ "QueueName" ] }, - "\",{\"label\":\"NotVisible Messages\",\"period\":30,\"yAxis\":\"right\"}]],\"annotations\":{\"horizontal\":[{\"label\":\"Total Messages >= 100 for 3 datapoints within 3 minutes\",\"value\":100,\"yAxis\":\"left\"}]},\"yAxis\":{}}},{\"type\":\"metric\",\"width\":6,\"height\":6,\"x\":0,\"y\":12,\"properties\":{\"view\":\"pie\",\"title\":\"Percentage of messages in each queue as pie chart\",\"region\":\"", + "\",{\"label\":\"NotVisible Messages\",\"period\":30,\"yAxis\":\"right\"}]],\"annotations\":{\"horizontal\":[{\"label\":\"Total Messages >= 100 for 3 datapoints within 3 minutes\",\"value\":100,\"yAxis\":\"left\"}]},\"yAxis\":{}}},{\"type\":\"metric\",\"width\":6,\"height\":6,\"x\":0,\"y\":12,\"properties\":{\"view\":\"pie\",\"title\":\"Percentage of messages in each queue as pie chart\",\"accountId\":\"123456789\",\"region\":\"", { "Ref": "AWS::Region" }, @@ -134,7 +134,7 @@ "QueueName" ] }, - "\",{\"label\":\"NotVisible Messages\",\"period\":30}]],\"yAxis\":{},\"setPeriodToTimeRange\":true}},{\"type\":\"metric\",\"width\":6,\"height\":3,\"x\":0,\"y\":18,\"properties\":{\"view\":\"singleValue\",\"title\":\"Current total messages in queue\",\"region\":\"", + "\",{\"label\":\"NotVisible Messages\",\"period\":30}]],\"yAxis\":{},\"setPeriodToTimeRange\":true}},{\"type\":\"metric\",\"width\":6,\"height\":3,\"x\":0,\"y\":18,\"properties\":{\"view\":\"singleValue\",\"title\":\"Current total messages in queue\",\"accountId\":\"123456789\",\"region\":\"", { "Ref": "AWS::Region" }, diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.math-alarm-and-dashboard.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.math-alarm-and-dashboard.js.snapshot/cdk.out index ae4b03c54e770..4efaa16f29af9 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.math-alarm-and-dashboard.js.snapshot/cdk.out +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.math-alarm-and-dashboard.js.snapshot/cdk.out @@ -1 +1 @@ -{"version":"30.0.0"} \ No newline at end of file +{"version":"36.0.24"} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.math-alarm-and-dashboard.js.snapshot/cdkintegmathalarmanddashboardDefaultTestDeployAssertE31ECF03.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.math-alarm-and-dashboard.js.snapshot/cdkintegmathalarmanddashboardDefaultTestDeployAssertE31ECF03.assets.json index 8cceb53a7b32b..764423917bd18 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.math-alarm-and-dashboard.js.snapshot/cdkintegmathalarmanddashboardDefaultTestDeployAssertE31ECF03.assets.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.math-alarm-and-dashboard.js.snapshot/cdkintegmathalarmanddashboardDefaultTestDeployAssertE31ECF03.assets.json @@ -1,5 +1,5 @@ { - "version": "30.0.0", + "version": "36.0.24", "files": { "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { "source": { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.math-alarm-and-dashboard.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.math-alarm-and-dashboard.js.snapshot/integ.json index b1eacb011e7a4..9aaf2e5c74ac2 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.math-alarm-and-dashboard.js.snapshot/integ.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.math-alarm-and-dashboard.js.snapshot/integ.json @@ -1,5 +1,5 @@ { - "version": "30.0.0", + "version": "36.0.24", "testCases": { "cdk-integ-math-alarm-and-dashboard/DefaultTest": { "stacks": [ diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.math-alarm-and-dashboard.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.math-alarm-and-dashboard.js.snapshot/manifest.json index 98331c40c35f9..ebb5dd0fb8b84 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.math-alarm-and-dashboard.js.snapshot/manifest.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.math-alarm-and-dashboard.js.snapshot/manifest.json @@ -1,5 +1,5 @@ { - "version": "30.0.0", + "version": "36.0.24", "artifacts": { "aws-cdk-cloudwatch.assets": { "type": "cdk:asset-manifest", @@ -14,10 +14,11 @@ "environment": "aws://unknown-account/unknown-region", "properties": { "templateFile": "aws-cdk-cloudwatch.template.json", + "terminationProtection": false, "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}/3601b785219c22585d4d73c03522e2370fb59de8b92f71e943a0a23904539e1d.json", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/ade5062bc1ff5a7243892b361ab871882b9f0b696579ad63418729c5d8ff1f87.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", "additionalDependencies": [ @@ -79,6 +80,7 @@ "environment": "aws://unknown-account/unknown-region", "properties": { "templateFile": "cdkintegmathalarmanddashboardDefaultTestDeployAssertE31ECF03.template.json", + "terminationProtection": false, "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}", diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.math-alarm-and-dashboard.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.math-alarm-and-dashboard.js.snapshot/tree.json index 499e6882142e9..6fb6e011e5fba 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.math-alarm-and-dashboard.js.snapshot/tree.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.math-alarm-and-dashboard.js.snapshot/tree.json @@ -12,7 +12,7 @@ "id": "queue", "path": "aws-cdk-cloudwatch/queue", "constructInfo": { - "fqn": "@aws-cdk/core.CfnResource", + "fqn": "aws-cdk-lib.CfnResource", "version": "0.0.0" } }, @@ -87,13 +87,13 @@ } }, "constructInfo": { - "fqn": "@aws-cdk/aws-cloudwatch.CfnAlarm", + "fqn": "aws-cdk-lib.aws_cloudwatch.CfnAlarm", "version": "0.0.0" } } }, "constructInfo": { - "fqn": "@aws-cdk/aws-cloudwatch.Alarm", + "fqn": "aws-cdk-lib.aws_cloudwatch.Alarm", "version": "0.0.0" } }, @@ -111,7 +111,7 @@ "Fn::Join": [ "", [ - "{\"widgets\":[{\"type\":\"metric\",\"width\":6,\"height\":6,\"x\":0,\"y\":0,\"properties\":{\"view\":\"timeSeries\",\"title\":\"Total messages in queue\",\"region\":\"", + "{\"widgets\":[{\"type\":\"metric\",\"width\":6,\"height\":6,\"x\":0,\"y\":0,\"properties\":{\"view\":\"timeSeries\",\"accountId\":\"123456789\",\"title\":\"Total messages in queue\",\"region\":\"", { "Ref": "AWS::Region" }, @@ -122,7 +122,7 @@ "Arn" ] }, - "\"]},\"yAxis\":{}}},{\"type\":\"metric\",\"width\":6,\"height\":6,\"x\":0,\"y\":6,\"properties\":{\"view\":\"timeSeries\",\"title\":\"More total messages in queue with alarm annotation\",\"region\":\"", + "\"]},\"yAxis\":{}}},{\"type\":\"metric\",\"width\":6,\"height\":6,\"x\":0,\"y\":6,\"properties\":{\"view\":\"timeSeries\",\"title\":\"More total messages in queue with alarm annotation\",\"accountId\":\"123456789\",\"region\":\"", { "Ref": "AWS::Region" }, @@ -154,7 +154,7 @@ "QueueName" ] }, - "\",{\"label\":\"NotVisible Messages\",\"period\":30,\"yAxis\":\"right\"}]],\"annotations\":{\"horizontal\":[{\"label\":\"Total Messages >= 100 for 3 datapoints within 3 minutes\",\"value\":100,\"yAxis\":\"left\"}]},\"yAxis\":{}}},{\"type\":\"metric\",\"width\":6,\"height\":6,\"x\":0,\"y\":12,\"properties\":{\"view\":\"pie\",\"title\":\"Percentage of messages in each queue as pie chart\",\"region\":\"", + "\",{\"label\":\"NotVisible Messages\",\"period\":30,\"yAxis\":\"right\"}]],\"annotations\":{\"horizontal\":[{\"label\":\"Total Messages >= 100 for 3 datapoints within 3 minutes\",\"value\":100,\"yAxis\":\"left\"}]},\"yAxis\":{}}},{\"type\":\"metric\",\"width\":6,\"height\":6,\"x\":0,\"y\":12,\"properties\":{\"view\":\"pie\",\"title\":\"Percentage of messages in each queue as pie chart\",\"accountId\":\"123456789\",\"region\":\"", { "Ref": "AWS::Region" }, @@ -172,7 +172,7 @@ "QueueName" ] }, - "\",{\"label\":\"NotVisible Messages\",\"period\":30}]],\"yAxis\":{},\"setPeriodToTimeRange\":true}},{\"type\":\"metric\",\"width\":6,\"height\":3,\"x\":0,\"y\":18,\"properties\":{\"view\":\"singleValue\",\"title\":\"Current total messages in queue\",\"region\":\"", + "\",{\"label\":\"NotVisible Messages\",\"period\":30}]],\"yAxis\":{},\"setPeriodToTimeRange\":true}},{\"type\":\"metric\",\"width\":6,\"height\":3,\"x\":0,\"y\":18,\"properties\":{\"view\":\"singleValue\",\"title\":\"Current total messages in queue\",\"accountId\":\"123456789\",\"region\":\"", { "Ref": "AWS::Region" }, @@ -198,13 +198,13 @@ } }, "constructInfo": { - "fqn": "@aws-cdk/aws-cloudwatch.CfnDashboard", + "fqn": "aws-cdk-lib.aws_cloudwatch.CfnDashboard", "version": "0.0.0" } } }, "constructInfo": { - "fqn": "@aws-cdk/aws-cloudwatch.Dashboard", + "fqn": "aws-cdk-lib.aws_cloudwatch.Dashboard", "version": "0.0.0" } }, @@ -212,7 +212,7 @@ "id": "BootstrapVersion", "path": "aws-cdk-cloudwatch/BootstrapVersion", "constructInfo": { - "fqn": "@aws-cdk/core.CfnParameter", + "fqn": "aws-cdk-lib.CfnParameter", "version": "0.0.0" } }, @@ -220,13 +220,13 @@ "id": "CheckBootstrapVersion", "path": "aws-cdk-cloudwatch/CheckBootstrapVersion", "constructInfo": { - "fqn": "@aws-cdk/core.CfnRule", + "fqn": "aws-cdk-lib.CfnRule", "version": "0.0.0" } } }, "constructInfo": { - "fqn": "@aws-cdk/core.Stack", + "fqn": "aws-cdk-lib.Stack", "version": "0.0.0" } }, @@ -243,7 +243,7 @@ "path": "cdk-integ-math-alarm-and-dashboard/DefaultTest/Default", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.1.252" + "version": "10.3.0" } }, "DeployAssert": { @@ -254,7 +254,7 @@ "id": "BootstrapVersion", "path": "cdk-integ-math-alarm-and-dashboard/DefaultTest/DeployAssert/BootstrapVersion", "constructInfo": { - "fqn": "@aws-cdk/core.CfnParameter", + "fqn": "aws-cdk-lib.CfnParameter", "version": "0.0.0" } }, @@ -262,25 +262,25 @@ "id": "CheckBootstrapVersion", "path": "cdk-integ-math-alarm-and-dashboard/DefaultTest/DeployAssert/CheckBootstrapVersion", "constructInfo": { - "fqn": "@aws-cdk/core.CfnRule", + "fqn": "aws-cdk-lib.CfnRule", "version": "0.0.0" } } }, "constructInfo": { - "fqn": "@aws-cdk/core.Stack", + "fqn": "aws-cdk-lib.Stack", "version": "0.0.0" } } }, "constructInfo": { - "fqn": "@aws-cdk/integ-tests.IntegTestCase", + "fqn": "@aws-cdk/integ-tests-alpha.IntegTestCase", "version": "0.0.0" } } }, "constructInfo": { - "fqn": "@aws-cdk/integ-tests.IntegTest", + "fqn": "@aws-cdk/integ-tests-alpha.IntegTest", "version": "0.0.0" } }, @@ -289,12 +289,12 @@ "path": "Tree", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.1.252" + "version": "10.3.0" } } }, "constructInfo": { - "fqn": "@aws-cdk/core.App", + "fqn": "aws-cdk-lib.App", "version": "0.0.0" } } diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.math-alarm-and-dashboard.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.math-alarm-and-dashboard.ts index 60d97835b9d39..7b51dc2e3fbbd 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.math-alarm-and-dashboard.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.math-alarm-and-dashboard.ts @@ -51,6 +51,7 @@ const dashboard = new cloudwatch.Dashboard(stack, 'Dash', { dashboard.addWidgets(new cloudwatch.AlarmWidget({ title: 'Total messages in queue', alarm, + accountId: '123456789', })); dashboard.addWidgets(new cloudwatch.GraphWidget({ @@ -58,6 +59,7 @@ dashboard.addWidgets(new cloudwatch.GraphWidget({ left: [sumExpression], right: [metricA, metricB], leftAnnotations: [alarm.toAnnotation()], + accountId: '123456789', })); dashboard.addWidgets(new cloudwatch.GraphWidget({ @@ -65,11 +67,13 @@ dashboard.addWidgets(new cloudwatch.GraphWidget({ left: [metricA, metricB], view: cloudwatch.GraphWidgetView.PIE, setPeriodToTimeRange: true, + accountId: '123456789', })); dashboard.addWidgets(new cloudwatch.SingleValueWidget({ title: 'Current total messages in queue', metrics: [sumExpression], + accountId: '123456789', })); new IntegTest(app, 'cdk-integ-math-alarm-and-dashboard', { From d05f5affce86076a1060a2674d3ebe32eaeeb00e Mon Sep 17 00:00:00 2001 From: Sumu Date: Fri, 20 Sep 2024 13:29:48 -0400 Subject: [PATCH 07/10] update integ test and snapshot with accountId in LogQueryWidget (integ.alarm-and-dashboard.ts) Signed-off-by: Sumu --- .../aws-cdk-cloudwatch-alarms.assets.json | 6 ++-- .../aws-cdk-cloudwatch-alarms.template.json | 4 +-- .../cdk.out | 2 +- ...efaultTestDeployAssertD2D0B407.assets.json | 2 +- .../integ.json | 2 +- .../manifest.json | 6 ++-- .../tree.json | 36 +++++++++---------- .../test/integ.alarm-and-dashboard.ts | 2 ++ 8 files changed, 32 insertions(+), 28 deletions(-) diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.alarm-and-dashboard.js.snapshot/aws-cdk-cloudwatch-alarms.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.alarm-and-dashboard.js.snapshot/aws-cdk-cloudwatch-alarms.assets.json index 77c985c557eb7..3d464f6558ac6 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.alarm-and-dashboard.js.snapshot/aws-cdk-cloudwatch-alarms.assets.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.alarm-and-dashboard.js.snapshot/aws-cdk-cloudwatch-alarms.assets.json @@ -1,7 +1,7 @@ { - "version": "30.0.0", + "version": "36.0.24", "files": { - "8b034d9d120c7cc38051e76b8ef13c8d1d39695afe0a5a779edce36ae5596486": { + "c7796984c00a5cfc48ea6a815732171fde898776c7ce4591cb1a2310dd1367d3": { "source": { "path": "aws-cdk-cloudwatch-alarms.template.json", "packaging": "file" @@ -9,7 +9,7 @@ "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "8b034d9d120c7cc38051e76b8ef13c8d1d39695afe0a5a779edce36ae5596486.json", + "objectKey": "c7796984c00a5cfc48ea6a815732171fde898776c7ce4591cb1a2310dd1367d3.json", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.alarm-and-dashboard.js.snapshot/aws-cdk-cloudwatch-alarms.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.alarm-and-dashboard.js.snapshot/aws-cdk-cloudwatch-alarms.template.json index 840bdd623139e..e29f28bf92698 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.alarm-and-dashboard.js.snapshot/aws-cdk-cloudwatch-alarms.template.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.alarm-and-dashboard.js.snapshot/aws-cdk-cloudwatch-alarms.template.json @@ -7,7 +7,6 @@ "Type": "AWS::CloudWatch::Alarm", "Properties": { "ComparisonOperator": "GreaterThanOrEqualToThreshold", - "EvaluationPeriods": 3, "DatapointsToAlarm": 2, "Dimensions": [ { @@ -20,6 +19,7 @@ } } ], + "EvaluationPeriods": 3, "MetricName": "ApproximateNumberOfMessagesVisible", "Namespace": "AWS/SQS", "Period": 300, @@ -74,7 +74,7 @@ "QueueName" ] }, - "\"]]}},{\"type\":\"log\",\"width\":6,\"height\":6,\"x\":0,\"y\":20,\"properties\":{\"view\":\"table\",\"title\":\"Errors in my log group\",\"region\":\"", + "\"]]}},{\"type\":\"log\",\"width\":6,\"height\":6,\"x\":0,\"y\":20,\"properties\":{\"view\":\"table\",\"title\":\"Errors in my log group\",\"accountId\":\"123456789\",\"region\":\"", { "Ref": "AWS::Region" }, diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.alarm-and-dashboard.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.alarm-and-dashboard.js.snapshot/cdk.out index ae4b03c54e770..4efaa16f29af9 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.alarm-and-dashboard.js.snapshot/cdk.out +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.alarm-and-dashboard.js.snapshot/cdk.out @@ -1 +1 @@ -{"version":"30.0.0"} \ No newline at end of file +{"version":"36.0.24"} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.alarm-and-dashboard.js.snapshot/cdkcloudwatchalarmsintegtestDefaultTestDeployAssertD2D0B407.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.alarm-and-dashboard.js.snapshot/cdkcloudwatchalarmsintegtestDefaultTestDeployAssertD2D0B407.assets.json index eb5c6208f5d8a..42e3e1c958d31 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.alarm-and-dashboard.js.snapshot/cdkcloudwatchalarmsintegtestDefaultTestDeployAssertD2D0B407.assets.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.alarm-and-dashboard.js.snapshot/cdkcloudwatchalarmsintegtestDefaultTestDeployAssertD2D0B407.assets.json @@ -1,5 +1,5 @@ { - "version": "30.0.0", + "version": "36.0.24", "files": { "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { "source": { diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.alarm-and-dashboard.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.alarm-and-dashboard.js.snapshot/integ.json index 5490a0f0533fd..ed457a1ed78cb 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.alarm-and-dashboard.js.snapshot/integ.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.alarm-and-dashboard.js.snapshot/integ.json @@ -1,5 +1,5 @@ { - "version": "30.0.0", + "version": "36.0.24", "testCases": { "cdk-cloudwatch-alarms-integ-test/DefaultTest": { "stacks": [ diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.alarm-and-dashboard.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.alarm-and-dashboard.js.snapshot/manifest.json index 36f062e02ebbd..db4ef0d22f60c 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.alarm-and-dashboard.js.snapshot/manifest.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.alarm-and-dashboard.js.snapshot/manifest.json @@ -1,5 +1,5 @@ { - "version": "30.0.0", + "version": "36.0.24", "artifacts": { "aws-cdk-cloudwatch-alarms.assets": { "type": "cdk:asset-manifest", @@ -14,10 +14,11 @@ "environment": "aws://unknown-account/unknown-region", "properties": { "templateFile": "aws-cdk-cloudwatch-alarms.template.json", + "terminationProtection": false, "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}/8b034d9d120c7cc38051e76b8ef13c8d1d39695afe0a5a779edce36ae5596486.json", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/c7796984c00a5cfc48ea6a815732171fde898776c7ce4591cb1a2310dd1367d3.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", "additionalDependencies": [ @@ -79,6 +80,7 @@ "environment": "aws://unknown-account/unknown-region", "properties": { "templateFile": "cdkcloudwatchalarmsintegtestDefaultTestDeployAssertD2D0B407.template.json", + "terminationProtection": false, "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}", diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.alarm-and-dashboard.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.alarm-and-dashboard.js.snapshot/tree.json index 41d92ed3c6779..aa507044eb307 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.alarm-and-dashboard.js.snapshot/tree.json +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.alarm-and-dashboard.js.snapshot/tree.json @@ -12,7 +12,7 @@ "id": "queue", "path": "aws-cdk-cloudwatch-alarms/queue", "constructInfo": { - "fqn": "@aws-cdk/core.CfnResource", + "fqn": "aws-cdk-lib.CfnResource", "version": "0.0.0" } }, @@ -27,7 +27,6 @@ "aws:cdk:cloudformation:type": "AWS::CloudWatch::Alarm", "aws:cdk:cloudformation:props": { "comparisonOperator": "GreaterThanOrEqualToThreshold", - "evaluationPeriods": 3, "datapointsToAlarm": 2, "dimensions": [ { @@ -40,6 +39,7 @@ } } ], + "evaluationPeriods": 3, "metricName": "ApproximateNumberOfMessagesVisible", "namespace": "AWS/SQS", "period": 300, @@ -48,13 +48,13 @@ } }, "constructInfo": { - "fqn": "@aws-cdk/aws-cloudwatch.CfnAlarm", + "fqn": "aws-cdk-lib.aws_cloudwatch.CfnAlarm", "version": "0.0.0" } } }, "constructInfo": { - "fqn": "@aws-cdk/aws-cloudwatch.Alarm", + "fqn": "aws-cdk-lib.aws_cloudwatch.Alarm", "version": "0.0.0" } }, @@ -112,7 +112,7 @@ "QueueName" ] }, - "\"]]}},{\"type\":\"log\",\"width\":6,\"height\":6,\"x\":0,\"y\":20,\"properties\":{\"view\":\"table\",\"title\":\"Errors in my log group\",\"region\":\"", + "\"]]}},{\"type\":\"log\",\"width\":6,\"height\":6,\"x\":0,\"y\":20,\"properties\":{\"view\":\"table\",\"title\":\"Errors in my log group\",\"accountId\":\"123456789\",\"region\":\"", { "Ref": "AWS::Region" }, @@ -162,13 +162,13 @@ } }, "constructInfo": { - "fqn": "@aws-cdk/aws-cloudwatch.CfnDashboard", + "fqn": "aws-cdk-lib.aws_cloudwatch.CfnDashboard", "version": "0.0.0" } } }, "constructInfo": { - "fqn": "@aws-cdk/aws-cloudwatch.Dashboard", + "fqn": "aws-cdk-lib.aws_cloudwatch.Dashboard", "version": "0.0.0" } }, @@ -176,7 +176,7 @@ "id": "BootstrapVersion", "path": "aws-cdk-cloudwatch-alarms/BootstrapVersion", "constructInfo": { - "fqn": "@aws-cdk/core.CfnParameter", + "fqn": "aws-cdk-lib.CfnParameter", "version": "0.0.0" } }, @@ -184,13 +184,13 @@ "id": "CheckBootstrapVersion", "path": "aws-cdk-cloudwatch-alarms/CheckBootstrapVersion", "constructInfo": { - "fqn": "@aws-cdk/core.CfnRule", + "fqn": "aws-cdk-lib.CfnRule", "version": "0.0.0" } } }, "constructInfo": { - "fqn": "@aws-cdk/core.Stack", + "fqn": "aws-cdk-lib.Stack", "version": "0.0.0" } }, @@ -207,7 +207,7 @@ "path": "cdk-cloudwatch-alarms-integ-test/DefaultTest/Default", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.1.252" + "version": "10.3.0" } }, "DeployAssert": { @@ -218,7 +218,7 @@ "id": "BootstrapVersion", "path": "cdk-cloudwatch-alarms-integ-test/DefaultTest/DeployAssert/BootstrapVersion", "constructInfo": { - "fqn": "@aws-cdk/core.CfnParameter", + "fqn": "aws-cdk-lib.CfnParameter", "version": "0.0.0" } }, @@ -226,25 +226,25 @@ "id": "CheckBootstrapVersion", "path": "cdk-cloudwatch-alarms-integ-test/DefaultTest/DeployAssert/CheckBootstrapVersion", "constructInfo": { - "fqn": "@aws-cdk/core.CfnRule", + "fqn": "aws-cdk-lib.CfnRule", "version": "0.0.0" } } }, "constructInfo": { - "fqn": "@aws-cdk/core.Stack", + "fqn": "aws-cdk-lib.Stack", "version": "0.0.0" } } }, "constructInfo": { - "fqn": "@aws-cdk/integ-tests.IntegTestCase", + "fqn": "@aws-cdk/integ-tests-alpha.IntegTestCase", "version": "0.0.0" } } }, "constructInfo": { - "fqn": "@aws-cdk/integ-tests.IntegTest", + "fqn": "@aws-cdk/integ-tests-alpha.IntegTest", "version": "0.0.0" } }, @@ -253,12 +253,12 @@ "path": "Tree", "constructInfo": { "fqn": "constructs.Construct", - "version": "10.1.252" + "version": "10.3.0" } } }, "constructInfo": { - "fqn": "@aws-cdk/core.App", + "fqn": "aws-cdk-lib.App", "version": "0.0.0" } } diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.alarm-and-dashboard.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.alarm-and-dashboard.ts index d87824ecf37fd..7b76615c556f2 100644 --- a/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.alarm-and-dashboard.ts +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-cloudwatch/test/integ.alarm-and-dashboard.ts @@ -61,6 +61,8 @@ dashboard.addWidgets(new cloudwatch.SingleValueWidget({ })); dashboard.addWidgets(new cloudwatch.LogQueryWidget({ title: 'Errors in my log group', + // Setting an account ID just for this LogQueryWidget + accountId: '123456789', logGroupNames: ['my-log-group'], queryString: `fields @message | filter @message like /Error/`, From 311acfda0ecd1148650fb98c506bd9b380396e62 Mon Sep 17 00:00:00 2001 From: Sumu Date: Fri, 20 Sep 2024 13:42:05 -0400 Subject: [PATCH 08/10] undo FEATURE_FLAGS changes - accidentally committed Signed-off-by: Sumu --- packages/@aws-cdk/cx-api/FEATURE_FLAGS.md | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/packages/@aws-cdk/cx-api/FEATURE_FLAGS.md b/packages/@aws-cdk/cx-api/FEATURE_FLAGS.md index beadd60aa4ed2..634630f6e9b41 100644 --- a/packages/@aws-cdk/cx-api/FEATURE_FLAGS.md +++ b/packages/@aws-cdk/cx-api/FEATURE_FLAGS.md @@ -73,7 +73,6 @@ Flags come in three types: | [@aws-cdk/custom-resources:logApiResponseDataPropertyTrueDefault](#aws-cdkcustom-resourceslogapiresponsedatapropertytruedefault) | When enabled, the custom resource used for `AwsCustomResource` will configure the `logApiResponseData` property as true by default | 2.145.0 | (fix) | | [@aws-cdk/aws-s3:keepNotificationInImportedBucket](#aws-cdkaws-s3keepnotificationinimportedbucket) | When enabled, Adding notifications to a bucket in the current stack will not remove notification from imported stack. | 2.155.0 | (fix) | | [@aws-cdk/aws-stepfunctions-tasks:useNewS3UriParametersForBedrockInvokeModelTask](#aws-cdkaws-stepfunctions-tasksusenews3uriparametersforbedrockinvokemodeltask) | When enabled, use new props for S3 URI field in task definition of state machine for bedrock invoke model. | 2.156.0 | (fix) | -| [@aws-cdk/aws-ecs:reduceEc2FargateCloudWatchPermissions](#aws-cdkaws-ecsreduceec2fargatecloudwatchpermissions) | When enabled, we will only grant the necessary permissions when users specify cloudwatch log group through logConfiguration | 2.159.0 | (fix) | @@ -135,8 +134,7 @@ The following json shows the current recommended set of flags, as `cdk init` wou "@aws-cdk/aws-ec2:ebsDefaultGp3Volume": true, "@aws-cdk/aws-ecs:removeDefaultDeploymentAlarm": true, "@aws-cdk/custom-resources:logApiResponseDataPropertyTrueDefault": false, - "@aws-cdk/aws-s3:keepNotificationInImportedBucket": false, - "@aws-cdk/aws-ecs:reduceEc2FargateCloudWatchPermissions": true + "@aws-cdk/aws-s3:keepNotificationInImportedBucket": false } } ``` @@ -1380,22 +1378,4 @@ When this feature flag is enabled, specify newly introduced props 's3InputUri' a **Compatibility with old behavior:** Disable the feature flag to use input and output path fields for s3 URI -### @aws-cdk/aws-ecs:reduceEc2FargateCloudWatchPermissions - -*When enabled, we will only grant the necessary permissions when users specify cloudwatch log group through logConfiguration* (fix) - -Currently, we automatically add a number of cloudwatch permissions to the task role when no cloudwatch log group is -specified as logConfiguration and it will grant 'Resources': ['*'] to the task role. - -When this feature flag is enabled, we will only grant the necessary permissions when users specify cloudwatch log group. - - -| Since | Default | Recommended | -| ----- | ----- | ----- | -| (not in v1) | | | -| 2.159.0 | `false` | `true` | - -**Compatibility with old behavior:** Disable the feature flag to continue grant permissions to log group when no log group is specified - - From 71b3327bc16c9ecefef9eb088390ba79f833f18d Mon Sep 17 00:00:00 2001 From: Sumu Date: Fri, 20 Sep 2024 13:43:36 -0400 Subject: [PATCH 09/10] touchup README Signed-off-by: Sumu --- packages/aws-cdk-lib/aws-cloudwatch/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/aws-cdk-lib/aws-cloudwatch/README.md b/packages/aws-cdk-lib/aws-cloudwatch/README.md index e6bf359c69069..90a29b6c5bbdc 100644 --- a/packages/aws-cdk-lib/aws-cloudwatch/README.md +++ b/packages/aws-cdk-lib/aws-cloudwatch/README.md @@ -734,7 +734,7 @@ dashboard.addWidgets(new cloudwatch.LogQueryWidget({ queryLines: [ 'fields @message', 'filter @message like /Error/', - ], + ] })); ``` From 6698509bbc22ffb6e25a9361dc19fdc93d387aa3 Mon Sep 17 00:00:00 2001 From: Sumu Date: Mon, 30 Sep 2024 16:44:18 -0400 Subject: [PATCH 10/10] update doc comment for accountId prop Signed-off-by: Sumu --- packages/aws-cdk-lib/aws-cloudwatch/lib/graph.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/aws-cdk-lib/aws-cloudwatch/lib/graph.ts b/packages/aws-cdk-lib/aws-cloudwatch/lib/graph.ts index 0c56f03d652f1..66a0b0037e980 100644 --- a/packages/aws-cdk-lib/aws-cloudwatch/lib/graph.ts +++ b/packages/aws-cdk-lib/aws-cloudwatch/lib/graph.ts @@ -18,7 +18,8 @@ export interface MetricWidgetProps { /** * Account ID for the metrics of this widget * - * @default - None + * @default - If no accountId is specified, the current account is used as the default. + * @see https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/CloudWatch-Dashboard-Body-Structure.html#CloudWatch-Dashboard-Properties-Metric-Widget-Object */ readonly accountId?: string;