Skip to content

aws-ecs: Cluster.fromClusterAttributes does not properly set autoScalingGroup #29241

@cheruvian

Description

@cheruvian

Describe the bug

Cluster.fromClusterAttributes does not properly set autoScalingGroup

Expected Behavior

autoScalingGroup to be set

Current Behavior

Is undefined which leads to NPEs.

Reproduction Steps

    const vpc   = new Vpc(this, 'Vpc', {});
    const cluster = Cluster.fromClusterAttributes(this, 'Cluster', {
      clusterName: 'my-cluster',
      vpc,
      securityGroups: [],
      autoscalingGroup: new AutoScalingGroup(this, 'Asg', {
        vpc,
        instanceType: InstanceType.of(InstanceClass.A1, InstanceSize.MICRO),
        machineImage: MachineImage.latestAmazonLinux2(),
      }),
    });
    cluster.autoscalingGroup!.addUserData('yum install -y aws-cli');

Possible Solution

All ClusterAttributes should get set on the ImportCluster.

Additional Information/Context

No response

CDK CLI Version

2.126.0

Framework Version

No response

Node.js Version

v20.10.0

OS

OSX

Language

TypeScript

Language Version

No response

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    @aws-cdk/aws-ecsRelated to Amazon Elastic ContainerbugThis issue is a bug.effort/mediumMedium work item – several days of effortp2

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions