address feedback from @stack72 on PR #7458

as of Mon Aug  8 03:08:21 UTC 2016
This commit is contained in:
Ernest W. Durbin III 2016-08-07 23:08:00 -04:00
parent 57d3c722e2
commit 4f07b92447
3 changed files with 10 additions and 10 deletions

View File

@ -60,10 +60,7 @@ func resourceAwsLoadBalancerBackendServerPoliciesCreate(d *schema.ResourceData,
} }
d.SetId(fmt.Sprintf("%s:%s", *setOpts.LoadBalancerName, strconv.FormatInt(*setOpts.InstancePort, 10))) d.SetId(fmt.Sprintf("%s:%s", *setOpts.LoadBalancerName, strconv.FormatInt(*setOpts.InstancePort, 10)))
d.Set("load_balancer_name", setOpts.LoadBalancerName) return resourceAwsLoadBalancerBackendServerPoliciesRead(d, meta)
d.Set("instance_port", setOpts.InstancePort)
d.Set("policy_names", flattenStringList(setOpts.PolicyNames))
return nil
} }
func resourceAwsLoadBalancerBackendServerPoliciesRead(d *schema.ResourceData, meta interface{}) error { func resourceAwsLoadBalancerBackendServerPoliciesRead(d *schema.ResourceData, meta interface{}) error {
@ -81,6 +78,7 @@ func resourceAwsLoadBalancerBackendServerPoliciesRead(d *schema.ResourceData, me
if ec2err, ok := err.(awserr.Error); ok { if ec2err, ok := err.(awserr.Error); ok {
if ec2err.Code() == "LoadBalancerNotFound" { if ec2err.Code() == "LoadBalancerNotFound" {
return fmt.Errorf("LoadBalancerNotFound: %s", err) return fmt.Errorf("LoadBalancerNotFound: %s", err)
d.SetId("")
} }
} }
return fmt.Errorf("Error retrieving ELB description: %s", err) return fmt.Errorf("Error retrieving ELB description: %s", err)
@ -130,6 +128,7 @@ func resourceAwsLoadBalancerBackendServerPoliciesDelete(d *schema.ResourceData,
return fmt.Errorf("Error setting LoadBalancerPoliciesForBackendServer: %s", err) return fmt.Errorf("Error setting LoadBalancerPoliciesForBackendServer: %s", err)
} }
d.SetId("")
return nil return nil
} }

View File

@ -60,10 +60,7 @@ func resourceAwsLoadBalancerListenerPoliciesCreate(d *schema.ResourceData, meta
} }
d.SetId(fmt.Sprintf("%s:%s", *setOpts.LoadBalancerName, strconv.FormatInt(*setOpts.LoadBalancerPort, 10))) d.SetId(fmt.Sprintf("%s:%s", *setOpts.LoadBalancerName, strconv.FormatInt(*setOpts.LoadBalancerPort, 10)))
d.Set("load_balancer_name", setOpts.LoadBalancerName) return resourceAwsLoadBalancerListenerPoliciesRead(d, meta)
d.Set("load_balancer_port", setOpts.LoadBalancerPort)
d.Set("policy_names", flattenStringList(setOpts.PolicyNames))
return nil
} }
func resourceAwsLoadBalancerListenerPoliciesRead(d *schema.ResourceData, meta interface{}) error { func resourceAwsLoadBalancerListenerPoliciesRead(d *schema.ResourceData, meta interface{}) error {
@ -81,6 +78,7 @@ func resourceAwsLoadBalancerListenerPoliciesRead(d *schema.ResourceData, meta in
if ec2err, ok := err.(awserr.Error); ok { if ec2err, ok := err.(awserr.Error); ok {
if ec2err.Code() == "LoadBalancerNotFound" { if ec2err.Code() == "LoadBalancerNotFound" {
return fmt.Errorf("LoadBalancerNotFound: %s", err) return fmt.Errorf("LoadBalancerNotFound: %s", err)
d.SetId("")
} }
} }
return fmt.Errorf("Error retrieving ELB description: %s", err) return fmt.Errorf("Error retrieving ELB description: %s", err)
@ -130,6 +128,7 @@ func resourceAwsLoadBalancerListenerPoliciesDelete(d *schema.ResourceData, meta
return fmt.Errorf("Error setting LoadBalancerPoliciesOfListener: %s", err) return fmt.Errorf("Error setting LoadBalancerPoliciesOfListener: %s", err)
} }
d.SetId("")
return nil return nil
} }

View File

@ -86,7 +86,7 @@ func resourceAwsLoadBalancerPolicyCreate(d *schema.ResourceData, meta interface{
d.SetId(fmt.Sprintf("%s:%s", d.SetId(fmt.Sprintf("%s:%s",
*lbspOpts.LoadBalancerName, *lbspOpts.LoadBalancerName,
*lbspOpts.PolicyName)) *lbspOpts.PolicyName))
return nil return resourceAwsLoadBalancerPolicyRead(d, meta)
} }
func resourceAwsLoadBalancerPolicyRead(d *schema.ResourceData, meta interface{}) error { func resourceAwsLoadBalancerPolicyRead(d *schema.ResourceData, meta interface{}) error {
@ -176,7 +176,7 @@ func resourceAwsLoadBalancerPolicyUpdate(d *schema.ResourceData, meta interface{
} }
} }
return nil return resourceAwsLoadBalancerPolicyRead(d, meta)
} }
func resourceAwsLoadBalancerPolicyDelete(d *schema.ResourceData, meta interface{}) error { func resourceAwsLoadBalancerPolicyDelete(d *schema.ResourceData, meta interface{}) error {
@ -204,6 +204,8 @@ func resourceAwsLoadBalancerPolicyDelete(d *schema.ResourceData, meta interface{
if _, err := elbconn.DeleteLoadBalancerPolicy(request); err != nil { if _, err := elbconn.DeleteLoadBalancerPolicy(request); err != nil {
return fmt.Errorf("Error deleting Load Balancer Policy %s: %s", d.Id(), err) return fmt.Errorf("Error deleting Load Balancer Policy %s: %s", d.Id(), err)
} }
d.SetId("")
return nil return nil
} }