Reputation: 179
I'm trying to figure out how to pass output of a CloudFormation stack as a parameter to another CloudFormation stack, particularly via the Parameters section of the CloudFormation definition.
Say StackA is exporting an output :-
Outputs:
TargetGroupArn:
Description: "Target Group ARN"
Export: {Name: TargetGroupArn}
Value: {Ref: TargetGroup}
Can StackB contain a parameter in it's definition :-
Parameters:
TargetGroupArn:
Type: String
Default:
Fn::ImportValue: TargetGroupArn
Note: I'm aware that TargetGroupArn
can be fetched wherever required in the Resources section via Fn::ImportValue
. I'm specifically interested in importing in the parameters section.
Upvotes: 1
Views: 296
Reputation: 8562
No, you cannot import the value as the parameter default.
As per the documentation (emphasis added),
You can use intrinsic functions only in specific parts of a template. Currently, you can use intrinsic functions in resource properties, outputs, metadata attributes, and update policy attributes. You can also use intrinsic functions to conditionally create stack resources.
Parameters are not one of the parts that allow the use of intrinsic functions; and as Fn::ImportValue
is an intrinsic function, a parameter value cannot be imported.
Upvotes: 1