I'm running a CloudFormation template that uses the following snippet to tag various resources (this is a ELB tag, but others also exhibit this problem) I would expect this to produce a name tag of stackName-asgElb
but it actually produces names such as olive-asg-asgElb-16GSCPHUFSWEN
.
The stack name in this case was named olive-asg
so I was expecting olive-asg-asgElb
, without the -16GSCPHUFSWEN
on the end.
Does anybody know where the seemingly random string on the end comes from?
CF template snippet :
Tags: [
{
Key: "Name",
Value: {
"Fn::Join": [
"-",
[
{
Ref: "AWS::StackName"
},
"asgElb"
]
]
}
}
]
That's interesting, I just tried it and I'm not able to reproduce the same results that you're seeing. It seems to be working as expected.
Here's the snippet I'm using in its entirety:
"ElasticLoadBalancer" : {
"Type" : "AWS::ElasticLoadBalancing::LoadBalancer",
"Properties" : {
"AvailabilityZones" : { "Fn::GetAZs" : "" },
"CrossZone" : "true",
"Listeners" : [ {
"LoadBalancerPort" : "80",
"InstancePort" : "80",
"Protocol" : "HTTP"
} ],
"Tags" : [
{
"Key" : "Name",
"Value" : { "Fn::Join" : [ "-", [ { "Ref" : "AWS::StackName" }, "MyELB"] ] }
}
]
}
},
The one noticeable difference I see in yours is that you're missing some of the quotes around the Tag stanza.
I feel foolish, the name tags are set correctly, I was looking at the physical IDs, not the name tags. The docs explaining how to control physical IDs are here .
Thanks to @alanwill for testing, and forcing me to go back through all the steps carefully!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.