How do I resolve the "Attribute 'Key' does not exist" error when I use the Fn::GetAtt function on my resource provider resource in AWS CloudFormation?

Last updated: 2020-08-17

I receive the "Attribute 'Key' does not exist" error when I use the Fn::GetAtt function on my resource provider resource in AWS CloudFormation. How can I resolve this error?

Short description

You receive the "Attribute 'Key' does not exist" error when the ReadHandler of your resource doesn't return a property specified from the list readOnlyProperties in the resource provider schema file organization-service-resource.json. AWS CloudFormation returns this error because it isn't receiving the required property.

If you're having issues with other errors related to using a resource provider, see the following articles for additional troubleshooting steps:

Resolution

1.    In your organization-service-resource.json file, confirm that the readOnlyProperties definition follows this format, where Output is a property defined in the properties section. For example:

"readOnlyProperties": [
    "/properties/Output"
],

Note: The resource provider schema file is a JSON file in the organization-service-resource.json format and is located in the root directory of your project.

2.    In your ReadHandler, set the property (in the follow example, Output) in the model object. For example:

final ResourceModel model = request.getDesiredResourceState();
model.setOutput("abcdxyz");
return ProgressEvent.<ResourceModel, CallbackContext>builder()
    .resourceModel(model)
    .status(OperationStatus.SUCCESS)
    .build();

Did this article help?


Do you need billing or technical support?