I am trying to adapt my DeletionPolicy in my CloudFormation template:
"DeletionPolicy":{
"Fn::If":[
"ShouldRetain",
"Retain",
"Delete"
]
}
Though I get:
Template format error: Every DeletionPolicy member must be a string.
You use the Ref intrinsic function to reference a parameter, and AWS CloudFormation uses the parameter's value to provision the stack. You can reference parameters from the Resources and Outputs sections of the same template.
To import existing resources into a CloudFormation stack, you need to provide: A template that describes the entire stack, including both the resources to import and (for existing stacks) the resources that are already part of the stack. Each resource to import must have a DeletionPolicy attribute in the template.
To update a AWS CloudFormation stack (console)In the AWS CloudFormation console , from the list of stacks, select the running stack that you want to update. In the stack details pane, choose Update. If you haven't modified the stack template, select Use current template, and then choose Next.
To create a change set (console)In the AWS CloudFormation console , in Stacks, choose the running stack for which you want to create a change set. In the stack details pane, choose Stack actions, and then choose Create change set for current stack.
Unfortunately, the "DeletionPolicy" parameter must take a string literal only. Anything that resolve to a string such as from mapping or parameters is not possible. This is limitation from AWS.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With