How come the intrinsic cloudformation function !ImportValue does not resolve to a string when I place it in a Join function within the definitionbody of my serverless api template?
This cloudformation template:
UserAPI:
Type: 'AWS::Serverless::Api'
Properties:
StageName: !ImportValue StageName
DefinitionBody:
'Fn::Transform':
Name: 'AWS::Include'
Parameters:
Location: !Join [ "", [ "s3://", !ImportValue S3APIBucket, "/api_user.yaml" ] ]
Will generate the following error:
Failed to create the changeset: Waiter ChangeSetCreateComplete failed: Waiter encountered a terminal failure state Status: FAILED. Reason: The value of parameter Location under transform Include must resolve to a string, number, boolean or a list of any of these.
However, if I replace the last line with:
Location: !Join [ "", [ "s3://", !Ref S3APIBucket, "/api_user.yaml" ] ]
And have S3APIBucket as a parameter it works fine. Or otherwise don't use !Join and just hardcode the s3 bucket name, that also works fine.