I have cloudformation template.json, and I want to add custom rule for "DeletionPolicy" attribute for a specific value which is "Retain" for a specific resource e.g EC2 or Route53
custom_rules.txt file, each rule in a single line:
AWS::EC2::Instance InstanceType NOT_EQUALS "m4.16xlarge" WARN "This is an expensive instance type, use t2.micro instead"
AWS::EC2::Instance DeletionPolicy NOT_EQUALS "Delete" ERROR "You should set DeletionPolicy to Retain"
I am aware of the custom rule format :
<Resource Type> <Property[*]> <Operator> <Value> [Error Level] [Custom Error Message]
and I know that "DeletionPolicy" is not a property on the Properties object of a resource.
How is it possible to make the DeletionPolicy custom rule work?
when I run cfn-lint I only get warning about the instance type and nothing about the DeletionPolicy value
W9001 This is an expensive instance type, use t2.micro instead
Instead as a desired outcome I should get :
W9001 This is an expensive instance type, use t2.micro insteadE12345 You should set DeletionPolicy to Retain
cfn-lint 0.86.4
I have cloudformation template.json, and I want to add custom rule for "DeletionPolicy" attribute for a specific value which is "Retain" for a specific resource e.g EC2 or Route53
and I have
.cfnlintrc
andcustom_rules.txt
files in the rootcustom_rules.txt file, each rule in a single line:
I am aware of the custom rule format :
<Resource Type> <Property[*]> <Operator> <Value> [Error Level] [Custom Error Message]
and I know that "DeletionPolicy" is not a property on the Properties object of a resource. How is it possible to make the DeletionPolicy custom rule work? when I runcfn-lint
I only get warning about the instance type and nothing about the DeletionPolicy valueW9001 This is an expensive instance type, use t2.micro instead
Instead as a desired outcome I should get :W9001 This is an expensive instance type, use t2.micro instead
E12345 You should set DeletionPolicy to Retain