From f140e530066030fd88deb5c9b7c3e365c898ac96 Mon Sep 17 00:00:00 2001 From: Graham Davison Date: Mon, 27 Apr 2020 11:37:51 -0700 Subject: [PATCH] Updates SSM acceptance tests to use ARN testing check functions --- aws/data_source_aws_ssm_parameter_test.go | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/aws/data_source_aws_ssm_parameter_test.go b/aws/data_source_aws_ssm_parameter_test.go index 1c7e6ee551a..70ed63a7add 100644 --- a/aws/data_source_aws_ssm_parameter_test.go +++ b/aws/data_source_aws_ssm_parameter_test.go @@ -2,7 +2,6 @@ package aws import ( "fmt" - "regexp" "testing" "github.com/hashicorp/terraform-plugin-sdk/helper/acctest" @@ -22,8 +21,7 @@ func TestAccAWSSsmParameterDataSource_basic(t *testing.T) { { Config: testAccCheckAwsSsmParameterDataSourceConfig(name, "false"), Check: resource.ComposeAggregateTestCheckFunc( - resource.TestMatchResourceAttr(resourceName, "arn", - regexp.MustCompile(fmt.Sprintf("^arn:aws:ssm:[a-z0-9-]+:[0-9]{12}:parameter/%s$", name))), + resource.TestCheckResourceAttrPair(resourceName, "arn", "aws_ssm_parameter.test", "arn"), resource.TestCheckResourceAttr(resourceName, "name", name), resource.TestCheckResourceAttr(resourceName, "type", "String"), resource.TestCheckResourceAttr(resourceName, "value", "TestValue"), @@ -34,8 +32,7 @@ func TestAccAWSSsmParameterDataSource_basic(t *testing.T) { { Config: testAccCheckAwsSsmParameterDataSourceConfig(name, "true"), Check: resource.ComposeAggregateTestCheckFunc( - resource.TestMatchResourceAttr(resourceName, "arn", - regexp.MustCompile(fmt.Sprintf("^arn:aws:ssm:[a-z0-9-]+:[0-9]{12}:parameter/%s$", name))), + resource.TestCheckResourceAttrPair(resourceName, "arn", "aws_ssm_parameter.test", "arn"), resource.TestCheckResourceAttr(resourceName, "name", name), resource.TestCheckResourceAttr(resourceName, "type", "String"), resource.TestCheckResourceAttr(resourceName, "value", "TestValue"), @@ -59,8 +56,7 @@ func TestAccAWSSsmParameterDataSource_fullPath(t *testing.T) { { Config: testAccCheckAwsSsmParameterDataSourceConfig(name, "false"), Check: resource.ComposeAggregateTestCheckFunc( - resource.TestMatchResourceAttr(resourceName, "arn", - regexp.MustCompile(fmt.Sprintf("^arn:aws:ssm:[a-z0-9-]+:[0-9]{12}:parameter%s$", name))), + resource.TestCheckResourceAttrPair(resourceName, "arn", "aws_ssm_parameter.test", "arn"), resource.TestCheckResourceAttr(resourceName, "name", name), resource.TestCheckResourceAttr(resourceName, "type", "String"), resource.TestCheckResourceAttr(resourceName, "value", "TestValue"),