minor tweaks to connection info setup

This commit is contained in:
clint shryock 2015-11-16 14:51:14 -06:00
parent d998e883fb
commit f31b30d4a5
1 changed files with 13 additions and 14 deletions

View File

@ -187,8 +187,7 @@ func resourceAwsSpotInstanceRequestRead(d *schema.ResourceData, meta interface{}
d.Set("spot_request_state", *request.State) d.Set("spot_request_state", *request.State)
d.Set("tags", tagsToMap(request.Tags)) d.Set("tags", tagsToMap(request.Tags))
// return nil // Read the instance data, setting up connection information
// let's read the instance data...
return readInstance(d, meta) return readInstance(d, meta)
} }
@ -222,19 +221,19 @@ func readInstance(d *schema.ResourceData, meta interface{}) error {
d.Set("public_ip", instance.PublicIpAddress) d.Set("public_ip", instance.PublicIpAddress)
d.Set("private_dns", instance.PrivateDnsName) d.Set("private_dns", instance.PrivateDnsName)
d.Set("private_ip", instance.PrivateIpAddress) d.Set("private_ip", instance.PrivateIpAddress)
}
// set connection information // set connection information
if instance.PublicIpAddress != nil { if instance.PublicIpAddress != nil {
d.SetConnInfo(map[string]string{ d.SetConnInfo(map[string]string{
"type": "ssh", "type": "ssh",
"host": *instance.PublicIpAddress, "host": *instance.PublicIpAddress,
}) })
} else if instance.PrivateIpAddress != nil { } else if instance.PrivateIpAddress != nil {
d.SetConnInfo(map[string]string{ d.SetConnInfo(map[string]string{
"type": "ssh", "type": "ssh",
"host": *instance.PrivateIpAddress, "host": *instance.PrivateIpAddress,
}) })
}
} }
return nil return nil