Skip to content

core(cli): hotswap to be more tolerant of the Fn::ImportValue usage #21320

Closed
@huyphan

Description

Describe the feature

The CDK CLI will refuse to hotswap a resource if its definition contains the intrinsic function Fn::Import.

Could not perform a hotswap deployment, because the CloudFormation template could not be resolved: CloudFormation function Fn::ImportValue is not supported

This is because the hotswap feature needs the template to be fully resolved in order to correctly determine the changes; and Fn::ImportValue is not supported by CDK's resolver function.

The hotswap feature should be more tolerant of the Fn::ImportValue usage. It should accept the case where Fn::ImportValue is use and the import name has not changed. This is the case where we can safely assume that the value will not change (thanks to CloudFormation's protection around exported/imported names). To be more specific on the expected behavior:

  • If the imported value needs to be used in the request of the hotswap operation, CDK should try to fetch the value
  • If the imported value does not need to be in the request, CDK can just ignore it.

Use Case

Fn::ImportValue is commonly used by CDK applications. Some users may be using it without knowing it. But as soon as their template uses this intrinsic function, hotswap will stop working.

Proposed Solution

No response

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

CDK version used

2.33.0 (build 859272d)

Environment details (OS name and version, etc.)

Darwin Kernel Version 21.6.0

Metadata

Assignees

No one assigned

    Labels

    @aws-cdk/coreRelated to core CDK functionalityeffort/mediumMedium work item – several days of effortfeature-requestA feature should be added or improved.p1

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions