feat(cloudwatch): add cross-account support for LogQueryWidget #33925
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue #26105
Closes #26105.
Reason for this change
CloudWatch dashboards support cross-account log queries, but the CDK's LogQueryWidget doesn't provide a way to specify the account ID. This change adds support for cross-account log queries in CloudWatch dashboards through the LogQueryWidget.
Description of changes
account
property to theLogQueryWidgetProps
interfaceaccountId
property in the widget properties when an account is specifiedThis change enables users to create CloudWatch dashboards that include log queries from different AWS accounts, which is useful for organizations with multiple accounts or those using AWS Organizations.
Describe any new or updated permissions being added
No new IAM permissions are being added in the CDK code itself. However, users will need to ensure they have the appropriate cross-account permissions set up for CloudWatch Logs queries to work correctly. This is mentioned in the JSDoc comments for the new property.
Description of how you validated changes
Added three new unit tests that verify:
accountId
property is correctly included when an account is specifiedaccountId
property is not included when no account is specifiedChecklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license