Search code examples
amazon-web-servicesaws-cloudformation

Encountered unsupported property Version


Getting the error "Encountered unsupported property Version" on GitlabRunnerASG when I try to run this CloudFormation template:

        "Resources": {
        "GitlabRunnerASG": {
            "Type": "AWS::AutoScaling::AutoScalingGroup",
            "Properties": {
                "AvailabilityZones": {
                    "Ref": "SubnetASGAZ"
                },
                "LaunchTemplate": {             
                  "LaunchTemplateId": {
                    "Ref":"MyLaunchTemplate"
                   }
                },
                "Version": {
                  "Fn::GetAtt":[
                    "MyLaunchTemplate",
                    "LatestVersionNumber"
                    ]
                },
                "VPCZoneIdentifier": {
                    "Ref": "SubnetIds"
                },
                "MaxSize": {
                    "Ref": "NumberOfInstances"
                },
                "MinSize": {
                    "Ref": "NumberOfInstances"
                },
        "MyLaunchTemplate": {
            "Type": "AWS::EC2::LaunchTemplate",
            "Properties": {
              "LaunchTemplateName":{"Fn::Sub":"${AWS::StackName}-launch-template"},
              "LaunchTemplateData": {             
                "SecurityGroups": {
                    "Ref": "SecurityGroupName"
                },
                "InstanceType": {
                    "Ref": "EC2Type"
                },
                "ImageId": {
                    "Ref": "RunnerAMIId"
                },
                "IamInstanceProfile": {
                    "Arn":{"Fn::GetAtt": ["MyIamInstanceProfile", "Arn"]}
                },
                "BlockDeviceMappings": [
                    {
                        "DeviceName": "/dev/xvda",
                        "Ebs": {
                            "DeleteOnTermination": true,
                            "VolumeSize": {
                                "Ref": "EC2HardDriveSize"
                            },
                            "VolumeType": "gp2"
                        }
                    }
                ],
                "UserData": {
                    "Fn::Base64": {
                        "Fn::Sub": ""
                    }
                }
              }
            }
        }

Solution

  • AWS::AutoScaling::AutoScalingGroup doesn't have a Version property. Perhaps that is supposed to be part of LaunchTemplate?