Skip to content

Commit

Permalink
Merge pull request #1099 from selfieebritto/issue-1089
Browse files Browse the repository at this point in the history
 #1089 Added nil check on associated KeyPair
  • Loading branch information
mlabouardy authored Oct 16, 2023
2 parents ee52e42 + 96dba3a commit 843d4cb
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions providers/aws/ec2/instances.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,12 +212,14 @@ func getEC2Relations(inst *etype.Instance, resourceArn string) (rel []models.Lin
})

// Get associated Keypair
rel = append(rel, models.Link{
ResourceID: *inst.KeyName,
Name: *inst.KeyName,
Type: "Key Pair",
Relation: "USES",
})
if inst.KeyName != nil {
rel = append(rel, models.Link{
ResourceID: *inst.KeyName,
Name: *inst.KeyName,
Type: "Key Pair",
Relation: "USES",
})
}

// Get associated IAM roles
if inst.IamInstanceProfile != nil {
Expand Down

0 comments on commit 843d4cb

Please sign in to comment.