From 03aac9f42b7c1159abe681951acb5a3ac1aea34b Mon Sep 17 00:00:00 2001 From: Clint Shryock Date: Fri, 21 Aug 2015 09:58:56 -0500 Subject: [PATCH] Expand on an error case with more descriptive error --- builtin/providers/aws/resource_aws_eip.go | 22 +++++++++---------- .../aws/resource_aws_security_group_rule.go | 8 ++++--- .../resource_aws_security_group_rule_test.go | 2 +- 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/builtin/providers/aws/resource_aws_eip.go b/builtin/providers/aws/resource_aws_eip.go index 4b369ee60..0a7801bee 100644 --- a/builtin/providers/aws/resource_aws_eip.go +++ b/builtin/providers/aws/resource_aws_eip.go @@ -27,19 +27,19 @@ func resourceAwsEip() *schema.Resource { ForceNew: true, }, - "instance": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Computed: true, - }, + "instance": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + }, - "network_interface": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Computed: true, - }, + "network_interface": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + }, - "allocation_id": &schema.Schema{ + "allocation_id": &schema.Schema{ Type: schema.TypeString, Computed: true, }, diff --git a/builtin/providers/aws/resource_aws_security_group_rule.go b/builtin/providers/aws/resource_aws_security_group_rule.go index bd40c284f..a1f078a82 100644 --- a/builtin/providers/aws/resource_aws_security_group_rule.go +++ b/builtin/providers/aws/resource_aws_security_group_rule.go @@ -171,7 +171,9 @@ func resourceAwsSecurityGroupRuleRead(d *schema.ResourceData, meta interface{}) p := expandIPPerm(d, sg) if len(rules) == 0 { - return fmt.Errorf("No IPPerms") + return fmt.Errorf( + "[WARN] No %s rules were found for Security Group (%s) looking for Security Group Rule (%s)", + ruleType, *sg.GroupName, d.Id()) } for _, r := range rules { @@ -198,7 +200,7 @@ func resourceAwsSecurityGroupRuleRead(d *schema.ResourceData, meta interface{}) if remaining > 0 { continue - } + } remaining = len(p.UserIdGroupPairs) for _, ip := range p.UserIdGroupPairs { @@ -211,7 +213,7 @@ func resourceAwsSecurityGroupRuleRead(d *schema.ResourceData, meta interface{}) if remaining > 0 { continue - } + } log.Printf("[DEBUG] Found rule for Security Group Rule (%s): %s", d.Id(), r) rule = r diff --git a/builtin/providers/aws/resource_aws_security_group_rule_test.go b/builtin/providers/aws/resource_aws_security_group_rule_test.go index a00385ba7..29e831446 100644 --- a/builtin/providers/aws/resource_aws_security_group_rule_test.go +++ b/builtin/providers/aws/resource_aws_security_group_rule_test.go @@ -257,7 +257,7 @@ func TestAccAWSSecurityGroupRule_SelfReference(t *testing.T) { } // testing partial match implementation -func TestAccAWSSecurityGroupRule_PartialMatching_Basic(t *testing.T) { +func TestAccAWSSecurityGroupRule_PartialMatching_basic(t *testing.T) { var group ec2.SecurityGroup p := ec2.IpPermission{