Skip to content

Commit

Permalink
Merge pull request #40854 from hashicorp/td-testcheckresourceattrset-…
Browse files Browse the repository at this point in the history
…arn-bc

testing: Reduce uses of `resource.TestCheckResourceAttrSet` with ARN attributes: `b` and `c` services
  • Loading branch information
gdavison authored Jan 10, 2025
2 parents 27b0c7a + fd08b32 commit 15776d9
Show file tree
Hide file tree
Showing 17 changed files with 257 additions and 76 deletions.
40 changes: 40 additions & 0 deletions .ci/semgrep/acctest/checks/arn.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package main

import (
"testing"

"github.com/YakDriver/regexache"
"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
"github.com/hashicorp/terraform-provider-aws/internal/acctest"
"github.com/hashicorp/terraform-provider-aws/names"
)

func test1(t *testing.T) {
ctx := acctest.Context(t)

const resourceName = "aws_prometheus_scraper.test"
rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix)

resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { acctest.PreCheck(ctx, t) },
ErrorCheck: acctest.ErrorCheck(t, names.AMPServiceID),
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories,
CheckDestroy: testAccCheckScraperDestroy(ctx),
Steps: []resource.TestStep{
{
Config: testAccScraperConfig_basic(rName),
Check: resource.ComposeAggregateTestCheckFunc(
// ruleid: arn-resourceattrset
resource.TestCheckResourceAttrSet(resourceName, names.AttrARN),
// ok: arn-resourceattrset
acctest.MatchResourceAttrRegionalARN(ctx, resourceName, names.AttrARN, "aps", regexache.MustCompile(`scraper/\w+$`)),
// todoruleid: arn-resourceattrset
resource.TestCheckResourceAttrSet(resourceName, names.AttrRoleARN),
// todoruleid: arn-resourceattrset
resource.TestCheckResourceAttrSet(resourceName, "some_other_arn"),
),
},
},
})

}
60 changes: 60 additions & 0 deletions .ci/semgrep/acctest/checks/arn.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
rules:
- id: arn-resourceattrset
languages: [go]
message: Use one of the `acctest` ARN value checks or TestCheckResourceAttrPair
paths:
exclude:
- "internal/service/connect"
- "internal/service/controltower"
- "internal/service/datazone"
- "internal/service/deploy"
- "internal/service/directconnect"
- "internal/service/dms"
- "internal/service/docdb"
- "internal/service/docdbelastic"
- "internal/service/drs"
- "internal/service/ec2"
- "internal/service/elasticache"
- "internal/service/elasticbeanstalk"
- "internal/service/elb"
- "internal/service/elbv2"
- "internal/service/events"
- "internal/service/firehose"
- "internal/service/globalaccelerator"
- "internal/service/guardduty"
- "internal/service/iam"
- "internal/service/iot"
- "internal/service/kafka"
- "internal/service/kafkaconnect"
- "internal/service/kendra"
- "internal/service/kinesis"
- "internal/service/kinesisvideo"
- "internal/service/lexmodels"
- "internal/service/lightsail"
- "internal/service/medialive"
- "internal/service/memorydb"
- "internal/service/networkmanager"
- "internal/service/networkmonitor"
- "internal/service/oam"
- "internal/service/organizations"
- "internal/service/pinpoint"
- "internal/service/redshift"
- "internal/service/rekognition"
- "internal/service/resourcegroups"
- "internal/service/route53resolver"
- "internal/service/s3"
- "internal/service/servicediscovery"
- "internal/service/ses"
- "internal/service/signer"
- "internal/service/transcribe"
- "internal/service/transfer"
patterns:
- pattern: |
resource.TestCheckResourceAttrSet($NAME, $ATTR)
- metavariable-pattern:
metavariable: $ATTR
patterns:
- pattern-either:
- pattern: names.AttrARN
# - pattern-regex: arn
severity: ERROR
26 changes: 13 additions & 13 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -382,30 +382,30 @@ sane: prereq-go ## Run sane check
@echo "make: NOTE: NOT an exhaustive set of tests! Finds big problems only."
@TF_ACC=1 $(GO_VER) test \
./internal/service/iam/... \
-v -count $(TEST_COUNT) -parallel $(ACCTEST_PARALLELISM) -run='TestAccIAMRole_basic|TestAccIAMRole_namePrefix|TestAccIAMRole_disappears|TestAccIAMRole_InlinePolicy_basic|TestAccIAMPolicyDocumentDataSource_basic|TestAccIAMPolicyDocumentDataSource_sourceConflicting|TestAccIAMPolicyDocumentDataSource_sourceJSONValidJSON|TestAccIAMRolePolicyAttachment_basic|TestAccIAMRolePolicyAttachment_disappears|TestAccIAMRolePolicyAttachment_Disappears_role|TestAccIAMPolicy_basic|TestAccIAMPolicy_policy|TestAccIAMPolicy_tags|TestAccIAMRolePolicy_basic|TestAccIAMRolePolicy_unknownsInPolicy|TestAccIAMInstanceProfile_basic|TestAccIAMInstanceProfile_tags' -timeout $(ACCTEST_TIMEOUT)
-v -count $(TEST_COUNT) -parallel $(ACCTEST_PARALLELISM) -run='TestAccIAMRole_basic|TestAccIAMRole_namePrefix|TestAccIAMRole_disappears|TestAccIAMRole_InlinePolicy_basic|TestAccIAMPolicyDocumentDataSource_basic|TestAccIAMPolicyDocumentDataSource_sourceConflicting|TestAccIAMPolicyDocumentDataSource_sourceJSONValidJSON|TestAccIAMRolePolicyAttachment_basic|TestAccIAMRolePolicyAttachment_disappears|TestAccIAMRolePolicyAttachment_Disappears_role|TestAccIAMPolicy_basic|TestAccIAMPolicy_policy|TestAccIAMPolicy_tags|TestAccIAMRolePolicy_basic|TestAccIAMRolePolicy_unknownsInPolicy|TestAccIAMInstanceProfile_basic|TestAccIAMInstanceProfile_tags' -timeout $(ACCTEST_TIMEOUT) -vet=off
@TF_ACC=1 $(GO_VER) test \
./internal/service/logs/... \
./internal/service/ec2/... \
./internal/service/ecs/... \
./internal/service/elbv2/... \
./internal/service/kms/... \
-v -count $(TEST_COUNT) -parallel $(ACCTEST_PARALLELISM) -run='TestAccVPCSecurityGroup_basic|TestAccVPCSecurityGroup_egressMode|TestAccVPCSecurityGroup_vpcAllEgress|TestAccVPCSecurityGroupRule_race|TestAccVPCSecurityGroupRule_protocolChange|TestAccVPCDataSource_basic|TestAccVPCSubnet_basic|TestAccVPC_tenancy|TestAccVPCRouteTableAssociation_Subnet_basic|TestAccVPCRouteTable_basic|TestAccLogsGroup_basic|TestAccLogsGroup_multiple|TestAccKMSKey_basic|TestAccELBV2TargetGroup_basic|TestAccECSTaskDefinition_basic|TestAccECSService_basic' -timeout $(ACCTEST_TIMEOUT)
-v -count $(TEST_COUNT) -parallel $(ACCTEST_PARALLELISM) -run='TestAccVPCSecurityGroup_basic|TestAccVPCSecurityGroup_egressMode|TestAccVPCSecurityGroup_vpcAllEgress|TestAccVPCSecurityGroupRule_race|TestAccVPCSecurityGroupRule_protocolChange|TestAccVPCDataSource_basic|TestAccVPCSubnet_basic|TestAccVPC_tenancy|TestAccVPCRouteTableAssociation_Subnet_basic|TestAccVPCRouteTable_basic|TestAccLogsGroup_basic|TestAccLogsGroup_multiple|TestAccKMSKey_basic|TestAccELBV2TargetGroup_basic|TestAccECSTaskDefinition_basic|TestAccECSService_basic' -timeout $(ACCTEST_TIMEOUT) -vet=off
@TF_ACC=1 $(GO_VER) test \
./internal/service/lambda/... \
./internal/service/meta/... \
./internal/service/route53/... \
./internal/service/s3/... \
./internal/service/secretsmanager/... \
./internal/service/sts/... \
-v -count $(TEST_COUNT) -parallel $(ACCTEST_PARALLELISM) -run='TestAccSTSCallerIdentityDataSource_basic|TestAccMetaRegionDataSource_basic|TestAccMetaRegionDataSource_endpoint|TestAccMetaPartitionDataSource_basic|TestAccS3Bucket_Basic_basic|TestAccS3Bucket_Security_corsUpdate|TestAccS3BucketPublicAccessBlock_basic|TestAccS3BucketPolicy_basic|TestAccS3BucketACL_updateACL|TestAccRoute53Record_basic|TestAccRoute53Record_Latency_basic|TestAccRoute53ZoneDataSource_name|TestAccLambdaFunction_basic|TestAccLambdaPermission_basic|TestAccSecretsManagerSecret_basic' -timeout $(ACCTEST_TIMEOUT)
-v -count $(TEST_COUNT) -parallel $(ACCTEST_PARALLELISM) -run='TestAccSTSCallerIdentityDataSource_basic|TestAccMetaRegionDataSource_basic|TestAccMetaRegionDataSource_endpoint|TestAccMetaPartitionDataSource_basic|TestAccS3Bucket_Basic_basic|TestAccS3Bucket_Security_corsUpdate|TestAccS3BucketPublicAccessBlock_basic|TestAccS3BucketPolicy_basic|TestAccS3BucketACL_updateACL|TestAccRoute53Record_basic|TestAccRoute53Record_Latency_basic|TestAccRoute53ZoneDataSource_name|TestAccLambdaFunction_basic|TestAccLambdaPermission_basic|TestAccSecretsManagerSecret_basic' -timeout $(ACCTEST_TIMEOUT) -vet=off

