From c0442ee63fcb9e1b647253c3953e196b44dce308 Mon Sep 17 00:00:00 2001 From: Paul Stack Date: Mon, 7 Nov 2016 20:17:43 +0000 Subject: [PATCH] provider/aws: aws_alb_target_group arn_suffix missing the targetgroup (#9911) The work to add the arn_suffix in #9734 skipped adding the targetgroup/ part of the arn This PR adds it //cc @firthh ``` % make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSALBTargetGroup_' ==> Checking that code complies with gofmt requirements... go generate $(go list ./... | grep -v /terraform/vendor/) 2016/11/07 12:19:16 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSALBTargetGroup_ -timeout 120m === RUN TestAccAWSALBTargetGroup_basic --- PASS: TestAccAWSALBTargetGroup_basic (47.23s) === RUN TestAccAWSALBTargetGroup_changeNameForceNew --- PASS: TestAccAWSALBTargetGroup_changeNameForceNew (80.09s) === RUN TestAccAWSALBTargetGroup_changeProtocolForceNew --- PASS: TestAccAWSALBTargetGroup_changeProtocolForceNew (87.45s) === RUN TestAccAWSALBTargetGroup_changePortForceNew --- PASS: TestAccAWSALBTargetGroup_changePortForceNew (78.47s) === RUN TestAccAWSALBTargetGroup_changeVpcForceNew --- PASS: TestAccAWSALBTargetGroup_changeVpcForceNew (73.53s) === RUN TestAccAWSALBTargetGroup_tags --- PASS: TestAccAWSALBTargetGroup_tags (75.60s) === RUN TestAccAWSALBTargetGroup_updateHealthCheck --- PASS: TestAccAWSALBTargetGroup_updateHealthCheck (76.40s) PASS ok github.com/hashicorp/terraform/builtin/providers/aws 518.777s ``` --- builtin/providers/aws/resource_aws_alb_target_group.go | 2 +- builtin/providers/aws/resource_aws_alb_target_group_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/builtin/providers/aws/resource_aws_alb_target_group.go b/builtin/providers/aws/resource_aws_alb_target_group.go index 78fdc1d10..8de850a31 100644 --- a/builtin/providers/aws/resource_aws_alb_target_group.go +++ b/builtin/providers/aws/resource_aws_alb_target_group.go @@ -478,7 +478,7 @@ func albTargetGroupSuffixFromARN(arn *string) string { if arnComponents := regexp.MustCompile(`arn:.*:targetgroup/(.*)`).FindAllStringSubmatch(*arn, -1); len(arnComponents) == 1 { if len(arnComponents[0]) == 2 { - return arnComponents[0][1] + return fmt.Sprintf("targetgroup/%s", arnComponents[0][1]) } } diff --git a/builtin/providers/aws/resource_aws_alb_target_group_test.go b/builtin/providers/aws/resource_aws_alb_target_group_test.go index c61fea6c7..b407ac948 100644 --- a/builtin/providers/aws/resource_aws_alb_target_group_test.go +++ b/builtin/providers/aws/resource_aws_alb_target_group_test.go @@ -22,7 +22,7 @@ func TestALBTargetGroupCloudwatchSuffixFromARN(t *testing.T) { { name: "valid suffix", arn: aws.String(`arn:aws:elasticloadbalancing:us-east-1:123456:targetgroup/my-targets/73e2d6bc24d8a067`), - suffix: `my-targets/73e2d6bc24d8a067`, + suffix: `targetgroup/my-targets/73e2d6bc24d8a067`, }, { name: "no suffix",