provider/aws: Fix SecurityGroupRule regression
A security_group_rule can also be created from a `prefix_list_id`. Introduced in #11809 ``` $ make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSSecurityGroupRule_PrefixListEgress' ==> Checking that code complies with gofmt requirements... go generate $(go list ./... | grep -v /terraform/vendor/) 2017/02/10 12:41:40 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSSecurityGroupRule_PrefixListEgress -timeout 120m === RUN TestAccAWSSecurityGroupRule_PrefixListEgress --- PASS: TestAccAWSSecurityGroupRule_PrefixListEgress (33.94s) PASS ok github.com/hashicorp/terraform/builtin/providers/aws 33.970s ```
This commit is contained in:
parent
06aaa44a80
commit
a2792f46c2
|
@ -608,9 +608,10 @@ func validateAwsSecurityGroupRule(d *schema.ResourceData) error {
|
|||
_, blocksOk := d.GetOk("cidr_blocks")
|
||||
_, sourceOk := d.GetOk("source_security_group_id")
|
||||
_, selfOk := d.GetOk("self")
|
||||
if !blocksOk && !sourceOk && !selfOk {
|
||||
_, prefixOk := d.GetOk("prefix_list_ids")
|
||||
if !blocksOk && !sourceOk && !selfOk && !prefixOk {
|
||||
return fmt.Errorf(
|
||||
"One of ['cidr_blocks', 'self', 'source_security_group_id'] must be set to create an AWS Security Group Rule")
|
||||
"One of ['cidr_blocks', 'self', 'source_security_group_id', 'prefix_list_ids'] must be set to create an AWS Security Group Rule")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import (
|
|||
"bytes"
|
||||
"fmt"
|
||||
"log"
|
||||
"regexp"
|
||||
"testing"
|
||||
|
||||
"github.com/aws/aws-sdk-go/aws"
|
||||
|
@ -12,7 +13,6 @@ import (
|
|||
"github.com/hashicorp/terraform/helper/acctest"
|
||||
"github.com/hashicorp/terraform/helper/resource"
|
||||
"github.com/hashicorp/terraform/terraform"
|
||||
"regexp"
|
||||
)
|
||||
|
||||
func TestIpPermissionIDHash(t *testing.T) {
|
||||
|
|
Loading…
Reference in New Issue