Skip to content

Conversation

@yasomaru
Copy link
Contributor

@yasomaru yasomaru commented Dec 25, 2025

Issue # (if applicable)

Closes #36499

Reason for this change

Description of changes

Expose managedStorageConfiguration property on the ICluster interface, following the same pattern as executeCommandConfiguration.

Changes:

  • Add managedStorageConfiguration to ICluster interface
  • Add managedStorageConfiguration to ClusterAttributes interface
  • Add public getter to Cluster class
  • Implement property in ImportedCluster class
  • Add unit tests

Description of how you validated changes

  • Added unit tests for both Cluster and ImportedCluster
  • Ran npx tsc --noEmit - no type errors
  • Ran npx jest -t "managedStorageConfiguration" - all tests pass

Checklist


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@aws-cdk-automation aws-cdk-automation requested a review from a team December 25, 2025 12:13
@github-actions github-actions bot added feature-request A feature should be added or improved. p2 beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK labels Dec 25, 2025
Copy link
Collaborator

@aws-cdk-automation aws-cdk-automation left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(This review is outdated)

…sters

- Updated the `fromClusterAttributes` method to accept `managedStorageConfiguration` including a KMS key.
- Enhanced the integration test to verify the accessibility of `managedStorageConfiguration` on imported clusters.
- Updated documentation to reflect the new capability of importing clusters with managed storage configuration.
@aws-cdk-automation aws-cdk-automation dismissed their stale review December 25, 2025 13:18

✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.

@github-actions
Copy link
Contributor

github-actions bot commented Dec 25, 2025

⚠️ Experimental Feature: This security report is currently in experimental phase. Results may include false positives and the rules are being actively refined.
Please try merge from main to avoid findings unrelated to the PR.


TestsPassed ✅SkippedFailed
Security Guardian Results25 ran25 passed
TestResult
No test annotations available

@github-actions
Copy link
Contributor

github-actions bot commented Dec 25, 2025

⚠️ Experimental Feature: This security report is currently in experimental phase. Results may include false positives and the rules are being actively refined.
Please try merge from main to avoid findings unrelated to the PR.


TestsPassed ✅SkippedFailed
Security Guardian Results with resolved templates25 ran25 passed
TestResult
No test annotations available

@aws-cdk-automation aws-cdk-automation added the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Dec 25, 2025
Copy link
Contributor

@badmintoncryer badmintoncryer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution!!

I'm still unclear about the purpose of adding managedStorageConfiguration as an argument to fromAttributes().
In the case of executeCommandConfiguration, it's included as an argument because it's required by the permission-granting function in base-service.ts.

Is there a similar intention to add permission-granting functions for managedStorageConfiguration in the future?

Or is the goal simply to enable cross-stack references, instead of passing the KMS key directly, you pass the imported cluster and retrieve the KMS key from it? Is that the correct understanding?

Comment on lines 48 to 52
// Verify that managedStorageConfiguration is accessible on imported cluster
if (!importedCluster.managedStorageConfiguration) {
throw new Error('managedStorageConfiguration should be defined on imported cluster');
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test is not executed in integ test normally. I think it is enough to remove these lines.

Suggested change
// Verify that managedStorageConfiguration is accessible on imported cluster
if (!importedCluster.managedStorageConfiguration) {
throw new Error('managedStorageConfiguration should be defined on imported cluster');
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! Fixed.

@aws-cdk-automation aws-cdk-automation removed the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Dec 30, 2025
@badmintoncryer
Copy link
Contributor

The implementation itself seems good, so I'm planning to approve after understanding the background!

@yasomaru
Copy link
Contributor Author

@badmintoncryer
Thank you for the review!

You're absolutely right about the similar pattern to executeCommandConfiguration. The primary purpose of adding managedStorageConfiguration to fromClusterAttributes() is to enable cross-stack references.

When users import a cluster from another stack, they may need to access the managed storage configuration, particularly the KMS key, for

  • Granting proper permissions to tasks that use managed storage
  • Ensuring consistent encryption settings across stacks
  • Referencing the same KMS key without passing it separately

So yes, your understanding is correct: instead of passing the KMS key directly, users can pass the imported cluster and retrieve the KMS key from it via cluster.managedStorageConfiguration?.kmsKey.

While there's no immediate plan to add automatic permission-granting functions specifically for managedStorageConfiguration in base-service.ts, having this available in imported clusters provides the flexibility for users to manually grant necessary permissions if needed.

Copy link
Contributor

@badmintoncryer badmintoncryer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your clarification!

@aws-cdk-automation aws-cdk-automation added the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Dec 30, 2025
Copy link
Contributor

@badmintoncryer badmintoncryer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I forgot to add a minor comment.

Comment on lines 113 to 114
declare const vpc: ec2.Vpc;
declare const key: kms.Key;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can use interface of constructs.

Suggested change
declare const vpc: ec2.Vpc;
declare const key: kms.Key;
declare const vpc: ec2.IVpc;
declare const key: kms.IKey;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK feature-request A feature should be added or improved. p2 pr/needs-maintainer-review This PR needs a review from a Core Team Member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

(ecs): expose managedStorageConfiguration on ICluster interface

3 participants