To restrict the attribute PathPart as a read-only property in AWS CloudFormation, you can use the UpdateReplacePolicy attribute in the resource definition. This attribute specifies what action to take if a modification is attempted on the attribute.
To set the attribute as read-only, you can set the UpdateReplacePolicy to Retain. This will prevent any modifications to the attribute during updates or replacements of the resource.
Here's an example:
"Resources": {
"MyApiGatewayResource": {
"Type": "AWS::ApiGateway::Resource",
"Properties": {
"RestApiId": {"Ref": "MyRestApi"},
"ParentId": {"Fn::GetAtt": ["MyApiGatewayResourceParent", "Id"]},
"PathPart": "myPathPart"
},
"UpdateReplacePolicy": "Retain"
}
}
In this example, the attribute PathPart is set as "myPathPart" and the UpdateReplacePolicy is set as "Retain". This will make the attribute read-only during updates or resource replacements.
Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss
Asked: 2023-05-20 17:00:52 +0000
Seen: 8 times
Last updated: May 20 '23