Added error checking and removed debug statement

This commit is contained in:
Paulo Schreiner 2016-01-25 21:40:13 -02:00 committed by clint shryock
parent 7293ab99d3
commit 923f7dca37
1 changed files with 5 additions and 5 deletions

View File

@ -300,9 +300,6 @@ func (lt *opsworksLayerType) Read(d *schema.ResourceData, client *opsworks.OpsWo
}, },
} }
loadBalancers, err := client.DescribeElasticLoadBalancers(ebsRequest) loadBalancers, err := client.DescribeElasticLoadBalancers(ebsRequest)
fmt.Println(loadBalancers)
if err != nil { if err != nil {
return err return err
} }
@ -359,13 +356,16 @@ func (lt *opsworksLayerType) Create(d *schema.ResourceData, client *opsworks.Ops
loadBalancer := aws.String(d.Get("elastic_load_balancer").(string)) loadBalancer := aws.String(d.Get("elastic_load_balancer").(string))
if loadBalancer != nil && *loadBalancer != "" { if loadBalancer != nil && *loadBalancer != "" {
log.Printf("[DEBUG] Attaching load balancer: %s", *loadBalancer) log.Printf("[DEBUG] Attaching load balancer: %s", *loadBalancer)
client.AttachElasticLoadBalancer(&opsworks.AttachElasticLoadBalancerInput{ _, err := client.AttachElasticLoadBalancer(&opsworks.AttachElasticLoadBalancerInput{
ElasticLoadBalancerName: loadBalancer, ElasticLoadBalancerName: loadBalancer,
LayerId: &layerId, LayerId: &layerId,
}) })
if err != nil {
return err
}
} }
return lt.Read(d, client) return lt.Read(d, client)
} }
func (lt *opsworksLayerType) Update(d *schema.ResourceData, client *opsworks.OpsWorks) error { func (lt *opsworksLayerType) Update(d *schema.ResourceData, client *opsworks.OpsWorks) error {