provider/aws: Make ALBs internal or add IGW in tests
This commit is contained in:
parent
acd2b247b4
commit
41da963d07
|
@ -74,7 +74,7 @@ func testAccDataSourceAWSALBListenerConfigBasic(albName, targetGroupName string)
|
|||
|
||||
resource "aws_alb" "alb_test" {
|
||||
name = "%s"
|
||||
internal = false
|
||||
internal = true
|
||||
security_groups = ["${aws_security_group.alb_test.id}"]
|
||||
subnets = ["${aws_subnet.alb_test.*.id}"]
|
||||
|
||||
|
@ -221,6 +221,14 @@ resource "aws_vpc" "alb_test" {
|
|||
}
|
||||
}
|
||||
|
||||
resource "aws_internet_gateway" "gw" {
|
||||
vpc_id = "${aws_vpc.alb_test.id}"
|
||||
|
||||
tags {
|
||||
TestName = "TestAccAWSALB_basic"
|
||||
}
|
||||
}
|
||||
|
||||
resource "aws_subnet" "alb_test" {
|
||||
count = 2
|
||||
vpc_id = "${aws_vpc.alb_test.id}"
|
||||
|
|
|
@ -19,7 +19,7 @@ func TestAccDataSourceAWSALB_basic(t *testing.T) {
|
|||
Config: testAccDataSourceAWSALBConfigBasic(albName),
|
||||
Check: resource.ComposeAggregateTestCheckFunc(
|
||||
resource.TestCheckResourceAttr("data.aws_alb.alb_test_with_arn", "name", albName),
|
||||
resource.TestCheckResourceAttr("data.aws_alb.alb_test_with_arn", "internal", "false"),
|
||||
resource.TestCheckResourceAttr("data.aws_alb.alb_test_with_arn", "internal", "true"),
|
||||
resource.TestCheckResourceAttr("data.aws_alb.alb_test_with_arn", "subnets.#", "2"),
|
||||
resource.TestCheckResourceAttr("data.aws_alb.alb_test_with_arn", "security_groups.#", "1"),
|
||||
resource.TestCheckResourceAttr("data.aws_alb.alb_test_with_arn", "tags.%", "1"),
|
||||
|
@ -31,7 +31,7 @@ func TestAccDataSourceAWSALB_basic(t *testing.T) {
|
|||
resource.TestCheckResourceAttrSet("data.aws_alb.alb_test_with_arn", "dns_name"),
|
||||
resource.TestCheckResourceAttrSet("data.aws_alb.alb_test_with_arn", "arn"),
|
||||
resource.TestCheckResourceAttr("data.aws_alb.alb_test_with_name", "name", albName),
|
||||
resource.TestCheckResourceAttr("data.aws_alb.alb_test_with_name", "internal", "false"),
|
||||
resource.TestCheckResourceAttr("data.aws_alb.alb_test_with_name", "internal", "true"),
|
||||
resource.TestCheckResourceAttr("data.aws_alb.alb_test_with_name", "subnets.#", "2"),
|
||||
resource.TestCheckResourceAttr("data.aws_alb.alb_test_with_name", "security_groups.#", "1"),
|
||||
resource.TestCheckResourceAttr("data.aws_alb.alb_test_with_name", "tags.%", "1"),
|
||||
|
@ -51,7 +51,7 @@ func TestAccDataSourceAWSALB_basic(t *testing.T) {
|
|||
func testAccDataSourceAWSALBConfigBasic(albName string) string {
|
||||
return fmt.Sprintf(`resource "aws_alb" "alb_test" {
|
||||
name = "%s"
|
||||
internal = false
|
||||
internal = true
|
||||
security_groups = ["${aws_security_group.alb_test.id}"]
|
||||
subnets = ["${aws_subnet.alb_test.*.id}"]
|
||||
|
||||
|
|
|
@ -133,7 +133,7 @@ resource "aws_alb_listener" "front_end" {
|
|||
|
||||
resource "aws_alb" "alb_test" {
|
||||
name = "%s"
|
||||
internal = false
|
||||
internal = true
|
||||
security_groups = ["${aws_security_group.alb_test.id}"]
|
||||
subnets = ["${aws_subnet.alb_test.*.id}"]
|
||||
|
||||
|
|
|
@ -148,7 +148,7 @@ func testAccAWSALBListenerConfig_basic(albName, targetGroupName string) string {
|
|||
|
||||
resource "aws_alb" "alb_test" {
|
||||
name = "%s"
|
||||
internal = false
|
||||
internal = true
|
||||
security_groups = ["${aws_security_group.alb_test.id}"]
|
||||
subnets = ["${aws_subnet.alb_test.*.id}"]
|
||||
|
||||
|
@ -291,6 +291,14 @@ resource "aws_vpc" "alb_test" {
|
|||
}
|
||||
}
|
||||
|
||||
resource "aws_internet_gateway" "gw" {
|
||||
vpc_id = "${aws_vpc.alb_test.id}"
|
||||
|
||||
tags {
|
||||
TestName = "TestAccAWSALB_basic"
|
||||
}
|
||||
}
|
||||
|
||||
resource "aws_subnet" "alb_test" {
|
||||
count = 2
|
||||
vpc_id = "${aws_vpc.alb_test.id}"
|
||||
|
|
|
@ -60,7 +60,7 @@ func TestAccAWSALB_basic(t *testing.T) {
|
|||
Check: resource.ComposeAggregateTestCheckFunc(
|
||||
testAccCheckAWSALBExists("aws_alb.alb_test", &conf),
|
||||
resource.TestCheckResourceAttr("aws_alb.alb_test", "name", albName),
|
||||
resource.TestCheckResourceAttr("aws_alb.alb_test", "internal", "false"),
|
||||
resource.TestCheckResourceAttr("aws_alb.alb_test", "internal", "true"),
|
||||
resource.TestCheckResourceAttr("aws_alb.alb_test", "subnets.#", "2"),
|
||||
resource.TestCheckResourceAttr("aws_alb.alb_test", "security_groups.#", "1"),
|
||||
resource.TestCheckResourceAttr("aws_alb.alb_test", "tags.%", "1"),
|
||||
|
@ -197,7 +197,7 @@ func TestAccAWSALB_noSecurityGroup(t *testing.T) {
|
|||
Check: resource.ComposeAggregateTestCheckFunc(
|
||||
testAccCheckAWSALBExists("aws_alb.alb_test", &conf),
|
||||
resource.TestCheckResourceAttr("aws_alb.alb_test", "name", albName),
|
||||
resource.TestCheckResourceAttr("aws_alb.alb_test", "internal", "false"),
|
||||
resource.TestCheckResourceAttr("aws_alb.alb_test", "internal", "true"),
|
||||
resource.TestCheckResourceAttr("aws_alb.alb_test", "subnets.#", "2"),
|
||||
resource.TestCheckResourceAttr("aws_alb.alb_test", "security_groups.#", "1"),
|
||||
resource.TestCheckResourceAttr("aws_alb.alb_test", "tags.%", "1"),
|
||||
|
@ -229,7 +229,7 @@ func TestAccAWSALB_accesslogs(t *testing.T) {
|
|||
Check: resource.ComposeAggregateTestCheckFunc(
|
||||
testAccCheckAWSALBExists("aws_alb.alb_test", &conf),
|
||||
resource.TestCheckResourceAttr("aws_alb.alb_test", "name", albName),
|
||||
resource.TestCheckResourceAttr("aws_alb.alb_test", "internal", "false"),
|
||||
resource.TestCheckResourceAttr("aws_alb.alb_test", "internal", "true"),
|
||||
resource.TestCheckResourceAttr("aws_alb.alb_test", "subnets.#", "2"),
|
||||
resource.TestCheckResourceAttr("aws_alb.alb_test", "security_groups.#", "1"),
|
||||
resource.TestCheckResourceAttr("aws_alb.alb_test", "tags.%", "1"),
|
||||
|
@ -247,7 +247,7 @@ func TestAccAWSALB_accesslogs(t *testing.T) {
|
|||
Check: resource.ComposeAggregateTestCheckFunc(
|
||||
testAccCheckAWSALBExists("aws_alb.alb_test", &conf),
|
||||
resource.TestCheckResourceAttr("aws_alb.alb_test", "name", albName),
|
||||
resource.TestCheckResourceAttr("aws_alb.alb_test", "internal", "false"),
|
||||
resource.TestCheckResourceAttr("aws_alb.alb_test", "internal", "true"),
|
||||
resource.TestCheckResourceAttr("aws_alb.alb_test", "subnets.#", "2"),
|
||||
resource.TestCheckResourceAttr("aws_alb.alb_test", "security_groups.#", "1"),
|
||||
resource.TestCheckResourceAttr("aws_alb.alb_test", "tags.%", "1"),
|
||||
|
@ -269,7 +269,7 @@ func TestAccAWSALB_accesslogs(t *testing.T) {
|
|||
Check: resource.ComposeAggregateTestCheckFunc(
|
||||
testAccCheckAWSALBExists("aws_alb.alb_test", &conf),
|
||||
resource.TestCheckResourceAttr("aws_alb.alb_test", "name", albName),
|
||||
resource.TestCheckResourceAttr("aws_alb.alb_test", "internal", "false"),
|
||||
resource.TestCheckResourceAttr("aws_alb.alb_test", "internal", "true"),
|
||||
resource.TestCheckResourceAttr("aws_alb.alb_test", "subnets.#", "2"),
|
||||
resource.TestCheckResourceAttr("aws_alb.alb_test", "security_groups.#", "1"),
|
||||
resource.TestCheckResourceAttr("aws_alb.alb_test", "tags.%", "1"),
|
||||
|
@ -362,7 +362,7 @@ func testAccCheckAWSALBDestroy(s *terraform.State) error {
|
|||
func testAccAWSALBConfig_basic(albName string) string {
|
||||
return fmt.Sprintf(`resource "aws_alb" "alb_test" {
|
||||
name = "%s"
|
||||
internal = false
|
||||
internal = true
|
||||
security_groups = ["${aws_security_group.alb_test.id}"]
|
||||
subnets = ["${aws_subnet.alb_test.*.id}"]
|
||||
|
||||
|
@ -429,7 +429,7 @@ resource "aws_security_group" "alb_test" {
|
|||
func testAccAWSALBConfig_generatedName() string {
|
||||
return fmt.Sprintf(`
|
||||
resource "aws_alb" "alb_test" {
|
||||
internal = false
|
||||
internal = true
|
||||
security_groups = ["${aws_security_group.alb_test.id}"]
|
||||
subnets = ["${aws_subnet.alb_test.*.id}"]
|
||||
|
||||
|
@ -456,6 +456,14 @@ resource "aws_vpc" "alb_test" {
|
|||
}
|
||||
}
|
||||
|
||||
resource "aws_internet_gateway" "gw" {
|
||||
vpc_id = "${aws_vpc.alb_test.id}"
|
||||
|
||||
tags {
|
||||
Name = "TestAccAWSALB_basic"
|
||||
}
|
||||
}
|
||||
|
||||
resource "aws_subnet" "alb_test" {
|
||||
count = 2
|
||||
vpc_id = "${aws_vpc.alb_test.id}"
|
||||
|
@ -497,7 +505,7 @@ func testAccAWSALBConfig_namePrefix() string {
|
|||
return fmt.Sprintf(`
|
||||
resource "aws_alb" "alb_test" {
|
||||
name_prefix = "tf-lb"
|
||||
internal = false
|
||||
internal = true
|
||||
security_groups = ["${aws_security_group.alb_test.id}"]
|
||||
subnets = ["${aws_subnet.alb_test.*.id}"]
|
||||
|
||||
|
@ -563,7 +571,7 @@ resource "aws_security_group" "alb_test" {
|
|||
func testAccAWSALBConfig_updatedTags(albName string) string {
|
||||
return fmt.Sprintf(`resource "aws_alb" "alb_test" {
|
||||
name = "%s"
|
||||
internal = false
|
||||
internal = true
|
||||
security_groups = ["${aws_security_group.alb_test.id}"]
|
||||
subnets = ["${aws_subnet.alb_test.*.id}"]
|
||||
|
||||
|
@ -631,7 +639,7 @@ resource "aws_security_group" "alb_test" {
|
|||
func testAccAWSALBConfig_accessLogs(enabled bool, albName, bucketName string) string {
|
||||
return fmt.Sprintf(`resource "aws_alb" "alb_test" {
|
||||
name = "%s"
|
||||
internal = false
|
||||
internal = true
|
||||
security_groups = ["${aws_security_group.alb_test.id}"]
|
||||
subnets = ["${aws_subnet.alb_test.*.id}"]
|
||||
|
||||
|
@ -742,7 +750,7 @@ resource "aws_security_group" "alb_test" {
|
|||
func testAccAWSALBConfig_nosg(albName string) string {
|
||||
return fmt.Sprintf(`resource "aws_alb" "alb_test" {
|
||||
name = "%s"
|
||||
internal = false
|
||||
internal = true
|
||||
subnets = ["${aws_subnet.alb_test.*.id}"]
|
||||
|
||||
idle_timeout = 30
|
||||
|
@ -784,7 +792,7 @@ resource "aws_subnet" "alb_test" {
|
|||
func testAccAWSALBConfig_updateSecurityGroups(albName string) string {
|
||||
return fmt.Sprintf(`resource "aws_alb" "alb_test" {
|
||||
name = "%s"
|
||||
internal = false
|
||||
internal = true
|
||||
security_groups = ["${aws_security_group.alb_test.id}", "${aws_security_group.alb_test_2.id}"]
|
||||
subnets = ["${aws_subnet.alb_test.*.id}"]
|
||||
|
||||
|
|
Loading…
Reference in New Issue