diff --git a/aws/data_source_aws_lambda_function.go b/aws/data_source_aws_lambda_function.go index 2af279f2670..5174f9e9bd0 100644 --- a/aws/data_source_aws_lambda_function.go +++ b/aws/data_source_aws_lambda_function.go @@ -6,6 +6,7 @@ import ( "strings" "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/endpoints" "github.com/aws/aws-sdk-go/service/lambda" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/terraform-providers/terraform-provider-aws/aws/internal/keyvaluetags" @@ -303,6 +304,15 @@ func dataSourceAwsLambdaFunctionRead(d *schema.ResourceData, meta interface{}) e return fmt.Errorf("error setting file_system_config: %s", err) } + // Currently, this functionality is only enabled in AWS Commercial partition + // and other partitions return ambiguous error codes (e.g. AccessDeniedException + // in AWS GovCloud (US)) so we cannot just ignore the error as would typically. + if meta.(*AWSClient).partition != endpoints.AwsPartitionID { + d.SetId(aws.StringValue(function.FunctionName)) + + return nil + } + // Get Code Signing Config Output // If code signing config output exists, set it to that value, otherwise set it empty. codeSigningConfigInput := &lambda.GetFunctionCodeSigningConfigInput{ diff --git a/aws/data_source_aws_signer_signing_job_test.go b/aws/data_source_aws_signer_signing_job_test.go index 3dea101ad40..65813898006 100644 --- a/aws/data_source_aws_signer_signing_job_test.go +++ b/aws/data_source_aws_signer_signing_job_test.go @@ -9,17 +9,16 @@ import ( ) func TestAccDataSourceAWSSignerSigningJob_basic(t *testing.T) { - rString := acctest.RandString(48) - profileName := fmt.Sprintf("tf_acc_sp_basic_%s", rString) + rName := acctest.RandomWithPrefix("tf-acc-test") dataSourceName := "data.aws_signer_signing_job.test" - resourceName := "aws_signer_signing_job.job_test" + resourceName := "aws_signer_signing_job.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, + PreCheck: func() { testAccPreCheck(t); testAccPreCheckSingerSigningProfile(t, "AWSLambda-SHA384-ECDSA") }, Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccDataSourceAWSSignerSigningJobConfigBasic(profileName), + Config: testAccDataSourceAWSSignerSigningJobConfigBasic(rName), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttrPair(dataSourceName, "status", resourceName, "status"), resource.TestCheckResourceAttrPair(dataSourceName, "job_owner", resourceName, "job_owner"), @@ -31,17 +30,17 @@ func TestAccDataSourceAWSSignerSigningJob_basic(t *testing.T) { }) } -func testAccDataSourceAWSSignerSigningJobConfigBasic(profileName string) string { +func testAccDataSourceAWSSignerSigningJobConfigBasic(rName string) string { return fmt.Sprintf(` data "aws_caller_identity" "current" {} -resource "aws_signer_signing_profile" "test_sp" { +resource "aws_signer_signing_profile" "test" { platform_id = "AWSLambda-SHA384-ECDSA" - name = "%s" + name = replace(%[1]q, "-", "_") } -resource "aws_s3_bucket" "bucket" { - bucket = "tf-signer-signing-bucket" +resource "aws_s3_bucket" "source" { + bucket = "%[1]s-source" versioning { enabled = true @@ -50,36 +49,37 @@ resource "aws_s3_bucket" "bucket" { force_destroy = true } -resource "aws_s3_bucket" "dest_bucket" { - bucket = "tf-signer-signing-dest-bucket" +resource "aws_s3_bucket" "destination" { + bucket = "%[1]s-destination" force_destroy = true } -resource "aws_s3_bucket_object" "lambda_signing_code" { - bucket = aws_s3_bucket.bucket.bucket +resource "aws_s3_bucket_object" "source" { + bucket = aws_s3_bucket.source.bucket key = "lambdatest.zip" source = "test-fixtures/lambdatest.zip" } -resource "aws_signer_signing_job" "job_test" { - profile_name = aws_signer_signing_profile.test_sp.name +resource "aws_signer_signing_job" "test" { + profile_name = aws_signer_signing_profile.test.name source { s3 { - bucket = aws_s3_bucket.bucket.bucket - key = aws_s3_bucket_object.lambda_signing_code.key - version = aws_s3_bucket_object.lambda_signing_code.version_id + bucket = aws_s3_bucket_object.source.bucket + key = aws_s3_bucket_object.source.key + version = aws_s3_bucket_object.source.version_id } } destination { s3 { - bucket = aws_s3_bucket.dest_bucket.bucket + bucket = aws_s3_bucket.destination.bucket } } } data "aws_signer_signing_job" "test" { - job_id = aws_signer_signing_job.job_test.job_id -}`, profileName) + job_id = aws_signer_signing_job.test.job_id +} +`, rName) } diff --git a/aws/data_source_aws_signer_signing_profile_test.go b/aws/data_source_aws_signer_signing_profile_test.go index a440cbbf243..c8f96b41d98 100644 --- a/aws/data_source_aws_signer_signing_profile_test.go +++ b/aws/data_source_aws_signer_signing_profile_test.go @@ -15,7 +15,7 @@ func TestAccDataSourceAWSSignerSigningProfile_basic(t *testing.T) { profileName := fmt.Sprintf("tf_acc_sp_basic_%s", rString) resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, + PreCheck: func() { testAccPreCheck(t); testAccPreCheckSingerSigningProfile(t, "AWSLambda-SHA384-ECDSA") }, Providers: testAccProviders, Steps: []resource.TestStep{ { diff --git a/aws/resource_aws_lambda_function.go b/aws/resource_aws_lambda_function.go index d93427ec539..d509ed2a232 100644 --- a/aws/resource_aws_lambda_function.go +++ b/aws/resource_aws_lambda_function.go @@ -12,6 +12,7 @@ import ( "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/arn" "github.com/aws/aws-sdk-go/aws/awserr" + "github.com/aws/aws-sdk-go/aws/endpoints" "github.com/aws/aws-sdk-go/service/lambda" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" @@ -711,8 +712,13 @@ func resourceAwsLambdaFunctionRead(d *schema.ResourceData, meta interface{}) err invokeArn := lambdaFunctionInvokeArn(*function.FunctionArn, meta) d.Set("invoke_arn", invokeArn) - // Get Code Signing Config Output - // If code signing config output exists, set it to that value, otherwise set it empty. + // Currently, this functionality is only enabled in AWS Commercial partition + // and other partitions return ambiguous error codes (e.g. AccessDeniedException + // in AWS GovCloud (US)) so we cannot just ignore the error as would typically. + if meta.(*AWSClient).partition != endpoints.AwsPartitionID { + return nil + } + codeSigningConfigInput := &lambda.GetFunctionCodeSigningConfigInput{ FunctionName: aws.String(d.Get("function_name").(string)), } diff --git a/aws/resource_aws_lambda_function_test.go b/aws/resource_aws_lambda_function_test.go index c9c331fe60f..8278f75208f 100644 --- a/aws/resource_aws_lambda_function_test.go +++ b/aws/resource_aws_lambda_function_test.go @@ -191,7 +191,7 @@ func TestAccAWSLambdaFunction_codeSigningConfig(t *testing.T) { cscUpdateResourceName := "aws_lambda_code_signing_config.code_signing_config_2" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, + PreCheck: func() { testAccPreCheck(t); testAccPreCheckSingerSigningProfile(t, "AWSLambda-SHA384-ECDSA") }, Providers: testAccProviders, CheckDestroy: testAccCheckLambdaFunctionDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_signer_signing_job_test.go b/aws/resource_aws_signer_signing_job_test.go index aa6c0d59ca2..5240820d008 100644 --- a/aws/resource_aws_signer_signing_job_test.go +++ b/aws/resource_aws_signer_signing_job_test.go @@ -12,23 +12,22 @@ import ( ) func TestAccAWSSignerSigningJob_basic(t *testing.T) { - resourceName := "aws_signer_signing_job.test_job" - profileResourceName := "aws_signer_signing_profile.test_sp" - rString := acctest.RandString(48) - profileName := fmt.Sprintf("tf_acc_sp_basic_%s", rString) + rName := acctest.RandomWithPrefix("tf-acc-test") + resourceName := "aws_signer_signing_job.test" + profileResourceName := "aws_signer_signing_profile.test" var job signer.DescribeSigningJobOutput var conf signer.GetSigningProfileOutput resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, + PreCheck: func() { testAccPreCheck(t); testAccPreCheckSingerSigningProfile(t, "AWSLambda-SHA384-ECDSA") }, Providers: testAccProviders, CheckDestroy: nil, Steps: []resource.TestStep{ { - Config: testAccAWSSignerSigningJobConfig(profileName), + Config: testAccAWSSignerSigningJobConfig(rName), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSignerSigningProfileExists(profileResourceName, profileName, &conf), + testAccCheckAWSSignerSigningProfileExists(profileResourceName, &conf), testAccCheckAWSSignerSigningJobExists(resourceName, &job), resource.TestCheckResourceAttr(resourceName, "platform_id", "AWSLambda-SHA384-ECDSA"), resource.TestCheckResourceAttr(resourceName, "platform_display_name", "AWS Lambda"), @@ -40,17 +39,17 @@ func TestAccAWSSignerSigningJob_basic(t *testing.T) { } -func testAccAWSSignerSigningJobConfig(profileName string) string { +func testAccAWSSignerSigningJobConfig(rName string) string { return fmt.Sprintf(` data "aws_caller_identity" "current" {} -resource "aws_signer_signing_profile" "test_sp" { +resource "aws_signer_signing_profile" "test" { platform_id = "AWSLambda-SHA384-ECDSA" - name = "%s" + name = replace(%[1]q, "-", "_") } -resource "aws_s3_bucket" "bucket" { - bucket = "tf-signer-signing-bucket" +resource "aws_s3_bucket" "source" { + bucket = "%[1]s-source" versioning { enabled = true @@ -59,34 +58,35 @@ resource "aws_s3_bucket" "bucket" { force_destroy = true } -resource "aws_s3_bucket" "dest_bucket" { - bucket = "tf-signer-signing-dest-bucket" +resource "aws_s3_bucket" "destination" { + bucket = "%[1]s" force_destroy = true } -resource "aws_s3_bucket_object" "lambda_signing_code" { - bucket = aws_s3_bucket.bucket.bucket +resource "aws_s3_bucket_object" "source" { + bucket = aws_s3_bucket.source.bucket key = "lambdatest.zip" source = "test-fixtures/lambdatest.zip" } -resource "aws_signer_signing_job" "test_job" { - profile_name = aws_signer_signing_profile.test_sp.name +resource "aws_signer_signing_job" "test" { + profile_name = aws_signer_signing_profile.test.name source { s3 { - bucket = aws_s3_bucket.bucket.bucket - key = aws_s3_bucket_object.lambda_signing_code.key - version = aws_s3_bucket_object.lambda_signing_code.version_id + bucket = aws_s3_bucket_object.source.bucket + key = aws_s3_bucket_object.source.key + version = aws_s3_bucket_object.source.version_id } } destination { s3 { - bucket = aws_s3_bucket.dest_bucket.bucket + bucket = aws_s3_bucket.destination.bucket } } -}`, profileName) +} +`, rName) } func testAccCheckAWSSignerSigningJobExists(res string, job *signer.DescribeSigningJobOutput) resource.TestCheckFunc { diff --git a/aws/resource_aws_signer_signing_profile_permission_test.go b/aws/resource_aws_signer_signing_profile_permission_test.go index b96255dbe22..badcabb0b53 100644 --- a/aws/resource_aws_signer_signing_profile_permission_test.go +++ b/aws/resource_aws_signer_signing_profile_permission_test.go @@ -22,7 +22,7 @@ func TestAccAWSSignerSigningProfilePermission_basic(t *testing.T) { var sppconf signer.ListProfilePermissionsOutput resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, + PreCheck: func() { testAccPreCheck(t); testAccPreCheckSingerSigningProfile(t, "AWSLambda-SHA384-ECDSA") }, Providers: testAccProviders, CheckDestroy: testAccCheckAWSSignerSigningProfileDestroy, Steps: []resource.TestStep{ @@ -30,7 +30,7 @@ func TestAccAWSSignerSigningProfilePermission_basic(t *testing.T) { Config: testAccAWSSignerSigningProfilePermissionConfig(profileName), Destroy: false, Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSignerSigningProfileExists(profileResourceName, profileName, &conf), + testAccCheckAWSSignerSigningProfileExists(profileResourceName, &conf), testAccCheckAWSSignerSigningProfilePermissionExists(resourceName, profileName, &sppconf), naming.TestCheckResourceAttrNameGenerated(resourceName, "statement_id"), ), @@ -55,7 +55,7 @@ func TestAccAWSSignerSigningProfilePermission_GetSigningProfile(t *testing.T) { var sppconf signer.ListProfilePermissionsOutput resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, + PreCheck: func() { testAccPreCheck(t); testAccPreCheckSingerSigningProfile(t, "AWSLambda-SHA384-ECDSA") }, Providers: testAccProviders, CheckDestroy: testAccCheckAWSSignerSigningProfileDestroy, Steps: []resource.TestStep{ @@ -63,7 +63,7 @@ func TestAccAWSSignerSigningProfilePermission_GetSigningProfile(t *testing.T) { Config: testAccAWSSignerSigningProfilePermissionGetSP(profileName), Destroy: false, Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSignerSigningProfileExists(profileResourceName, profileName, &conf), + testAccCheckAWSSignerSigningProfileExists(profileResourceName, &conf), testAccCheckAWSSignerSigningProfilePermissionExists(resourceName, profileName, &sppconf), ), }, @@ -77,7 +77,7 @@ func TestAccAWSSignerSigningProfilePermission_GetSigningProfile(t *testing.T) { Config: testAccAWSSignerSigningProfilePermissionRevokeSignature(profileName), Destroy: false, Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSignerSigningProfileExists(profileResourceName, profileName, &conf), + testAccCheckAWSSignerSigningProfileExists(profileResourceName, &conf), testAccCheckAWSSignerSigningProfilePermissionExists(resourceName, profileName, &sppconf), ), }, @@ -96,14 +96,14 @@ func TestAccAWSSignerSigningProfilePermission_StartSigningJob_GetSP(t *testing.T var sppconf signer.ListProfilePermissionsOutput resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, + PreCheck: func() { testAccPreCheck(t); testAccPreCheckSingerSigningProfile(t, "AWSLambda-SHA384-ECDSA") }, Providers: testAccProviders, CheckDestroy: testAccCheckAWSSignerSigningProfileDestroy, Steps: []resource.TestStep{ { Config: testAccAWSSignerSigningProfilePermissionStartSigningJobGetSP(profileName), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSignerSigningProfileExists(profileResourceName, profileName, &conf), + testAccCheckAWSSignerSigningProfileExists(profileResourceName, &conf), testAccCheckAWSSignerSigningProfilePermissionExists(resourceName1, profileName, &sppconf), testAccCheckAWSSignerSigningProfilePermissionExists(resourceName2, profileName, &sppconf), ), @@ -129,7 +129,7 @@ func TestAccAWSSignerSigningProfilePermission_StatementPrefix(t *testing.T) { var sppconf signer.ListProfilePermissionsOutput resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, + PreCheck: func() { testAccPreCheck(t); testAccPreCheckSingerSigningProfile(t, "AWSLambda-SHA384-ECDSA") }, Providers: testAccProviders, CheckDestroy: testAccCheckAWSSignerSigningProfileDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_signer_signing_profile_test.go b/aws/resource_aws_signer_signing_profile_test.go index 93ae7268fed..14d144bcb1b 100644 --- a/aws/resource_aws_signer_signing_profile_test.go +++ b/aws/resource_aws_signer_signing_profile_test.go @@ -21,14 +21,14 @@ func TestAccAWSSignerSigningProfile_basic(t *testing.T) { var conf signer.GetSigningProfileOutput resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, + PreCheck: func() { testAccPreCheck(t); testAccPreCheckSingerSigningProfile(t, "AWSLambda-SHA384-ECDSA") }, Providers: testAccProviders, CheckDestroy: testAccCheckAWSSignerSigningProfileDestroy, Steps: []resource.TestStep{ { Config: testAccAWSSignerSigningProfileConfigProvidedName(profileName), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSignerSigningProfileExists(resourceName, profileName, &conf), + testAccCheckAWSSignerSigningProfileExists(resourceName, &conf), resource.TestMatchResourceAttr(resourceName, "name", regexp.MustCompile("^[a-zA-Z0-9_]{0,64}$")), resource.TestCheckResourceAttr(resourceName, "platform_id", "AWSLambda-SHA384-ECDSA"), @@ -51,14 +51,14 @@ func TestAccAWSSignerSigningProfile_GenerateNameWithNamePrefix(t *testing.T) { var conf signer.GetSigningProfileOutput resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, + PreCheck: func() { testAccPreCheck(t); testAccPreCheckSingerSigningProfile(t, "AWSLambda-SHA384-ECDSA") }, Providers: testAccProviders, CheckDestroy: testAccCheckAWSSignerSigningProfileDestroy, Steps: []resource.TestStep{ { Config: testAccAWSSignerSigningProfileConfig(namePrefix), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSignerSigningProfileGeneratedNameExists(resourceName, &conf), + testAccCheckAWSSignerSigningProfileExists(resourceName, &conf), resource.TestCheckResourceAttr(resourceName, "platform_id", "AWSLambda-SHA384-ECDSA"), ), }, @@ -72,14 +72,14 @@ func TestAccAWSSignerSigningProfile_GenerateName(t *testing.T) { var conf signer.GetSigningProfileOutput resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, + PreCheck: func() { testAccPreCheck(t); testAccPreCheckSingerSigningProfile(t, "AWSLambda-SHA384-ECDSA") }, Providers: testAccProviders, CheckDestroy: testAccCheckAWSSignerSigningProfileDestroy, Steps: []resource.TestStep{ { Config: testAccAWSSignerSigningProfileConfigGenerateName(), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSignerSigningProfileGeneratedNameExists(resourceName, &conf), + testAccCheckAWSSignerSigningProfileExists(resourceName, &conf), resource.TestCheckResourceAttr(resourceName, "platform_id", "AWSLambda-SHA384-ECDSA"), ), }, @@ -94,14 +94,14 @@ func TestAccAWSSignerSigningProfile_tags(t *testing.T) { var conf signer.GetSigningProfileOutput resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, + PreCheck: func() { testAccPreCheck(t); testAccPreCheckSingerSigningProfile(t, "AWSLambda-SHA384-ECDSA") }, Providers: testAccProviders, CheckDestroy: testAccCheckAWSSignerSigningProfileDestroy, Steps: []resource.TestStep{ { Config: testAccAWSSignerSigningProfileConfigTags(namePrefix), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSignerSigningProfileGeneratedNameExists(resourceName, &conf), + testAccCheckAWSSignerSigningProfileExists(resourceName, &conf), resource.TestCheckResourceAttr(resourceName, "tags.tag1", "value1"), resource.TestCheckResourceAttr(resourceName, "tags.tag2", "value2"), ), @@ -109,7 +109,7 @@ func TestAccAWSSignerSigningProfile_tags(t *testing.T) { { Config: testAccAWSSignerSigningProfileUpdateTags(), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSignerSigningProfileGeneratedNameExists(resourceName, &conf), + testAccCheckAWSSignerSigningProfileExists(resourceName, &conf), resource.TestCheckResourceAttr(resourceName, "tags.tag1", "prod"), ), }, @@ -124,14 +124,14 @@ func TestAccAWSSignerSigningProfile_SignatureValidityPeriod(t *testing.T) { var conf signer.GetSigningProfileOutput resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, + PreCheck: func() { testAccPreCheck(t); testAccPreCheckSingerSigningProfile(t, "AWSLambda-SHA384-ECDSA") }, Providers: testAccProviders, CheckDestroy: testAccCheckAWSSignerSigningProfileDestroy, Steps: []resource.TestStep{ { Config: testAccAWSSignerSigningProfileConfigSVP(namePrefix), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSignerSigningProfileGeneratedNameExists(resourceName, &conf), + testAccCheckAWSSignerSigningProfileExists(resourceName, &conf), resource.TestCheckResourceAttr(resourceName, "signature_validity_period.0.type", "DAYS"), resource.TestCheckResourceAttr(resourceName, "signature_validity_period.0.value", "10"), ), @@ -139,7 +139,7 @@ func TestAccAWSSignerSigningProfile_SignatureValidityPeriod(t *testing.T) { { Config: testAccAWSSignerSigningProfileUpdateSVP(), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSignerSigningProfileGeneratedNameExists(resourceName, &conf), + testAccCheckAWSSignerSigningProfileExists(resourceName, &conf), resource.TestCheckResourceAttr(resourceName, "signature_validity_period.0.type", "MONTHS"), resource.TestCheckResourceAttr(resourceName, "signature_validity_period.0.value", "10"), ), @@ -148,6 +148,38 @@ func TestAccAWSSignerSigningProfile_SignatureValidityPeriod(t *testing.T) { }) } +func testAccPreCheckSingerSigningProfile(t *testing.T, platformID string) { + conn := testAccProvider.Meta().(*AWSClient).signerconn + + input := &signer.ListSigningPlatformsInput{} + + output, err := conn.ListSigningPlatforms(input) + + if testAccPreCheckSkipError(err) { + t.Skipf("skipping acceptance testing: %s", err) + } + + if err != nil { + t.Fatalf("unexpected PreCheck error: %s", err) + } + + if output == nil { + t.Skip("skipping acceptance testing: empty response") + } + + for _, platform := range output.Platforms { + if platform == nil { + continue + } + + if aws.StringValue(platform.PlatformId) == platformID { + return + } + } + + t.Skipf("skipping acceptance testing: Signing Platform (%s) not found", platformID) +} + func testAccAWSSignerSigningProfileConfig(namePrefix string) string { return baseAccAWSSignerSigningProfileConfig(namePrefix) } @@ -226,35 +258,7 @@ resource "aws_signer_signing_profile" "test_sp" { `, namePrefix) } -func testAccCheckAWSSignerSigningProfileExists(res, profileName string, sp *signer.GetSigningProfileOutput) resource.TestCheckFunc { - return func(s *terraform.State) error { - rs, ok := s.RootModule().Resources[res] - if !ok { - return fmt.Errorf("Signing profile not found: %s", res) - } - - if rs.Primary.ID == "" { - return fmt.Errorf("Signing Profile with that ARN does not exist") - } - - conn := testAccProvider.Meta().(*AWSClient).signerconn - - params := &signer.GetSigningProfileInput{ - ProfileName: aws.String(profileName), - } - - getSp, err := conn.GetSigningProfile(params) - if err != nil { - return err - } - - *sp = *getSp - - return nil - } -} - -func testAccCheckAWSSignerSigningProfileGeneratedNameExists(res string, sp *signer.GetSigningProfileOutput) resource.TestCheckFunc { +func testAccCheckAWSSignerSigningProfileExists(res string, sp *signer.GetSigningProfileOutput) resource.TestCheckFunc { return func(s *terraform.State) error { rs, ok := s.RootModule().Resources[res] if !ok {