Cloud Formation 函数不会将值分配给标签中键的值

Cloud Formation function doesn't assign value to value for key within a Tag

我有以下 Cloud Formation 模板来创建 VPC。 VPC 名称是根据创建模板的区域和环境生成的。VPC 创建没有任何问题,并且 运行 aws cloud formation validate-template --template-url https://foo.template 不会抱怨任何语法。

我希望 VPC 被命名为:

vpc-uw1-d-fs

相反,VPC 的名称为空,名称标签的值为空。我没有正确使用该功能吗?如果我删除 Fn::FindInMap 函数用法,我会生成名称 - 它只是缺少环境映射值。

{
    "AWSTemplateFormatVersion": "2010-09-09",
    "Description": "VPC for a new environment to use.",
    "Parameters": {
        "EnvironmentName": {
            "Description": "Name of the environment that this VPC will be used for.",
            "Type": "String",
            "MinLength": "2",
            "MaxLength": "20",
            "AllowedPattern": "[a-zA-Z]*",
            "AllowedValues": [
                "Development",
                "QA",
                "Test",
                "Production"
            ]
        }
    },
    "Resources": {
        "VPC": {
            "Type": "AWS::EC2::VPC",
            "Properties": {
                "CidrBlock": "10.0.0.0/16",
                "EnableDnsSupport": false,
                "EnableDnsHostnames": false,
                "InstanceTenancy": "default",
                "Tags": [ { 
                    "Key": "Name",
                    "Value": {
                        "Fn::Join": [
                            "-",
                            [
                                "vpc",
                                { "Ref": "AWS::Region" },
                                { "Fn::FindInMap": [
                                    "EnvironmentMap", { "Ref": "EnvironmentName" }, "AbbreviatedName"
                                ]},
                                "fs"
                            ]
                        ]
                    }
                }]
            }
        }
    },
    "Mappings": {
        "RegionMap": {
            "us-east-1": {
                "regionName": "ue1"
            },
            "us-west-1": {
                "regionName": "uw1"
            }
        },
        "EnvironmentMap": {
            "Development": { 
                "AbbreviatedName": "d"
            },
            "QA": { 
                "AbbreviatedName": "qa"
            },
            "Test": { 
                "AbbreviatedName": "t"
            },
            "Production": { 
                "AbbreviatedName": "p"
            }
        }
    },
    "Outputs": {

    }
}

你的模板非常适合我。

我 运行 它在 ap-southeast-2 区域并且它产生了标签:

  • 姓名: vpc-ap-southeast-2-d-fs

(给定的模板中没有使用 RegionMap。)