Skip to content

Possible gap: replacement detection only inspects PolicyAction, not Replacement #1971

Description

@sanjanaravikumar-az

findReplacements in packages/@aws-cdk/toolkit-lib/lib/api/deployments/deploy-stack.ts decides whether a change set contains a replacement from ResourceChange.PolicyAction alone, never consulting ResourceChange.Replacement. It has been that way since the initial commit. That predicate gates the --no-rollback replacement prompt and the Express Mode guard in #1969, so a replacement reported without a policy action would not be gated.

The gap is theoretical so far: no real change set with Replacement: "True" and no PolicyAction has been observed. Describing a real change set for the replacing change in #1931 gives both fields, so existing detection covered #1931 — which is why widening it was left out of #1969.

"PolicyAction": "ReplaceAndDelete",
"LogicalResourceId": "TaskDef54694570",
"ResourceType": "AWS::ECS::TaskDefinition",
"Replacement": "True"

Worth establishing whether such a change set can be produced at all — an explicit DeletionPolicy: Retain, or a resource type without a deletion policy, are the candidates. If it can, widen to || change.Replacement === 'True'. Any fix must keep Replacement: "Conditional" excluded: CDKMetadata reports it on essentially every CDK deployment, so gating it would gate almost every express deployment.

#NNNN here means aws/aws-cdk-cli; note aws/aws-cdk#1931 is an unrelated closed issue.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions