From 3cea29176f8ecd279ad05fd5883f93ace75c85a1 Mon Sep 17 00:00:00 2001 From: Clint Date: Wed, 13 Jul 2016 03:07:56 -0600 Subject: [PATCH] provider/aws: Safely get ELB values (#7585) - removes dereferences to avoid nil crashes --- builtin/providers/aws/resource_aws_elb.go | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/builtin/providers/aws/resource_aws_elb.go b/builtin/providers/aws/resource_aws_elb.go index 422b527d1..e036928dc 100644 --- a/builtin/providers/aws/resource_aws_elb.go +++ b/builtin/providers/aws/resource_aws_elb.go @@ -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))