diff --git a/pkg/cloud/services/autoscaling/autoscalinggroup.go b/pkg/cloud/services/autoscaling/autoscalinggroup.go index 7b917ed12f..033c7327da 100644 --- a/pkg/cloud/services/autoscaling/autoscalinggroup.go +++ b/pkg/cloud/services/autoscaling/autoscalinggroup.go @@ -83,8 +83,9 @@ func (s *Service) SDKToAutoScalingGroup(v *autoscaling.Group) (*expinfrav1.AutoS if len(v.Instances) > 0 { for _, autoscalingInstance := range v.Instances { tmp := &infrav1.Instance{ - ID: aws.StringValue(autoscalingInstance.InstanceId), - State: infrav1.InstanceState(*autoscalingInstance.LifecycleState), + ID: aws.StringValue(autoscalingInstance.InstanceId), + State: infrav1.InstanceState(*autoscalingInstance.LifecycleState), + AvailabilityZone: *autoscalingInstance.AvailabilityZone, } i.Instances = append(i.Instances, *tmp) } diff --git a/pkg/cloud/services/autoscaling/autoscalinggroup_test.go b/pkg/cloud/services/autoscaling/autoscalinggroup_test.go index d4d974a595..2010b7382e 100644 --- a/pkg/cloud/services/autoscaling/autoscalinggroup_test.go +++ b/pkg/cloud/services/autoscaling/autoscalinggroup_test.go @@ -218,8 +218,9 @@ func TestService_SDKToAutoScalingGroup(t *testing.T) { }, Instances: []*autoscaling.Instance{ { - InstanceId: aws.String("instanceId"), - LifecycleState: aws.String("lifecycleState"), + InstanceId: aws.String("instanceId"), + LifecycleState: aws.String("lifecycleState"), + AvailabilityZone: aws.String("us-east-1a"), }, }, }, @@ -249,8 +250,9 @@ func TestService_SDKToAutoScalingGroup(t *testing.T) { }, Instances: []infrav1.Instance{ { - ID: "instanceId", - State: "lifecycleState", + ID: "instanceId", + State: "lifecycleState", + AvailabilityZone: "us-east-1a", }, }, },