provider/aws: Safely get ELB values (#7585)

- removes dereferences to avoid nil crashes
This commit is contained in:
Clint 2016-07-13 03:07:56 -06:00 committed by Paul Stack
parent 8c6d71daf6
commit 3cea29176f
1 changed files with 9 additions and 4 deletions

View File

@ -336,10 +336,15 @@ func resourceAwsElbRead(d *schema.ResourceData, meta interface{}) error {
lb := describeResp.LoadBalancerDescriptions[0]
d.Set("name", *lb.LoadBalancerName)
d.Set("dns_name", *lb.DNSName)
d.Set("zone_id", *lb.CanonicalHostedZoneNameID)
d.Set("internal", *lb.Scheme == "internal")
d.Set("name", lb.LoadBalancerName)
d.Set("dns_name", lb.DNSName)
d.Set("zone_id", lb.CanonicalHostedZoneNameID)
var scheme bool
if lb.Scheme != nil {
scheme = *lb.Scheme == "internal"
}
d.Set("internal", scheme)
d.Set("availability_zones", flattenStringList(lb.AvailabilityZones))
d.Set("instances", flattenInstances(lb.Instances))
d.Set("listener", flattenListeners(lb.ListenerDescriptions))