Files
floci/src/main/java
Hector Ventura 03a2d969f2 fix(cloudformation): replace IAM InstanceProfile on a createOnly change (#4133)
AWS::IAM::InstanceProfile rejected any createOnly change on UpdateStack (a name
or Path change threw ValidationError). Both InstanceProfileName and Path are
createOnly, so a change should replace the profile.

- A rename creates the new profile under the new name; dropping the explicit
  name mints a generated one; a Path change on an auto-named profile mints a
  fresh name so the replacement does not collide with the profile it displaces.
  The old profile is deleted once the update commits, or restored on rollback,
  via ReplacementCleanup, the same path Ec2Instance uses.
- Whether the profile was created under an explicit name is recorded at create
  time in a __Floci attribute (filtered from the published ones), not inferred
  from the id's shape: a generated name loses its <stack>-<logicalId> prefix
  past 128 characters, so a shape check would have replaced every auto-named
  profile of a long-named stack on each update. A prior profile with no record
  is kept.
- A Path change that keeps an explicit name is attempted with that same name, so
  CreateInstanceProfile collides and IAM answers EntityAlreadyExists, exactly as
  CloudFormation surfaces that update, rather than being rejected up front.
2026-09-22 20:27:13 -04:00
..