You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CFTG's type safety starts causing problems when trying to reference one template as a stack inside another. An example of this is if you want to have your core VPC structure in one template, include that as a AWS::CloudFormation::Stack, and then put instances into the VPC's subnets from your main template.
To do this in regular CFN, you would expose the subnet IDs as Outputs in the VPC template, and then reference them with a GetAtt, such as like this:
However, our implementation of AWS::EC2::Instance expects Subnet ID as follows:
SubnetId: Token[ResourceRef[`AWS::EC2::Subnet`]]
Our implementation of Fn::GetAtt is typed only to String, so we can't pass it in as something that meets the AWS::EC2::Subnet criteria.
This is an issue throughout the library -- anywhere where you may want to reference something from a parent template, if that resource's parameter is typed, you're out of luck. There's an assumption in the library that you're going to reference something you've defined within the template, and thus you'll have a typed reference to pass in. That's no longer the case when we start nesting and want to reference things with GetAtt
Of course none of this is a problem in CloudFormation itself, since all of this serializes down to simple strings in the JSON output. This is just an issue with our stronger typing.
The text was updated successfully, but these errors were encountered:
One way to solve this would be to do what Fn::FindInMap does and accept a type parameter. Rather than change the existing GetAtt, we could add a new Fn::GetAttFromStack that does this. It could also automatically add in the Output. prefix to the output from the nested stack as well, as described here: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-stack.html
CFTG's type safety starts causing problems when trying to reference one template as a stack inside another. An example of this is if you want to have your core VPC structure in one template, include that as a
AWS::CloudFormation::Stack
, and then put instances into the VPC's subnets from your main template.To do this in regular CFN, you would expose the subnet IDs as Outputs in the VPC template, and then reference them with a
GetAtt
, such as like this:However, our implementation of
AWS::EC2::Instance
expects Subnet ID as follows:Our implementation of
Fn::GetAtt
is typed only toString
, so we can't pass it in as something that meets theAWS::EC2::Subnet
criteria.This is an issue throughout the library -- anywhere where you may want to reference something from a parent template, if that resource's parameter is typed, you're out of luck. There's an assumption in the library that you're going to reference something you've defined within the template, and thus you'll have a typed reference to pass in. That's no longer the case when we start nesting and want to reference things with
GetAtt
Of course none of this is a problem in CloudFormation itself, since all of this serializes down to simple strings in the JSON output. This is just an issue with our stronger typing.
The text was updated successfully, but these errors were encountered: