# this fails with `AttributeError: 'NoneType' object has no attribute 'Identifier'`
model = request.desiredResourceState
model.Identifier = identifier_utils.generate_resource_identifier(
request.stackId, request.logicalResourceIdentifier,
request.clientRequestToken, 255
)
# this works
model = request.desiredResourceState if request.desiredResourceState else ResourceModel(Identifier=None)
model.Identifier = identifier_utils.generate_resource_identifier(
request.stackId, request.logicalResourceIdentifier,
request.clientRequestToken, 255
)
This is not technically against the type annotations, but it would be nice if this wasn't the case.
Some snippets to test this with:
Schema:
handlers.py inside of the create handler
I believe this can be solved by changing this code in resource.py
from
to
This probably also applies to previousResourceState and maybe even to the Tag-related properties