aws-cdk 2.1028.0 → 2.1029.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1131,13 +1131,17 @@ apply the refactor on your CloudFormation stacks. But for now, only the dry-run
1131
1131
  mode is supported.
1132
1132
 
1133
1133
  If your application has more than one stack, and you want the `refactor`
1134
- command to consider only a subset of them, you can pass a list of stack
1135
- patterns as a parameter:
1134
+ command to consider only a subset of them, you can specify the stacks you
1135
+ want, both local and deployed:
1136
1136
 
1137
1137
  ```shell
1138
- $ cdk refactor Web* --unstable=refactor --dry-run
1138
+ $ cdk refactor --local-stack Foo --local-stack Bar --deployed-stack Foo --unstable=refactor --dry-run
1139
1139
  ```
1140
1140
 
1141
+ This is useful if, for example, you have more than one CDK application deployed
1142
+ to a given environment, and you want to only include the deployed stacks that
1143
+ belong to the application that you are refactoring.
1144
+
1141
1145
  The pattern language is the same as the one used in the `cdk deploy` command.
1142
1146
  However, unlike `cdk deploy`, in the absence of this parameter, all stacks are
1143
1147
  considered.
@@ -1190,6 +1194,34 @@ locations for a given environment. Resource locations are in the format
1190
1194
  resource currently deployed, while the destination must refer to a location
1191
1195
  that is not already occupied by any resource.
1192
1196
 
1197
+ #### How resources are compared
1198
+
1199
+ To determine if a resource was moved or renamed, the CLI computes a digest
1200
+ for each resource, both in the deployed stacks and in the local stacks, and
1201
+ then compares the digests.
1202
+
1203
+ Conceptually, the digest is computed as:
1204
+
1205
+ ```
1206
+ digest(resource) = hash(type + properties + dependencies.map(d))
1207
+ ```
1208
+
1209
+ where hash is a cryptographic hash function. In other words, the digest of a
1210
+ resource is computed from its type, its own properties (that is, excluding
1211
+ properties that refer to other resources), and the digests of each of its
1212
+ dependencies. The digest of a resource, defined recursively this way, remains
1213
+ stable even if one or more of its dependencies gets renamed. Since the
1214
+ resources in a CloudFormation template form a directed acyclic graph, this
1215
+ function is well-defined.
1216
+
1217
+ Resources that have the same digest, but different locations, are considered to be
1218
+ the same resource, and therefore to have been moved or renamed.
1219
+
1220
+ #### Limitations
1221
+ - A refactor cannot leave a stack empty. This is a CloudFormation API limitation,
1222
+ that also applies to deployments.
1223
+ - Creation of new stacks during a refactor is not supported. If you need to
1224
+ create a new stack, do it in a separate deployment, previous to refactoring.
1193
1225
 
1194
1226
  ### `cdk drift`
1195
1227