You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(cli): support CloudFormation simplified resource import (#32676)
### Issue # (if applicable)
Closes#28060.
### Reason for this change
This feature allows to automatically import exsting resources with the same physical name, such as S3 bucket, DDB table, etc, during a CFn deployment.
Because resource import is a vital feature for CDK users e.g. to refactor a construct tree, cdk migrate, etc, it would benefit many potential users if cdk natively support it.
### Description of changes
This PR adds a CLI option --import-exsting-resources: boolean to cdk deploy command and pass it to createChangeSet API call.
### Description of how you validated changes
Added a cli integ test.
### Checklist
- [X] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md)
Co-authored-by: Masashi Tomooka [[email protected]](mailto:[email protected])
----
*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Only resources that have custom names can be imported using `--import-existing-resources`.
429
+
For more information, see [name type](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-name.html).
430
+
To import resources that do not accept custom names, such as EC2 instances,
431
+
use the `cdk import` instead.
432
+
Visit [Bringing existing resources into CloudFormation management](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/resource-import.html)
433
+
for more details.
434
+
400
435
#### Ignore No Stacks
401
436
402
437
You may have an app with multiple environments, e.g., dev and prod. When starting
@@ -619,6 +654,11 @@ To import an existing resource to a CDK stack, follow the following steps:
619
654
5. When `cdk import` reports success, the resource is managed by CDK. Any subsequent
620
655
changes in the construct configuration will be reflected on the resource.
621
656
657
+
NOTE: You can also import existing resources by passing `--import-existing-resources` to `cdk deploy`.
658
+
This parameter only works for resources that support custom physical names,
659
+
such as S3 Buckets, DynamoDB Tables, etc...
660
+
For more information, see [Request Parameters](https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_CreateChangeSet.html#API_CreateChangeSet_RequestParameters).
661
+
622
662
#### Limitations
623
663
624
664
This feature currently has the following limitations:
0 commit comments