Skip to content

Commit

Permalink
fix(aws scraper): handle empty name for ec2 instances
Browse files Browse the repository at this point in the history
when an Ec2 instance is in terminated status, its GetHostname() returns
an empty string.
  • Loading branch information
adityathebe authored and moshloop committed Sep 5, 2024
1 parent 943168d commit 6e78cb5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion scrapers/aws/aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -1190,7 +1190,7 @@ func (aws Scraper) instances(ctx *AWSContext, config v1.AWS, results *v1.ScrapeR
Properties: []*types.Property{getConsoleLink(ctx.Session.Region, v1.AWSEC2Instance, instance.InstanceID, nil)},
Config: instance,
ConfigClass: "VirtualMachine",
Name: instance.GetHostname(),
Name: lo.CoalesceOrEmpty(instance.GetHostname(), instance.InstanceID),
Aliases: []string{"AmazonEC2/" + instance.InstanceID},
ID: instance.InstanceID,
Parents: []v1.ConfigExternalKey{{Type: v1.AWSEC2VPC, ExternalID: instance.VpcID}},
Expand Down

0 comments on commit 6e78cb5

Please sign in to comment.