cfn-include icon indicating copy to clipboard operation
cfn-include copied to clipboard

Support objects in FN::Map

Open hoegertn opened this issue 8 years ago • 1 comments

I would really love the following to be possible: (syntax is just a proposal)

"Fn::Map": [
            [
              {"zone":"a","net":"0"},
              {"zone":"b","net":"1"},
              {"zone":"c","net":"2"}
            ],
            "az",
            {
              "Subnet${az.zone}": {
                "Type": "AWS::EC2::Subnet",
                "Properties": {
                  "VpcId": {
                    "Ref": "VPC"
                  },
                  "AvailabilityZone": {
                    "Fn::Join": [
                      "",
                      [
                        {
                          "Ref": "AWS::Region"
                        },
                        "${az.zone}"
                      ]
                    ]
                  },
                  "CidrBlock": "192.168.${az.net}.0/24",
                  "MapPublicIpOnLaunch": true
                }
              }
            }
          ]

@monken Do you think this is possible?

hoegertn avatar Mar 24 '16 16:03 hoegertn

You should be able to do this today with referencing a structure in the Mappings object. Define your CIDR ranges in a mapping table and then reference that using something like "CidrBlock": {"Fn::FindInMap": ["CIDRMap", "az"]},

But yeah, being able to reference values in the object that is being passed would be nice.

monken avatar Mar 24 '16 17:03 monken