Skip to content

Commit

Permalink
specify connection type
Browse files Browse the repository at this point in the history
  • Loading branch information
rwillard committed Jun 16, 2015
1 parent 7ff8df6 commit 3d7e958
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func getEC2Instances(config map[string]string) (instances Instances) {
for _, res := range resp.Reservations {
for _, inst := range res.Instances {

if inst.PrivateIPAddress != "" {
if inst.DNSName != "" {
var tags []Tag

for _, tag := range inst.Tags {
Expand All @@ -44,8 +44,16 @@ func getEC2Instances(config map[string]string) (instances Instances) {
for _, sg := range inst.SecurityGroups {
tags = append(tags, Tag{"Security group", sg.Name})
}

instances[inst.PrivateIPAddress] = tags
ci := config["connection_interface"]
if ci == "private_ip" {
instances[inst.PrivateIPAddress] = tags
} else if ci == "public_ip" {
instances[inst.IPAddress] = tags
} else if ci == "private_dns" {
instances[inst.PrivateDNSName] = tags
} else {
instances[inst.DNSName] = tags
}
}
}
}
Expand Down

0 comments on commit 3d7e958

Please sign in to comment.