Why is following format not working giving error "the attribute in Fn::ImportValue must be a string or a function that returns a string"?
Source: !Join [":", [!ImportValue [!Sub "${ProductEnvironment}-${ProductName}-IngressGreengrassProxyFunctionArn"], !ImportValue [!Sub "${ProductEnvironment}-${ProductName}-IngressGreengrassProxyFunctionAlias"]]]
but it works if I rewrite it as:
Source: !Join
- ":"
- - Fn::ImportValue: !Sub "${ProductEnvironment}-${ProductName}-IngressGreengrassProxyFunctionArn"
- Fn::ImportValue: !Sub "${ProductEnvironment}-${ProductName}-IngressGreengrassProxyFunctionAlias"
CodePudding user response:
The docs explain:
You can't use the short form of !ImportValue when it contains a !Sub.
AWS does not provide details of its internal implementations, why they implemented ImportValue
this way.