sanity: prereq-go ## Run sanity check (failures allowed)
@echo "make: Sanity Check (48 tests of Top 30 resources)"
@echo "make: Like 'sane' but less output and runs all tests despite most errors"
@echo "make: NOTE: NOT an exhaustive set of tests! Finds big problems only."
@iam=`TF_ACC=1 $(GO_VER) test \
./internal/service/iam/... \
-v -count $(TEST_COUNT) -parallel $(ACCTEST_PARALLELISM) -run='TestAccIAMRole_basic|TestAccIAMRole_namePrefix|TestAccIAMRole_disappears|TestAccIAMRole_InlinePolicy_basic|TestAccIAMPolicyDocumentDataSource_basic|TestAccIAMPolicyDocumentDataSource_sourceConflicting|TestAccIAMPolicyDocumentDataSource_sourceJSONValidJSON|TestAccIAMRolePolicyAttachment_basic|TestAccIAMRolePolicyAttachment_disappears|TestAccIAMRolePolicyAttachment_Disappears_role|TestAccIAMPolicy_basic|TestAccIAMPolicy_policy|TestAccIAMPolicy_tags|TestAccIAMRolePolicy_basic|TestAccIAMRolePolicy_unknownsInPolicy|TestAccIAMInstanceProfile_basic|TestAccIAMInstanceProfile_tags' -timeout $(ACCTEST_TIMEOUT) || true` ; \
-v -count $(TEST_COUNT) -parallel $(ACCTEST_PARALLELISM) -run='TestAccIAMRole_basic|TestAccIAMRole_namePrefix|TestAccIAMRole_disappears|TestAccIAMRole_InlinePolicy_basic|TestAccIAMPolicyDocumentDataSource_basic|TestAccIAMPolicyDocumentDataSource_sourceConflicting|TestAccIAMPolicyDocumentDataSource_sourceJSONValidJSON|TestAccIAMRolePolicyAttachment_basic|TestAccIAMRolePolicyAttachment_disappears|TestAccIAMRolePolicyAttachment_Disappears_role|TestAccIAMPolicy_basic|TestAccIAMPolicy_policy|TestAccIAMPolicy_tags|TestAccIAMRolePolicy_basic|TestAccIAMRolePolicy_unknownsInPolicy|TestAccIAMInstanceProfile_basic|TestAccIAMInstanceProfile_tags' -timeout $(ACCTEST_TIMEOUT) -vet=off || true` ; \
fails1=`echo -n $$iam | grep -Fo FAIL: | wc -l | xargs` ; \
passes=$$(( 17-$$fails1 )) ; \
echo "17 of 48 complete: $$passes passed, $$fails1 failed" ; \
Expand All @@ -415,7 +415,7 @@ sanity: prereq-go ## Run sanity check (failures allowed)
./internal/service/ecs/... \
./internal/service/elbv2/... \
./internal/service/kms/... \
-v -count $(TEST_COUNT) -parallel $(ACCTEST_PARALLELISM) -run='TestAccVPCSecurityGroup_basic|TestAccVPCSecurityGroup_egressMode|TestAccVPCSecurityGroup_vpcAllEgress|TestAccVPCSecurityGroupRule_race|TestAccVPCSecurityGroupRule_protocolChange|TestAccVPCDataSource_basic|TestAccVPCSubnet_basic|TestAccVPC_tenancy|TestAccVPCRouteTableAssociation_Subnet_basic|TestAccVPCRouteTable_basic|TestAccLogsGroup_basic|TestAccLogsGroup_multiple|TestAccKMSKey_basic|TestAccELBV2TargetGroup_basic|TestAccECSTaskDefinition_basic|TestAccECSService_basic' -timeout $(ACCTEST_TIMEOUT) || true` ; \
-v -count $(TEST_COUNT) -parallel $(ACCTEST_PARALLELISM) -run='TestAccVPCSecurityGroup_basic|TestAccVPCSecurityGroup_egressMode|TestAccVPCSecurityGroup_vpcAllEgress|TestAccVPCSecurityGroupRule_race|TestAccVPCSecurityGroupRule_protocolChange|TestAccVPCDataSource_basic|TestAccVPCSubnet_basic|TestAccVPC_tenancy|TestAccVPCRouteTableAssociation_Subnet_basic|TestAccVPCRouteTable_basic|TestAccLogsGroup_basic|TestAccLogsGroup_multiple|TestAccKMSKey_basic|TestAccELBV2TargetGroup_basic|TestAccECSTaskDefinition_basic|TestAccECSService_basic' -timeout $(ACCTEST_TIMEOUT) -vet=off || true` ; \
fails2=`echo -n $$logs | grep -Fo FAIL: | wc -l | xargs` ; \
tot_fails=$$(( $$fails1+$$fails2 )) ; \
passes=$$(( 33-$$tot_fails )) ; \
Expand All @@ -427,7 +427,7 @@ sanity: prereq-go ## Run sanity check (failures allowed)
./internal/service/s3/... \
./internal/service/secretsmanager/... \
./internal/service/sts/... \
-v -count $(TEST_COUNT) -parallel $(ACCTEST_PARALLELISM) -run='TestAccSTSCallerIdentityDataSource_basic|TestAccMetaRegionDataSource_basic|TestAccMetaRegionDataSource_endpoint|TestAccMetaPartitionDataSource_basic|TestAccS3Bucket_Basic_basic|TestAccS3Bucket_Security_corsUpdate|TestAccS3BucketPublicAccessBlock_basic|TestAccS3BucketPolicy_basic|TestAccS3BucketACL_updateACL|TestAccRoute53Record_basic|TestAccRoute53Record_Latency_basic|TestAccRoute53ZoneDataSource_name|TestAccLambdaFunction_basic|TestAccLambdaPermission_basic|TestAccSecretsManagerSecret_basic' -timeout $(ACCTEST_TIMEOUT) || true` ; \
-v -count $(TEST_COUNT) -parallel $(ACCTEST_PARALLELISM) -run='TestAccSTSCallerIdentityDataSource_basic|TestAccMetaRegionDataSource_basic|TestAccMetaRegionDataSource_endpoint|TestAccMetaPartitionDataSource_basic|TestAccS3Bucket_Basic_basic|TestAccS3Bucket_Security_corsUpdate|TestAccS3BucketPublicAccessBlock_basic|TestAccS3BucketPolicy_basic|TestAccS3BucketACL_updateACL|TestAccRoute53Record_basic|TestAccRoute53Record_Latency_basic|TestAccRoute53ZoneDataSource_name|TestAccLambdaFunction_basic|TestAccLambdaPermission_basic|TestAccSecretsManagerSecret_basic' -timeout $(ACCTEST_TIMEOUT) -vet=off || true` ; \
fails3=`echo -n $$lambda | grep -Fo FAIL: | wc -l | xargs` ; \
tot_fails=$$(( $$fails1+$$fails2+$$fails3 )) ; \
passes=$$(( 48-$$tot_fails )) ; \
Expand Down Expand Up @@ -567,11 +567,11 @@ sweep: prereq-go ## Run sweepers
# make sweep SWEEPARGS=-sweep-run=aws_example_thing
# set SWEEPARGS=-sweep-allow-failures to continue after first failure
@echo "WARNING: This will destroy infrastructure. Use only in development accounts."
$(GO_VER) test $(SWEEP_DIR) -v -sweep=$(SWEEP) $(SWEEPARGS) -timeout $(SWEEP_TIMEOUT)
$(GO_VER) test $(SWEEP_DIR) -v -sweep=$(SWEEP) $(SWEEPARGS) -timeout $(SWEEP_TIMEOUT) -vet=off

sweeper: prereq-go ## Run sweepers with failures allowed
@echo "WARNING: This will destroy infrastructure. Use only in development accounts."
$(GO_VER) test $(SWEEP_DIR) -v -sweep=$(SWEEP) -sweep-allow-failures -timeout $(SWEEP_TIMEOUT)
$(GO_VER) test $(SWEEP_DIR) -v -sweep=$(SWEEP) -sweep-allow-failures -timeout $(SWEEP_TIMEOUT) -vet=off

sweeper-check: sweeper-linked sweeper-unlinked ## [CI] Provider Checks / Sweeper Linked, Unlinked

Expand All @@ -594,19 +594,19 @@ sweeper-unlinked: go-build ## [CI] Provider Checks / Sweeper Functions Not Linke
(echo "Expected `strings` to detect no sweeper function names in provider binary."; exit 1)

t: prereq-go fmt-check ## Run acceptance tests (similar to testacc)
TF_ACC=1 $(GO_VER) test ./$(PKG_NAME)/... -v -count $(TEST_COUNT) -parallel $(ACCTEST_PARALLELISM) $(RUNARGS) $(TESTARGS) -timeout $(ACCTEST_TIMEOUT)
TF_ACC=1 $(GO_VER) test ./$(PKG_NAME)/... -v -count $(TEST_COUNT) -parallel $(ACCTEST_PARALLELISM) $(RUNARGS) $(TESTARGS) -timeout $(ACCTEST_TIMEOUT) -vet=off

test: prereq-go fmt-check ## Run unit tests
@echo "make: Running unit tests..."
$(GO_VER) test -count $(TEST_COUNT) $(TEST) $(TESTARGS) -timeout=15m
$(GO_VER) test -count $(TEST_COUNT) $(TEST) $(TESTARGS) -timeout=15m -vet=off

test-compile: prereq-go ## Test package compilation
@if [ "$(TEST)" = "./..." ]; then \
echo "ERROR: Set TEST to a specific package. For example,"; \
echo " make test-compile TEST=./$(PKG_NAME)"; \
exit 1; \
fi
$(GO_VER) test -c $(TEST) $(TESTARGS)
$(GO_VER) test -c $(TEST) $(TESTARGS) -vet=off

testacc: prereq-go fmt-check ## Run acceptance tests
@if [ "$(TESTARGS)" = "-run=TestAccXXX" ]; then \
Expand All @@ -619,7 +619,7 @@ testacc: prereq-go fmt-check ## Run acceptance tests
echo "See the contributing guide for more information: https://hashicorp.github.io/terraform-provider-aws/running-and-writing-acceptance-tests"; \
exit 1; \
fi
TF_ACC=1 $(GO_VER) test ./$(PKG_NAME)/... -v -count $(TEST_COUNT) -parallel $(ACCTEST_PARALLELISM) $(RUNARGS) $(TESTARGS) -timeout $(ACCTEST_TIMEOUT)
TF_ACC=1 $(GO_VER) test ./$(PKG_NAME)/... -v -count $(TEST_COUNT) -parallel $(ACCTEST_PARALLELISM) $(RUNARGS) $(TESTARGS) -timeout $(ACCTEST_TIMEOUT) -vet=off

testacc-lint: ## [CI] Acceptance Test Linting / terrafmt
@echo "make: Acceptance Test Linting / terrafmt..."
Expand All @@ -635,7 +635,7 @@ testacc-lint-fix: ## Fix acceptance test linter findings

testacc-short: prereq-go fmt-check ## Run acceptace tests with the -short flag
@echo "Running acceptance tests with -short flag"
TF_ACC=1 $(GO_VER) test ./$(PKG_NAME)/... -v -short -count $(TEST_COUNT) -parallel $(ACCTEST_PARALLELISM) $(RUNARGS) $(TESTARGS) -timeout $(ACCTEST_TIMEOUT)
TF_ACC=1 $(GO_VER) test ./$(PKG_NAME)/... -v -short -count $(TEST_COUNT) -parallel $(ACCTEST_PARALLELISM) $(RUNARGS) $(TESTARGS) -timeout $(ACCTEST_TIMEOUT) -vet=off

testacc-tflint: testacc-tflint-dir testacc-tflint-embedded ## [CI] Acceptance Test Linting / tflint

Expand Down
68 changes: 68 additions & 0 deletions internal/acctest/arn.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package acctest

import (
"context"
"fmt"
"strings"

"github.com/hashicorp/terraform-plugin-testing/helper/resource"
"github.com/hashicorp/terraform-plugin-testing/terraform"
)

func CheckResourceAttrGlobalARNFormat(ctx context.Context, resourceName, attributeName, arnService, arnFormat string) resource.TestCheckFunc {
return func(s *terraform.State) error {
resource, err := populateARNFormat(s, resourceName, arnFormat)
if err != nil {
return err
}

return CheckResourceAttrGlobalARN(ctx, resourceName, attributeName, arnService, resource)(s)
}
}

func CheckResourceAttrRegionalARNFormat(ctx context.Context, resourceName, attributeName, arnService, arnFormat string) resource.TestCheckFunc {
return func(s *terraform.State) error {
resource, err := populateARNFormat(s, resourceName, arnFormat)
if err != nil {
return err
}

return CheckResourceAttrRegionalARN(ctx, resourceName, attributeName, arnService, resource)(s)
}
}

func populateARNFormat(s *terraform.State, resourceName, arnFormat string) (string, error) {
is, err := PrimaryInstanceState(s, resourceName)
if err != nil {
return "", err
}

var buf strings.Builder
str := arnFormat
for str != "" {
var (
stuff string
found bool
)
stuff, str, found = strings.Cut(str, "{")
buf.WriteString(stuff)
if found {
var param string
param, str, found = strings.Cut(str, "}")
if !found {
return "", fmt.Errorf("missing closing '}' in ARN format %q", arnFormat)
}

attr, ok := is.Attributes[param]
if !ok {
return "", fmt.Errorf("attribute %q not found in resource %q, referenced in ARN format %q", param, resourceName, arnFormat)
}
buf.WriteString(attr)
}
}

return buf.String(), nil
}
4 changes: 1 addition & 3 deletions internal/service/amp/scraper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,7 @@ func TestAccAMPScraper_basic(t *testing.T) {
Check: resource.ComposeAggregateTestCheckFunc(
testAccCheckScraperExists(ctx, resourceName, &scraper),
resource.TestCheckNoResourceAttr(resourceName, names.AttrAlias),
func(s *terraform.State) error {
return acctest.CheckResourceAttrRegionalARN(ctx, resourceName, names.AttrARN, "aps", "scraper/"+aws.ToString(scraper.ScraperId))(s)
},
acctest.CheckResourceAttrRegionalARNFormat(ctx, resourceName, names.AttrARN, "aps", "scraper/{id}"),
resource.TestCheckResourceAttr(resourceName, "destination.#", "1"),
resource.TestCheckResourceAttr(resourceName, "destination.0.amp.#", "1"),
func(s *terraform.State) error {
Expand Down
4 changes: 1 addition & 3 deletions internal/service/amp/workspace_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@ func TestAccAMPWorkspace_basic(t *testing.T) {
Check: resource.ComposeAggregateTestCheckFunc(
testAccCheckWorkspaceExists(ctx, resourceName, &v),
resource.TestCheckResourceAttr(resourceName, names.AttrAlias, ""),
func(s *terraform.State) error {
return acctest.CheckResourceAttrRegionalARN(ctx, resourceName, names.AttrARN, "aps", "workspace/"+aws.ToString(v.WorkspaceId))(s)
},
acctest.CheckResourceAttrRegionalARNFormat(ctx, resourceName, names.AttrARN, "aps", "workspace/{id}"),
func(s *terraform.State) error {
return resource.TestCheckResourceAttr(resourceName, names.AttrID, aws.ToString(v.WorkspaceId))(s)
},
Expand Down
Loading

0 comments on commit 15776d9

Please sign in to comment.