mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 01:12:48 -05:00
chore(cloudformation): reuse the launch configuration replacement decision (#8664)
Use the shared replacement decision for launch configurations, removing the duplicate ADDED guard now that #8471 makes an added create-only value require replacement for every resource type. The unit fixture derives that decision instead of forcing the obsolete false result. Also make the negative card-validation fixture deterministic: it generates the valid value and changes its first digit, instead of a fixed 999 that could match the CVV for the randomly generated key.
This commit is contained in:
1 parent
47466ca6a8
commit
bab6428f78
3 files changed
+20
-27
No files matched your search
+1
-14
@@ -211,7 +211,7 @@ public class AutoScalingGroupCfnProvisioner implements CfnResourceProvisioner {
|
||||
n -> requireLaunchConfiguration(region, n));
|
||||
if (ctx.isUpdate()) {
|
||||
ReplacementCleanup.endRollbackRetry(r);
|
||||
if (!launchConfigurationRequiresReplacement(props, ctx)
|
||||
if (!ctx.changes(LAUNCH_CONFIGURATION, props).requiresReplacement()
|
||||
&& ctx.reusesPriorEntity(name) && prior != null) {
|
||||
return;
|
||||
}
|
||||
@@ -236,19 +236,6 @@ public class AutoScalingGroupCfnProvisioner implements CfnResourceProvisioner {
|
||||
ReplacementCleanup.record(r, ctx, before);
|
||||
}
|
||||
|
||||
private static boolean launchConfigurationRequiresReplacement(JsonNode props, ProvisionContext ctx) {
|
||||
PropertyChanges changes = ctx.changes(LAUNCH_CONFIGURATION, props);
|
||||
if (changes.requiresReplacement()) {
|
||||
return true;
|
||||
}
|
||||
if (ctx.priorProperties() == null) {
|
||||
return false;
|
||||
}
|
||||
// The shared replacement flag currently omits newly added create-only properties.
|
||||
return changes.byName().values().stream()
|
||||
.anyMatch(change -> change.createOnly() && change.kind() == PropertyChanges.Kind.ADDED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasReplacementUpdate(StackResource resource) {
|
||||
return LAUNCH_CONFIGURATION.equals(resource.getResourceType()) && ReplacementCleanup.hasReplacement(resource);
|
||||
|
||||
Reference in new issue
Block a user