Expand on an error case with more descriptive error

This commit is contained in:
Clint Shryock 2015-08-21 09:58:56 -05:00
parent e0bb04b822
commit 03aac9f42b
3 changed files with 17 additions and 15 deletions

View File

@ -27,19 +27,19 @@ func resourceAwsEip() *schema.Resource {
ForceNew: true, ForceNew: true,
}, },
"instance": &schema.Schema{ "instance": &schema.Schema{
Type: schema.TypeString, Type: schema.TypeString,
Optional: true, Optional: true,
Computed: true, Computed: true,
}, },
"network_interface": &schema.Schema{ "network_interface": &schema.Schema{
Type: schema.TypeString, Type: schema.TypeString,
Optional: true, Optional: true,
Computed: true, Computed: true,
}, },
"allocation_id": &schema.Schema{ "allocation_id": &schema.Schema{
Type: schema.TypeString, Type: schema.TypeString,
Computed: true, Computed: true,
}, },

View File

@ -171,7 +171,9 @@ func resourceAwsSecurityGroupRuleRead(d *schema.ResourceData, meta interface{})
p := expandIPPerm(d, sg) p := expandIPPerm(d, sg)
if len(rules) == 0 { 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 { for _, r := range rules {
@ -198,7 +200,7 @@ func resourceAwsSecurityGroupRuleRead(d *schema.ResourceData, meta interface{})
if remaining > 0 { if remaining > 0 {
continue continue
} }
remaining = len(p.UserIdGroupPairs) remaining = len(p.UserIdGroupPairs)
for _, ip := range p.UserIdGroupPairs { for _, ip := range p.UserIdGroupPairs {
@ -211,7 +213,7 @@ func resourceAwsSecurityGroupRuleRead(d *schema.ResourceData, meta interface{})
if remaining > 0 { if remaining > 0 {
continue continue
} }
log.Printf("[DEBUG] Found rule for Security Group Rule (%s): %s", d.Id(), r) log.Printf("[DEBUG] Found rule for Security Group Rule (%s): %s", d.Id(), r)
rule = r rule = r

View File

@ -257,7 +257,7 @@ func TestAccAWSSecurityGroupRule_SelfReference(t *testing.T) {
} }
// testing partial match implementation // testing partial match implementation
func TestAccAWSSecurityGroupRule_PartialMatching_Basic(t *testing.T) { func TestAccAWSSecurityGroupRule_PartialMatching_basic(t *testing.T) {
var group ec2.SecurityGroup var group ec2.SecurityGroup
p := ec2.IpPermission{ p := ec2.IpPermission{