github.com/recobe182/terraform@v0.8.5-0.20170117231232-49ab22a935b7/builtin/providers/aws/resource_aws_alb_target_group_test.go (about) 1 package aws 2 3 import ( 4 "errors" 5 "fmt" 6 "testing" 7 8 "github.com/aws/aws-sdk-go/aws" 9 "github.com/aws/aws-sdk-go/service/elbv2" 10 "github.com/hashicorp/errwrap" 11 "github.com/hashicorp/terraform/helper/acctest" 12 "github.com/hashicorp/terraform/helper/resource" 13 "github.com/hashicorp/terraform/terraform" 14 ) 15 16 func TestALBTargetGroupCloudwatchSuffixFromARN(t *testing.T) { 17 cases := []struct { 18 name string 19 arn *string 20 suffix string 21 }{ 22 { 23 name: "valid suffix", 24 arn: aws.String(`arn:aws:elasticloadbalancing:us-east-1:123456:targetgroup/my-targets/73e2d6bc24d8a067`), 25 suffix: `targetgroup/my-targets/73e2d6bc24d8a067`, 26 }, 27 { 28 name: "no suffix", 29 arn: aws.String(`arn:aws:elasticloadbalancing:us-east-1:123456:targetgroup`), 30 suffix: ``, 31 }, 32 { 33 name: "nil ARN", 34 arn: nil, 35 suffix: ``, 36 }, 37 } 38 39 for _, tc := range cases { 40 actual := albTargetGroupSuffixFromARN(tc.arn) 41 if actual != tc.suffix { 42 t.Fatalf("bad suffix: %q\nExpected: %s\n Got: %s", tc.name, tc.suffix, actual) 43 } 44 } 45 } 46 47 func TestAccAWSALBTargetGroup_basic(t *testing.T) { 48 var conf elbv2.TargetGroup 49 targetGroupName := fmt.Sprintf("test-target-group-%s", acctest.RandStringFromCharSet(10, acctest.CharSetAlphaNum)) 50 51 resource.Test(t, resource.TestCase{ 52 PreCheck: func() { testAccPreCheck(t) }, 53 IDRefreshName: "aws_alb_target_group.test", 54 Providers: testAccProviders, 55 CheckDestroy: testAccCheckAWSALBTargetGroupDestroy, 56 Steps: []resource.TestStep{ 57 { 58 Config: testAccAWSALBTargetGroupConfig_basic(targetGroupName), 59 Check: resource.ComposeAggregateTestCheckFunc( 60 testAccCheckAWSALBTargetGroupExists("aws_alb_target_group.test", &conf), 61 resource.TestCheckResourceAttrSet("aws_alb_target_group.test", "arn"), 62 resource.TestCheckResourceAttr("aws_alb_target_group.test", "name", targetGroupName), 63 resource.TestCheckResourceAttr("aws_alb_target_group.test", "port", "443"), 64 resource.TestCheckResourceAttr("aws_alb_target_group.test", "protocol", "HTTPS"), 65 resource.TestCheckResourceAttrSet("aws_alb_target_group.test", "vpc_id"), 66 resource.TestCheckResourceAttr("aws_alb_target_group.test", "deregistration_delay", "200"), 67 resource.TestCheckResourceAttr("aws_alb_target_group.test", "stickiness.#", "1"), 68 resource.TestCheckResourceAttr("aws_alb_target_group.test", "stickiness.0.type", "lb_cookie"), 69 resource.TestCheckResourceAttr("aws_alb_target_group.test", "stickiness.0.cookie_duration", "10000"), 70 resource.TestCheckResourceAttr("aws_alb_target_group.test", "health_check.#", "1"), 71 resource.TestCheckResourceAttr("aws_alb_target_group.test", "health_check.0.path", "/health"), 72 resource.TestCheckResourceAttr("aws_alb_target_group.test", "health_check.0.interval", "60"), 73 resource.TestCheckResourceAttr("aws_alb_target_group.test", "health_check.0.port", "8081"), 74 resource.TestCheckResourceAttr("aws_alb_target_group.test", "health_check.0.protocol", "HTTP"), 75 resource.TestCheckResourceAttr("aws_alb_target_group.test", "health_check.0.timeout", "3"), 76 resource.TestCheckResourceAttr("aws_alb_target_group.test", "health_check.0.healthy_threshold", "3"), 77 resource.TestCheckResourceAttr("aws_alb_target_group.test", "health_check.0.unhealthy_threshold", "3"), 78 resource.TestCheckResourceAttr("aws_alb_target_group.test", "health_check.0.matcher", "200-299"), 79 ), 80 }, 81 }, 82 }) 83 } 84 85 func TestAccAWSALBTargetGroup_changeNameForceNew(t *testing.T) { 86 var before, after elbv2.TargetGroup 87 targetGroupNameBefore := fmt.Sprintf("test-target-group-%s", acctest.RandStringFromCharSet(10, acctest.CharSetAlphaNum)) 88 targetGroupNameAfter := fmt.Sprintf("test-target-group-%s", acctest.RandStringFromCharSet(4, acctest.CharSetAlphaNum)) 89 90 resource.Test(t, resource.TestCase{ 91 PreCheck: func() { testAccPreCheck(t) }, 92 IDRefreshName: "aws_alb_target_group.test", 93 Providers: testAccProviders, 94 CheckDestroy: testAccCheckAWSALBTargetGroupDestroy, 95 Steps: []resource.TestStep{ 96 { 97 Config: testAccAWSALBTargetGroupConfig_basic(targetGroupNameBefore), 98 Check: resource.ComposeAggregateTestCheckFunc( 99 testAccCheckAWSALBTargetGroupExists("aws_alb_target_group.test", &before), 100 resource.TestCheckResourceAttr("aws_alb_target_group.test", "name", targetGroupNameBefore), 101 ), 102 }, 103 { 104 Config: testAccAWSALBTargetGroupConfig_basic(targetGroupNameAfter), 105 Check: resource.ComposeAggregateTestCheckFunc( 106 testAccCheckAWSALBTargetGroupExists("aws_alb_target_group.test", &after), 107 resource.TestCheckResourceAttr("aws_alb_target_group.test", "name", targetGroupNameAfter), 108 ), 109 }, 110 }, 111 }) 112 } 113 114 func TestAccAWSALBTargetGroup_changeProtocolForceNew(t *testing.T) { 115 var before, after elbv2.TargetGroup 116 targetGroupName := fmt.Sprintf("test-target-group-%s", acctest.RandStringFromCharSet(10, acctest.CharSetAlphaNum)) 117 118 resource.Test(t, resource.TestCase{ 119 PreCheck: func() { testAccPreCheck(t) }, 120 IDRefreshName: "aws_alb_target_group.test", 121 Providers: testAccProviders, 122 CheckDestroy: testAccCheckAWSALBTargetGroupDestroy, 123 Steps: []resource.TestStep{ 124 { 125 Config: testAccAWSALBTargetGroupConfig_basic(targetGroupName), 126 Check: resource.ComposeAggregateTestCheckFunc( 127 testAccCheckAWSALBTargetGroupExists("aws_alb_target_group.test", &before), 128 resource.TestCheckResourceAttr("aws_alb_target_group.test", "protocol", "HTTPS"), 129 ), 130 }, 131 { 132 Config: testAccAWSALBTargetGroupConfig_updatedProtocol(targetGroupName), 133 Check: resource.ComposeAggregateTestCheckFunc( 134 testAccCheckAWSALBTargetGroupExists("aws_alb_target_group.test", &after), 135 resource.TestCheckResourceAttr("aws_alb_target_group.test", "protocol", "HTTP"), 136 ), 137 }, 138 }, 139 }) 140 } 141 142 func TestAccAWSALBTargetGroup_changePortForceNew(t *testing.T) { 143 var before, after elbv2.TargetGroup 144 targetGroupName := fmt.Sprintf("test-target-group-%s", acctest.RandStringFromCharSet(10, acctest.CharSetAlphaNum)) 145 146 resource.Test(t, resource.TestCase{ 147 PreCheck: func() { testAccPreCheck(t) }, 148 IDRefreshName: "aws_alb_target_group.test", 149 Providers: testAccProviders, 150 CheckDestroy: testAccCheckAWSALBTargetGroupDestroy, 151 Steps: []resource.TestStep{ 152 { 153 Config: testAccAWSALBTargetGroupConfig_basic(targetGroupName), 154 Check: resource.ComposeAggregateTestCheckFunc( 155 testAccCheckAWSALBTargetGroupExists("aws_alb_target_group.test", &before), 156 resource.TestCheckResourceAttr("aws_alb_target_group.test", "port", "443"), 157 ), 158 }, 159 { 160 Config: testAccAWSALBTargetGroupConfig_updatedPort(targetGroupName), 161 Check: resource.ComposeAggregateTestCheckFunc( 162 testAccCheckAWSALBTargetGroupExists("aws_alb_target_group.test", &after), 163 resource.TestCheckResourceAttr("aws_alb_target_group.test", "port", "442"), 164 ), 165 }, 166 }, 167 }) 168 } 169 170 func TestAccAWSALBTargetGroup_changeVpcForceNew(t *testing.T) { 171 var before, after elbv2.TargetGroup 172 targetGroupName := fmt.Sprintf("test-target-group-%s", acctest.RandStringFromCharSet(10, acctest.CharSetAlphaNum)) 173 174 resource.Test(t, resource.TestCase{ 175 PreCheck: func() { testAccPreCheck(t) }, 176 IDRefreshName: "aws_alb_target_group.test", 177 Providers: testAccProviders, 178 CheckDestroy: testAccCheckAWSALBTargetGroupDestroy, 179 Steps: []resource.TestStep{ 180 { 181 Config: testAccAWSALBTargetGroupConfig_basic(targetGroupName), 182 Check: resource.ComposeAggregateTestCheckFunc( 183 testAccCheckAWSALBTargetGroupExists("aws_alb_target_group.test", &before), 184 ), 185 }, 186 { 187 Config: testAccAWSALBTargetGroupConfig_updatedVpc(targetGroupName), 188 Check: resource.ComposeAggregateTestCheckFunc( 189 testAccCheckAWSALBTargetGroupExists("aws_alb_target_group.test", &after), 190 ), 191 }, 192 }, 193 }) 194 } 195 196 func TestAccAWSALBTargetGroup_tags(t *testing.T) { 197 var conf elbv2.TargetGroup 198 targetGroupName := fmt.Sprintf("test-target-group-%s", acctest.RandStringFromCharSet(10, acctest.CharSetAlphaNum)) 199 200 resource.Test(t, resource.TestCase{ 201 PreCheck: func() { testAccPreCheck(t) }, 202 IDRefreshName: "aws_alb_target_group.test", 203 Providers: testAccProviders, 204 CheckDestroy: testAccCheckAWSALBTargetGroupDestroy, 205 Steps: []resource.TestStep{ 206 { 207 Config: testAccAWSALBTargetGroupConfig_basic(targetGroupName), 208 Check: resource.ComposeAggregateTestCheckFunc( 209 testAccCheckAWSALBTargetGroupExists("aws_alb_target_group.test", &conf), 210 resource.TestCheckResourceAttr("aws_alb_target_group.test", "tags.%", "1"), 211 resource.TestCheckResourceAttr("aws_alb_target_group.test", "tags.TestName", "TestAccAWSALBTargetGroup_basic"), 212 ), 213 }, 214 { 215 Config: testAccAWSALBTargetGroupConfig_updateTags(targetGroupName), 216 Check: resource.ComposeAggregateTestCheckFunc( 217 testAccCheckAWSALBTargetGroupExists("aws_alb_target_group.test", &conf), 218 resource.TestCheckResourceAttr("aws_alb_target_group.test", "tags.%", "2"), 219 resource.TestCheckResourceAttr("aws_alb_target_group.test", "tags.Environment", "Production"), 220 resource.TestCheckResourceAttr("aws_alb_target_group.test", "tags.Type", "ALB Target Group"), 221 ), 222 }, 223 }, 224 }) 225 } 226 227 func TestAccAWSALBTargetGroup_updateHealthCheck(t *testing.T) { 228 var conf elbv2.TargetGroup 229 targetGroupName := fmt.Sprintf("test-target-group-%s", acctest.RandStringFromCharSet(10, acctest.CharSetAlphaNum)) 230 231 resource.Test(t, resource.TestCase{ 232 PreCheck: func() { testAccPreCheck(t) }, 233 IDRefreshName: "aws_alb_target_group.test", 234 Providers: testAccProviders, 235 CheckDestroy: testAccCheckAWSALBTargetGroupDestroy, 236 Steps: []resource.TestStep{ 237 { 238 Config: testAccAWSALBTargetGroupConfig_basic(targetGroupName), 239 Check: resource.ComposeAggregateTestCheckFunc( 240 testAccCheckAWSALBTargetGroupExists("aws_alb_target_group.test", &conf), 241 resource.TestCheckResourceAttrSet("aws_alb_target_group.test", "arn"), 242 resource.TestCheckResourceAttr("aws_alb_target_group.test", "name", targetGroupName), 243 resource.TestCheckResourceAttr("aws_alb_target_group.test", "port", "443"), 244 resource.TestCheckResourceAttr("aws_alb_target_group.test", "protocol", "HTTPS"), 245 resource.TestCheckResourceAttrSet("aws_alb_target_group.test", "vpc_id"), 246 resource.TestCheckResourceAttr("aws_alb_target_group.test", "deregistration_delay", "200"), 247 resource.TestCheckResourceAttr("aws_alb_target_group.test", "stickiness.#", "1"), 248 resource.TestCheckResourceAttr("aws_alb_target_group.test", "stickiness.0.type", "lb_cookie"), 249 resource.TestCheckResourceAttr("aws_alb_target_group.test", "stickiness.0.cookie_duration", "10000"), 250 resource.TestCheckResourceAttr("aws_alb_target_group.test", "health_check.#", "1"), 251 resource.TestCheckResourceAttr("aws_alb_target_group.test", "health_check.0.path", "/health"), 252 resource.TestCheckResourceAttr("aws_alb_target_group.test", "health_check.0.interval", "60"), 253 resource.TestCheckResourceAttr("aws_alb_target_group.test", "health_check.0.port", "8081"), 254 resource.TestCheckResourceAttr("aws_alb_target_group.test", "health_check.0.protocol", "HTTP"), 255 resource.TestCheckResourceAttr("aws_alb_target_group.test", "health_check.0.timeout", "3"), 256 resource.TestCheckResourceAttr("aws_alb_target_group.test", "health_check.0.healthy_threshold", "3"), 257 resource.TestCheckResourceAttr("aws_alb_target_group.test", "health_check.0.unhealthy_threshold", "3"), 258 resource.TestCheckResourceAttr("aws_alb_target_group.test", "health_check.0.matcher", "200-299"), 259 ), 260 }, 261 { 262 Config: testAccAWSALBTargetGroupConfig_updateHealthCheck(targetGroupName), 263 Check: resource.ComposeAggregateTestCheckFunc( 264 testAccCheckAWSALBTargetGroupExists("aws_alb_target_group.test", &conf), 265 resource.TestCheckResourceAttrSet("aws_alb_target_group.test", "arn"), 266 resource.TestCheckResourceAttr("aws_alb_target_group.test", "name", targetGroupName), 267 resource.TestCheckResourceAttr("aws_alb_target_group.test", "port", "443"), 268 resource.TestCheckResourceAttr("aws_alb_target_group.test", "protocol", "HTTPS"), 269 resource.TestCheckResourceAttrSet("aws_alb_target_group.test", "vpc_id"), 270 resource.TestCheckResourceAttr("aws_alb_target_group.test", "deregistration_delay", "200"), 271 resource.TestCheckResourceAttr("aws_alb_target_group.test", "stickiness.#", "1"), 272 resource.TestCheckResourceAttr("aws_alb_target_group.test", "stickiness.0.type", "lb_cookie"), 273 resource.TestCheckResourceAttr("aws_alb_target_group.test", "stickiness.0.cookie_duration", "10000"), 274 resource.TestCheckResourceAttr("aws_alb_target_group.test", "health_check.#", "1"), 275 resource.TestCheckResourceAttr("aws_alb_target_group.test", "health_check.0.path", "/health2"), 276 resource.TestCheckResourceAttr("aws_alb_target_group.test", "health_check.0.interval", "30"), 277 resource.TestCheckResourceAttr("aws_alb_target_group.test", "health_check.0.port", "8082"), 278 resource.TestCheckResourceAttr("aws_alb_target_group.test", "health_check.0.protocol", "HTTPS"), 279 resource.TestCheckResourceAttr("aws_alb_target_group.test", "health_check.0.timeout", "4"), 280 resource.TestCheckResourceAttr("aws_alb_target_group.test", "health_check.0.healthy_threshold", "4"), 281 resource.TestCheckResourceAttr("aws_alb_target_group.test", "health_check.0.unhealthy_threshold", "4"), 282 resource.TestCheckResourceAttr("aws_alb_target_group.test", "health_check.0.matcher", "200"), 283 ), 284 }, 285 }, 286 }) 287 } 288 289 func testAccCheckAWSALBTargetGroupExists(n string, res *elbv2.TargetGroup) resource.TestCheckFunc { 290 return func(s *terraform.State) error { 291 rs, ok := s.RootModule().Resources[n] 292 if !ok { 293 return fmt.Errorf("Not found: %s", n) 294 } 295 296 if rs.Primary.ID == "" { 297 return errors.New("No Target Group ID is set") 298 } 299 300 conn := testAccProvider.Meta().(*AWSClient).elbv2conn 301 302 describe, err := conn.DescribeTargetGroups(&elbv2.DescribeTargetGroupsInput{ 303 TargetGroupArns: []*string{aws.String(rs.Primary.ID)}, 304 }) 305 306 if err != nil { 307 return err 308 } 309 310 if len(describe.TargetGroups) != 1 || 311 *describe.TargetGroups[0].TargetGroupArn != rs.Primary.ID { 312 return errors.New("Target Group not found") 313 } 314 315 *res = *describe.TargetGroups[0] 316 return nil 317 } 318 } 319 320 func testAccCheckAWSALBTargetGroupDestroy(s *terraform.State) error { 321 conn := testAccProvider.Meta().(*AWSClient).elbv2conn 322 323 for _, rs := range s.RootModule().Resources { 324 if rs.Type != "aws_alb_target_group" { 325 continue 326 } 327 328 describe, err := conn.DescribeTargetGroups(&elbv2.DescribeTargetGroupsInput{ 329 TargetGroupArns: []*string{aws.String(rs.Primary.ID)}, 330 }) 331 332 if err == nil { 333 if len(describe.TargetGroups) != 0 && 334 *describe.TargetGroups[0].TargetGroupArn == rs.Primary.ID { 335 return fmt.Errorf("Target Group %q still exists", rs.Primary.ID) 336 } 337 } 338 339 // Verify the error 340 if isTargetGroupNotFound(err) { 341 return nil 342 } else { 343 return errwrap.Wrapf("Unexpected error checking ALB destroyed: {{err}}", err) 344 } 345 } 346 347 return nil 348 } 349 350 func testAccAWSALBTargetGroupConfig_basic(targetGroupName string) string { 351 return fmt.Sprintf(`resource "aws_alb_target_group" "test" { 352 name = "%s" 353 port = 443 354 protocol = "HTTPS" 355 vpc_id = "${aws_vpc.test.id}" 356 357 deregistration_delay = 200 358 359 stickiness { 360 type = "lb_cookie" 361 cookie_duration = 10000 362 } 363 364 health_check { 365 path = "/health" 366 interval = 60 367 port = 8081 368 protocol = "HTTP" 369 timeout = 3 370 healthy_threshold = 3 371 unhealthy_threshold = 3 372 matcher = "200-299" 373 } 374 375 tags { 376 TestName = "TestAccAWSALBTargetGroup_basic" 377 } 378 } 379 380 resource "aws_vpc" "test" { 381 cidr_block = "10.0.0.0/16" 382 383 tags { 384 TestName = "TestAccAWSALBTargetGroup_basic" 385 } 386 }`, targetGroupName) 387 } 388 389 func testAccAWSALBTargetGroupConfig_updatedPort(targetGroupName string) string { 390 return fmt.Sprintf(`resource "aws_alb_target_group" "test" { 391 name = "%s" 392 port = 442 393 protocol = "HTTPS" 394 vpc_id = "${aws_vpc.test.id}" 395 396 deregistration_delay = 200 397 398 stickiness { 399 type = "lb_cookie" 400 cookie_duration = 10000 401 } 402 403 health_check { 404 path = "/health" 405 interval = 60 406 port = 8081 407 protocol = "HTTP" 408 timeout = 3 409 healthy_threshold = 3 410 unhealthy_threshold = 3 411 matcher = "200-299" 412 } 413 414 tags { 415 TestName = "TestAccAWSALBTargetGroup_basic" 416 } 417 } 418 419 resource "aws_vpc" "test" { 420 cidr_block = "10.0.0.0/16" 421 422 tags { 423 TestName = "TestAccAWSALBTargetGroup_basic" 424 } 425 }`, targetGroupName) 426 } 427 428 func testAccAWSALBTargetGroupConfig_updatedProtocol(targetGroupName string) string { 429 return fmt.Sprintf(`resource "aws_alb_target_group" "test" { 430 name = "%s" 431 port = 443 432 protocol = "HTTP" 433 vpc_id = "${aws_vpc.test2.id}" 434 435 deregistration_delay = 200 436 437 stickiness { 438 type = "lb_cookie" 439 cookie_duration = 10000 440 } 441 442 health_check { 443 path = "/health" 444 interval = 60 445 port = 8081 446 protocol = "HTTP" 447 timeout = 3 448 healthy_threshold = 3 449 unhealthy_threshold = 3 450 matcher = "200-299" 451 } 452 453 tags { 454 TestName = "TestAccAWSALBTargetGroup_basic" 455 } 456 } 457 458 resource "aws_vpc" "test2" { 459 cidr_block = "10.10.0.0/16" 460 461 tags { 462 TestName = "TestAccAWSALBTargetGroup_basic" 463 } 464 } 465 466 resource "aws_vpc" "test" { 467 cidr_block = "10.0.0.0/16" 468 469 tags { 470 TestName = "TestAccAWSALBTargetGroup_basic" 471 } 472 }`, targetGroupName) 473 } 474 475 func testAccAWSALBTargetGroupConfig_updatedVpc(targetGroupName string) string { 476 return fmt.Sprintf(`resource "aws_alb_target_group" "test" { 477 name = "%s" 478 port = 443 479 protocol = "HTTPS" 480 vpc_id = "${aws_vpc.test.id}" 481 482 deregistration_delay = 200 483 484 stickiness { 485 type = "lb_cookie" 486 cookie_duration = 10000 487 } 488 489 health_check { 490 path = "/health" 491 interval = 60 492 port = 8081 493 protocol = "HTTP" 494 timeout = 3 495 healthy_threshold = 3 496 unhealthy_threshold = 3 497 matcher = "200-299" 498 } 499 500 tags { 501 TestName = "TestAccAWSALBTargetGroup_basic" 502 } 503 } 504 505 resource "aws_vpc" "test" { 506 cidr_block = "10.0.0.0/16" 507 508 tags { 509 TestName = "TestAccAWSALBTargetGroup_basic" 510 } 511 }`, targetGroupName) 512 } 513 514 func testAccAWSALBTargetGroupConfig_updateTags(targetGroupName string) string { 515 return fmt.Sprintf(`resource "aws_alb_target_group" "test" { 516 name = "%s" 517 port = 443 518 protocol = "HTTPS" 519 vpc_id = "${aws_vpc.test.id}" 520 521 deregistration_delay = 200 522 523 stickiness { 524 type = "lb_cookie" 525 cookie_duration = 10000 526 } 527 528 health_check { 529 path = "/health" 530 interval = 60 531 port = 8081 532 protocol = "HTTP" 533 timeout = 3 534 healthy_threshold = 3 535 unhealthy_threshold = 3 536 matcher = "200-299" 537 } 538 539 tags { 540 Environment = "Production" 541 Type = "ALB Target Group" 542 } 543 } 544 545 resource "aws_vpc" "test" { 546 cidr_block = "10.0.0.0/16" 547 548 tags { 549 TestName = "TestAccAWSALBTargetGroup_basic" 550 } 551 }`, targetGroupName) 552 } 553 554 func testAccAWSALBTargetGroupConfig_updateHealthCheck(targetGroupName string) string { 555 return fmt.Sprintf(`resource "aws_alb_target_group" "test" { 556 name = "%s" 557 port = 443 558 protocol = "HTTPS" 559 vpc_id = "${aws_vpc.test.id}" 560 561 deregistration_delay = 200 562 563 stickiness { 564 type = "lb_cookie" 565 cookie_duration = 10000 566 } 567 568 health_check { 569 path = "/health2" 570 interval = 30 571 port = 8082 572 protocol = "HTTPS" 573 timeout = 4 574 healthy_threshold = 4 575 unhealthy_threshold = 4 576 matcher = "200" 577 } 578 } 579 580 resource "aws_vpc" "test" { 581 cidr_block = "10.0.0.0/16" 582 583 tags { 584 TestName = "TestAccAWSALBTargetGroup_basic" 585 } 586 }`, targetGroupName) 587 }