Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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.