@@ -1194,6 +1194,28 @@ locations for a given environment. Resource locations are in the format
11941194resource currently deployed, while the destination must refer to a location
11951195that is not already occupied by any resource.
11961196
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.
11971219
11981220#### Limitations
11991221- A refactor cannot leave a stack empty. This is a CloudFormation API limitation,
0 commit comments