Skip to content

Commit

Permalink
fix: [CI-14032]: Comments resolved
Browse files Browse the repository at this point in the history
  • Loading branch information
ShobhitSingh11 committed Aug 28, 2024
1 parent bd96969 commit 04fc605
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions drivers/amazon/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,13 @@ func (p *provider) create(ctx context.Context, opts autoscaler.InstanceCreateOpt
tags := createCopy(p.tags)
tags["Name"] = opts.Name

var metadataOptions *ec2.InstanceMetadataOptionsRequest
if p.imdsTokens != "" {
metadataOptions = &ec2.InstanceMetadataOptionsRequest{
HttpTokens: aws.String(p.imdsTokens),
}
}

in := &ec2.RunInstancesInput{
KeyName: aws.String(p.key),
ImageId: aws.String(p.image),
Expand All @@ -109,6 +116,7 @@ func (p *provider) create(ctx context.Context, opts autoscaler.InstanceCreateOpt
InstanceMarketOptions: marketOptions,
IamInstanceProfile: iamProfile,
UserData: aws.String(base64.StdEncoding.EncodeToString(buf.Bytes())),
MetadataOptions: metadataOptions,
NetworkInterfaces: []*ec2.InstanceNetworkInterfaceSpecification{
{
AssociatePublicIpAddress: aws.Bool(!p.privateIP),
Expand Down Expand Up @@ -139,11 +147,11 @@ func (p *provider) create(ctx context.Context, opts autoscaler.InstanceCreateOpt
},
}

if p.imdsTokens != "" {
in.MetadataOptions = &ec2.InstanceMetadataOptionsRequest{
HttpTokens: aws.String(p.imdsTokens),
}
}
// if p.imdsTokens != "" {
// in.MetadataOptions = &ec2.InstanceMetadataOptionsRequest{
// HttpTokens: aws.String(p.imdsTokens),
// }
// }

if p.volumeType == "io1" || p.volumeType == "io2" || p.volumeType == "gp3" {
for _, blockDeviceMapping := range in.BlockDeviceMappings {
Expand Down

0 comments on commit 04fc605

Please sign in to comment.