providers/aws: security group id-only
This commit is contained in:
parent
5f82f38be7
commit
a44c547986
|
@ -237,6 +237,7 @@ func TestAccAWSSecurityGroup_basic(t *testing.T) {
|
|||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
IDRefreshName: "aws_security_group.web",
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccCheckAWSSecurityGroupDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
|
@ -270,6 +271,8 @@ func TestAccAWSSecurityGroup_namePrefix(t *testing.T) {
|
|||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
IDRefreshName: "aws_security_group.baz",
|
||||
IDRefreshIgnore: []string{"name_prefix"},
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccCheckAWSSecurityGroupDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
|
@ -304,6 +307,7 @@ func TestAccAWSSecurityGroup_self(t *testing.T) {
|
|||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
IDRefreshName: "aws_security_group.web",
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccCheckAWSSecurityGroupDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
|
@ -343,6 +347,7 @@ func TestAccAWSSecurityGroup_vpc(t *testing.T) {
|
|||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
IDRefreshName: "aws_security_group.web",
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccCheckAWSSecurityGroupDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
|
@ -395,6 +400,7 @@ func TestAccAWSSecurityGroup_vpcNegOneIngress(t *testing.T) {
|
|||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
IDRefreshName: "aws_security_group.web",
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccCheckAWSSecurityGroupDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
|
@ -428,6 +434,7 @@ func TestAccAWSSecurityGroup_MultiIngress(t *testing.T) {
|
|||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
IDRefreshName: "aws_security_group.web",
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccCheckAWSSecurityGroupDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
|
@ -446,6 +453,7 @@ func TestAccAWSSecurityGroup_Change(t *testing.T) {
|
|||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
IDRefreshName: "aws_security_group.web",
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccCheckAWSSecurityGroupDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
|
@ -471,6 +479,7 @@ func TestAccAWSSecurityGroup_generatedName(t *testing.T) {
|
|||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
IDRefreshName: "aws_security_group.web",
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccCheckAWSSecurityGroupDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
|
@ -500,6 +509,7 @@ func TestAccAWSSecurityGroup_DefaultEgress(t *testing.T) {
|
|||
// VPC
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
IDRefreshName: "aws_security_group.worker",
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccCheckAWSSecurityGroupDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
|
@ -516,6 +526,7 @@ func TestAccAWSSecurityGroup_DefaultEgress(t *testing.T) {
|
|||
var group ec2.SecurityGroup
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
IDRefreshName: "aws_security_group.web",
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccCheckAWSSecurityGroupDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
|
@ -534,6 +545,8 @@ func TestAccAWSSecurityGroup_drift(t *testing.T) {
|
|||
var group ec2.SecurityGroup
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
DisableIDRefresh: true,
|
||||
IDRefreshName: "aws_security_group.web",
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccCheckAWSSecurityGroupDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
|
@ -564,6 +577,8 @@ func TestAccAWSSecurityGroup_drift_complex(t *testing.T) {
|
|||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
DisableIDRefresh: true,
|
||||
IDRefreshName: "aws_security_group.web",
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testAccCheckAWSSecurityGroupDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
|
@ -958,9 +973,14 @@ func testAccCheckAWSSecurityGroupExistsWithoutDefault(n string) resource.TestChe
|
|||
}
|
||||
|
||||
const testAccAWSSecurityGroupConfig = `
|
||||
resource "aws_vpc" "foo" {
|
||||
cidr_block = "10.1.0.0/16"
|
||||
}
|
||||
|
||||
resource "aws_security_group" "web" {
|
||||
name = "terraform_acceptance_test_example"
|
||||
description = "Used in the terraform acceptance tests"
|
||||
vpc_id = "${aws_vpc.foo.id}"
|
||||
|
||||
ingress {
|
||||
protocol = "6"
|
||||
|
@ -983,9 +1003,14 @@ resource "aws_security_group" "web" {
|
|||
`
|
||||
|
||||
const testAccAWSSecurityGroupConfigChange = `
|
||||
resource "aws_vpc" "foo" {
|
||||
cidr_block = "10.1.0.0/16"
|
||||
}
|
||||
|
||||
resource "aws_security_group" "web" {
|
||||
name = "terraform_acceptance_test_example"
|
||||
description = "Used in the terraform acceptance tests"
|
||||
vpc_id = "${aws_vpc.foo.id}"
|
||||
|
||||
ingress {
|
||||
protocol = "tcp"
|
||||
|
@ -1011,9 +1036,14 @@ resource "aws_security_group" "web" {
|
|||
`
|
||||
|
||||
const testAccAWSSecurityGroupConfigSelf = `
|
||||
resource "aws_vpc" "foo" {
|
||||
cidr_block = "10.1.0.0/16"
|
||||
}
|
||||
|
||||
resource "aws_security_group" "web" {
|
||||
name = "terraform_acceptance_test_example"
|
||||
description = "Used in the terraform acceptance tests"
|
||||
vpc_id = "${aws_vpc.foo.id}"
|
||||
|
||||
ingress {
|
||||
protocol = "tcp"
|
||||
|
@ -1076,9 +1106,14 @@ resource "aws_security_group" "web" {
|
|||
}
|
||||
`
|
||||
const testAccAWSSecurityGroupConfigMultiIngress = `
|
||||
resource "aws_vpc" "foo" {
|
||||
cidr_block = "10.1.0.0/16"
|
||||
}
|
||||
|
||||
resource "aws_security_group" "worker" {
|
||||
name = "terraform_acceptance_test_example_1"
|
||||
description = "Used in the terraform acceptance tests"
|
||||
vpc_id = "${aws_vpc.foo.id}"
|
||||
|
||||
ingress {
|
||||
protocol = "tcp"
|
||||
|
@ -1098,6 +1133,7 @@ resource "aws_security_group" "worker" {
|
|||
resource "aws_security_group" "web" {
|
||||
name = "terraform_acceptance_test_example_2"
|
||||
description = "Used in the terraform acceptance tests"
|
||||
vpc_id = "${aws_vpc.foo.id}"
|
||||
|
||||
ingress {
|
||||
protocol = "tcp"
|
||||
|
@ -1130,9 +1166,14 @@ resource "aws_security_group" "web" {
|
|||
`
|
||||
|
||||
const testAccAWSSecurityGroupConfigTags = `
|
||||
resource "aws_vpc" "foo" {
|
||||
cidr_block = "10.1.0.0/16"
|
||||
}
|
||||
|
||||
resource "aws_security_group" "foo" {
|
||||
name = "terraform_acceptance_test_example"
|
||||
description = "Used in the terraform acceptance tests"
|
||||
vpc_id = "${aws_vpc.foo.id}"
|
||||
|
||||
ingress {
|
||||
protocol = "tcp"
|
||||
|
@ -1155,9 +1196,14 @@ resource "aws_security_group" "foo" {
|
|||
`
|
||||
|
||||
const testAccAWSSecurityGroupConfigTagsUpdate = `
|
||||
resource "aws_vpc" "foo" {
|
||||
cidr_block = "10.1.0.0/16"
|
||||
}
|
||||
|
||||
resource "aws_security_group" "foo" {
|
||||
name = "terraform_acceptance_test_example"
|
||||
description = "Used in the terraform acceptance tests"
|
||||
vpc_id = "${aws_vpc.foo.id}"
|
||||
|
||||
ingress {
|
||||
protocol = "tcp"
|
||||
|
@ -1180,7 +1226,13 @@ resource "aws_security_group" "foo" {
|
|||
`
|
||||
|
||||
const testAccAWSSecurityGroupConfig_generatedName = `
|
||||
resource "aws_vpc" "foo" {
|
||||
cidr_block = "10.1.0.0/16"
|
||||
}
|
||||
|
||||
resource "aws_security_group" "web" {
|
||||
vpc_id = "${aws_vpc.foo.id}"
|
||||
|
||||
ingress {
|
||||
protocol = "tcp"
|
||||
from_port = 80
|
||||
|
@ -1274,14 +1326,20 @@ resource "aws_security_group" "web" {
|
|||
|
||||
func testAccAWSSecurityGroupConfig_drift_complex() string {
|
||||
return fmt.Sprintf(`
|
||||
resource "aws_vpc" "foo" {
|
||||
cidr_block = "10.1.0.0/16"
|
||||
}
|
||||
|
||||
resource "aws_security_group" "otherweb" {
|
||||
name = "tf_acc_%d"
|
||||
description = "Used in the terraform acceptance tests"
|
||||
vpc_id = "${aws_vpc.foo.id}"
|
||||
}
|
||||
|
||||
resource "aws_security_group" "web" {
|
||||
name = "tf_acc_%d"
|
||||
description = "Used in the terraform acceptance tests"
|
||||
vpc_id = "${aws_vpc.foo.id}"
|
||||
|
||||
ingress {
|
||||
protocol = "tcp"
|
||||
|
@ -1332,8 +1390,13 @@ resource "aws_security_group" "web" {
|
|||
}
|
||||
|
||||
const testAccAWSSecurityGroupCombindCIDRandGroups = `
|
||||
resource "aws_vpc" "foo" {
|
||||
cidr_block = "10.1.0.0/16"
|
||||
}
|
||||
|
||||
resource "aws_security_group" "two" {
|
||||
name = "tf-test-1"
|
||||
vpc_id = "${aws_vpc.foo.id}"
|
||||
tags {
|
||||
Name = "tf-test-1"
|
||||
}
|
||||
|
@ -1341,6 +1404,7 @@ resource "aws_security_group" "two" {
|
|||
|
||||
resource "aws_security_group" "one" {
|
||||
name = "tf-test-2"
|
||||
vpc_id = "${aws_vpc.foo.id}"
|
||||
tags {
|
||||
Name = "tf-test-w"
|
||||
}
|
||||
|
@ -1348,6 +1412,7 @@ resource "aws_security_group" "one" {
|
|||
|
||||
resource "aws_security_group" "three" {
|
||||
name = "tf-test-3"
|
||||
vpc_id = "${aws_vpc.foo.id}"
|
||||
tags {
|
||||
Name = "tf-test-3"
|
||||
}
|
||||
|
@ -1355,6 +1420,7 @@ resource "aws_security_group" "three" {
|
|||
|
||||
resource "aws_security_group" "mixed" {
|
||||
name = "tf-mix-test"
|
||||
vpc_id = "${aws_vpc.foo.id}"
|
||||
|
||||
ingress {
|
||||
from_port = 80
|
||||
|
@ -1376,9 +1442,14 @@ resource "aws_security_group" "mixed" {
|
|||
`
|
||||
|
||||
const testAccAWSSecurityGroupConfig_ingressWithCidrAndSGs = `
|
||||
resource "aws_vpc" "foo" {
|
||||
cidr_block = "10.1.0.0/16"
|
||||
}
|
||||
|
||||
resource "aws_security_group" "other_web" {
|
||||
name = "tf_other_acc_tests"
|
||||
description = "Used in the terraform acceptance tests"
|
||||
vpc_id = "${aws_vpc.foo.id}"
|
||||
|
||||
tags {
|
||||
Name = "tf-acc-test"
|
||||
|
@ -1388,6 +1459,7 @@ resource "aws_security_group" "other_web" {
|
|||
resource "aws_security_group" "web" {
|
||||
name = "terraform_acceptance_test_example"
|
||||
description = "Used in the terraform acceptance tests"
|
||||
vpc_id = "${aws_vpc.foo.id}"
|
||||
|
||||
ingress {
|
||||
protocol = "tcp"
|
||||
|
@ -1425,9 +1497,14 @@ provider "aws" {
|
|||
region = "us-east-1"
|
||||
}
|
||||
|
||||
resource "aws_vpc" "foo" {
|
||||
cidr_block = "10.1.0.0/16"
|
||||
}
|
||||
|
||||
resource "aws_security_group" "other_web" {
|
||||
name = "tf_other_acc_tests"
|
||||
description = "Used in the terraform acceptance tests"
|
||||
vpc_id = "${aws_vpc.foo.id}"
|
||||
|
||||
tags {
|
||||
Name = "tf-acc-test"
|
||||
|
@ -1437,6 +1514,7 @@ resource "aws_security_group" "other_web" {
|
|||
resource "aws_security_group" "web" {
|
||||
name = "terraform_acceptance_test_example"
|
||||
description = "Used in the terraform acceptance tests"
|
||||
vpc_id = "${aws_vpc.foo.id}"
|
||||
|
||||
ingress {
|
||||
protocol = "tcp"
|
||||
|
|
Loading…
Reference in New Issue