aws-cloudformation / cloudformation-cli-go-plugin

The CloudFormation Provider Development Toolkit Go Plugin allows you to autogenerate Go code based on an input schema.
52 stars 31 forks source link

Accessing primaryIdentifier in stack Outputs? #207

Closed msummers-nr closed 2 years ago

msummers-nr commented 2 years ago

I have a readOnlyProperties primaryIdentifier (Guid) I'm trying to access in a stack's Outputs:

Outputs:
  CustomResourceAttribute1:
    Value: !GetAtt  Resource1.Guid

The stack fails with

Unable to retrieve Guid attribute for NewRelic::CloudFormation::Workloads, with error message Unable to complete request: runtime error: invalid memory address or nil pointer dereference. Rollback requested by user.

If I remove the Outputs section the stack completes successfully and the resource is created.

FWIW the custom resource passes the test-type tests without any problem.

Any pointers or suggestions would be appreciated.

brianterry commented 2 years ago

HI! Are you returning the Guid in the read handler?

msummers-nr commented 2 years ago

All handlers return the guid, it's the primary identifier. Contract tests fail if I don't return the guid, which is just as well as it's needed in subsequent stack steps

msummers-nr commented 2 years ago

The root cause here was bad code. The resource passed the Contract tests however that is not a guarantee of CF compatibility.