cloudformation-coverage-roadmap
cloudformation-coverage-roadmap copied to clipboard
[AWS::AutoScaling::AutoScalingGroup] - [BUG] - CloudControl patch updates fail when updating LaunchTemplate.Version
Name of the resource
AWS::AutoScaling::AutoScalingGroup
Resource Name
AWS::AutoScaling::AutoScalingGroup
Issue Description
This issue was original reported in the pulumi-aws-native repo which uses AWS CloudControl. If you create an AutoScalingGroup which uses a LaunchTemplate and then you try and update the LaunchTemplate.Version you get the below error message
"InvalidRequest": To describe the launch template data for all your launch templates, for ‘--versions’ specify ‘$Latest’, ‘$Default’, or both, and omit ‘--launch-template-id’, ‘--launch-template-name’, and version numbers. To describe the launch template data for a specific launch template, specify ‘--launch-template-id’ or ‘--launch-template-name’, and for ‘--versions’ specify one or more of the following values: ‘$Latest’, ‘$Default’, or one or more version numbers. (Service: Ec2, Status Code: 400, Request ID: 1741577d-4012-4545-bcf4-e25ecfa1b04a)
Expected Behavior
You should be able to update the LaunchTemplate.Version on the AutoScalingGroup
Observed Behavior
Fails with the mentioned error message
Test Cases
- Create a Launch Template and AutoScaling Group
---
Resources:
EC2SecurityGroup:
Type: "AWS::EC2::SecurityGroup"
Properties:
VpcId:
Ref: "EC2VPC"
MyLaunchTemplate:
Type: AWS::EC2::LaunchTemplate
Properties:
LaunchTemplateData:
UserData: "#!/bin/bash\necho 43"
ImageId: resolve:ssm:/aws/service/ami-amazon-linux-latest/al2023-ami-kernel-default-x86_64
InstanceType: t2.micro
SecurityGroupIds:
- Ref: "EC2SecurityGroup"
AutoScalingAutoScalingGroup:
Type: "AWS::AutoScaling::AutoScalingGroup"
Properties:
AvailabilityZones:
- "us-east-2b"
DesiredCapacity: "1"
MaxSize: "2"
MinSize: "1"
LaunchTemplate:
Version: !GetAtt MyLaunchTemplate.LaunchTemplateVersion
LaunchTemplateId: !GetAtt MyLaunchTemplate.LaunchTemplateId
VPCZoneIdentifier:
- Ref: "EC2Subnet"
EC2VPC:
Type: "AWS::EC2::VPC"
Properties:
CidrBlock: "10.0.0.0/16"
EC2Subnet:
Type: "AWS::EC2::Subnet"
Properties:
VpcId:
Ref: "EC2VPC"
CidrBlock: "10.0.160.0/20"
- Create a new version of the LaunchTemplate
- Try and update the AutoScalingGroup with the new version
$ aws cloudcontrol update-resource --type-name AWS::AutoScaling::AutoScalingGroup --identifier REPLACE_WITH_IDENTIFIER --patch-document '[{"op":"replace","path":"/LaunchTemplate","value":{"LaunchTemplateId":"REPLACE_WITH_ID","Version":3}}]","TypeName":"AWS::AutoScaling::AutoScalingGroup"}]'
- View failed status
$ aws cloudcontrol list-resource-requests --resource-request-status-filter Operations=UPDATE,OperationStatuses=FAILED --query 'ResourceRequestStatusSummaries[?TypeName==`AWS::AutoScaling::AutoScalingGroup`]'
Other Details
No response