Skip to content

Commit

Permalink
Pass security groups and subnets into RunInstances dry-run
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathan-innis committed Mar 5, 2025
1 parent 05d086b commit 4d18b4a
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions pkg/controllers/nodeclass/validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,15 @@ func (v *Validation) validateRunInstancesAuthorization(
},
},
ImageId: lo.ToPtr(nodeClass.Status.AMIs[0].ID),
// TODO: Need to validate that this doesn't fail if we run out of IPs
NetworkInterfaces: []ec2types.InstanceNetworkInterfaceSpecification{
{
AssociatePublicIpAddress: nodeClass.Spec.AssociatePublicIPAddress,
DeviceIndex: lo.ToPtr[int32](0),
Groups: lo.Map(nodeClass.Status.SecurityGroups, func(s v1.SecurityGroup, _ int) string { return s.ID }),
SubnetId: lo.ToPtr(nodeClass.Status.Subnets[0].ID),
},
},
}

if _, err := v.ec2api.RunInstances(ctx, runInstancesInput); awserrors.IgnoreDryRunError(err) != nil {
Expand Down

0 comments on commit 4d18b4a

Please sign in to comment.