Table of contents
Attributes
If a resource has attributes associated to it then in CloudFormation you would use Fn::GetAtt listing the resource and the attribute you wanted.
Info on Fn::GetAtt from AWS can be found here
In KloudFormation all attributes are provided as functions on the resource.
val securityGroup = securityGroup(+"Description")
outputs(
"GroupId" to Output(securityGroup.GroupId()), // GroupId is an Attribute
"VpcId" to Output(securityGroup.VpcId()) // VpcId is an Attribute
)
Produces
Resources:
SecurityGroup:
Type: "AWS::EC2::SecurityGroup"
Properties:
GroupDescription: "Description"
Outputs:
GroupId:
Value:
Fn::GetAtt:
- "SecurityGroup"
- "GroupId"
VpcId:
Value:
Fn::GetAtt:
- "SecurityGroup"
- "VpcId"
You can also create an instance of Att as follows:
Att<String>(securityGroup.logicalName,+"VpcId")