diff --git a/internal/service/servicecatalog/provisioned_product_test.go b/internal/service/servicecatalog/provisioned_product_test.go index 2421d5f47ae..aa0fb287707 100644 --- a/internal/service/servicecatalog/provisioned_product_test.go +++ b/internal/service/servicecatalog/provisioned_product_test.go @@ -142,55 +142,60 @@ func TestAccServiceCatalogProvisionedProduct_update(t *testing.T) { }) } -func TestAccServiceCatalogProvisionedProduct_ProductName_update(t *testing.T) { - ctx := acctest.Context(t) - resourceName := "aws_servicecatalog_provisioned_product.test" - - rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) - productName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) - productNameUpdated := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) - domain := fmt.Sprintf("http://%s", acctest.RandomDomainName()) - var pprod servicecatalog.ProvisionedProductDetail - - resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { acctest.PreCheck(ctx, t) }, - ErrorCheck: acctest.ErrorCheck(t, servicecatalog.EndpointsID), - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - CheckDestroy: testAccCheckProvisionedProductDestroy(ctx), - Steps: []resource.TestStep{ - { - Config: testAccProvisionedProductConfig_productName(rName, domain, acctest.DefaultEmailAddress, "10.1.0.0/16", productName), - Check: resource.ComposeTestCheckFunc( - testAccCheckProvisionedProductExists(ctx, resourceName, &pprod), - resource.TestCheckResourceAttrPair(resourceName, "product_name", "aws_servicecatalog_product.test", "name"), - resource.TestCheckResourceAttrPair(resourceName, "product_id", "aws_servicecatalog_product.test", "id"), - ), - }, - { - // update the product name, but keep provisioned product name as-is to trigger an in-place update - Config: testAccProvisionedProductConfig_productName(rName, domain, acctest.DefaultEmailAddress, "10.1.0.0/16", productNameUpdated), - Check: resource.ComposeTestCheckFunc( - testAccCheckProvisionedProductExists(ctx, resourceName, &pprod), - resource.TestCheckResourceAttrPair(resourceName, "product_name", "aws_servicecatalog_product.test", "name"), - resource.TestCheckResourceAttrPair(resourceName, "product_id", "aws_servicecatalog_product.test", "id"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{ - "accept_language", - "ignore_errors", - "product_name", - "provisioning_artifact_name", - "provisioning_parameters", - "retain_physical_resources", - }, - }, - }, - }) -} +// NOTE: This test is dependent on a v5.0.0 feature which fixes how +// products are modified when provisioning_artifact_parameters are +// changed. Once v5.0.0 is released, this test can be re-enabled. +// Ref: https://github.com/hashicorp/terraform-provider-aws/pull/31061 +// +// func TestAccServiceCatalogProvisionedProduct_ProductName_update(t *testing.T) { +// ctx := acctest.Context(t) +// resourceName := "aws_servicecatalog_provisioned_product.test" + +// rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) +// productName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) +// productNameUpdated := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) +// domain := fmt.Sprintf("http://%s", acctest.RandomDomainName()) +// var pprod servicecatalog.ProvisionedProductDetail + +// resource.ParallelTest(t, resource.TestCase{ +// PreCheck: func() { acctest.PreCheck(ctx, t) }, +// ErrorCheck: acctest.ErrorCheck(t, servicecatalog.EndpointsID), +// ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, +// CheckDestroy: testAccCheckProvisionedProductDestroy(ctx), +// Steps: []resource.TestStep{ +// { +// Config: testAccProvisionedProductConfig_productName(rName, domain, acctest.DefaultEmailAddress, "10.1.0.0/16", productName), +// Check: resource.ComposeTestCheckFunc( +// testAccCheckProvisionedProductExists(ctx, resourceName, &pprod), +// resource.TestCheckResourceAttrPair(resourceName, "product_name", "aws_servicecatalog_product.test", "name"), +// resource.TestCheckResourceAttrPair(resourceName, "product_id", "aws_servicecatalog_product.test", "id"), +// ), +// }, +// { +// // update the product name, but keep provisioned product name as-is to trigger an in-place update +// Config: testAccProvisionedProductConfig_productName(rName, domain, acctest.DefaultEmailAddress, "10.1.0.0/16", productNameUpdated), +// Check: resource.ComposeTestCheckFunc( +// testAccCheckProvisionedProductExists(ctx, resourceName, &pprod), +// resource.TestCheckResourceAttrPair(resourceName, "product_name", "aws_servicecatalog_product.test", "name"), +// resource.TestCheckResourceAttrPair(resourceName, "product_id", "aws_servicecatalog_product.test", "id"), +// ), +// }, +// { +// ResourceName: resourceName, +// ImportState: true, +// ImportStateVerify: true, +// ImportStateVerifyIgnore: []string{ +// "accept_language", +// "ignore_errors", +// "product_name", +// "provisioning_artifact_name", +// "provisioning_parameters", +// "retain_physical_resources", +// }, +// }, +// }, +// }) +// } // Reference: https://github.com/hashicorp/terraform-provider-aws/issues/26271 func TestAccServiceCatalogProvisionedProduct_ProvisioningArtifactName_update(t *testing.T) { @@ -720,27 +725,27 @@ resource "aws_servicecatalog_provisioned_product" "test" { `, rName, vpcCidr)) } -func testAccProvisionedProductConfig_productName(rName, domain, email, vpcCidr, productName string) string { - return acctest.ConfigCompose(testAccProvisionedProductTemplateURLBaseConfig(productName, domain, email), - fmt.Sprintf(` -resource "aws_servicecatalog_provisioned_product" "test" { - name = %[1]q - product_name = aws_servicecatalog_product.test.name - provisioning_artifact_name = aws_servicecatalog_product.test.provisioning_artifact_parameters[0].name - path_id = data.aws_servicecatalog_launch_paths.test.summaries[0].path_id - - provisioning_parameters { - key = "VPCPrimaryCIDR" - value = %[2]q - } - - provisioning_parameters { - key = "LeaveMeEmpty" - value = "" - } -} -`, rName, vpcCidr)) -} +// func testAccProvisionedProductConfig_productName(rName, domain, email, vpcCidr, productName string) string { +// return acctest.ConfigCompose(testAccProvisionedProductTemplateURLBaseConfig(productName, domain, email), +// fmt.Sprintf(` +// resource "aws_servicecatalog_provisioned_product" "test" { +// name = %[1]q +// product_name = aws_servicecatalog_product.test.name +// provisioning_artifact_name = aws_servicecatalog_product.test.provisioning_artifact_parameters[0].name +// path_id = data.aws_servicecatalog_launch_paths.test.summaries[0].path_id + +// provisioning_parameters { +// key = "VPCPrimaryCIDR" +// value = %[2]q +// } + +// provisioning_parameters { +// key = "LeaveMeEmpty" +// value = "" +// } +// } +// `, rName, vpcCidr)) +// } func testAccProvisionedProductConfig_ProvisionedArtifactName_update(rName, domain, email, vpcCidr, artifactName string) string { return acctest.ConfigCompose(testAccProvisionedProductTemplateURLBaseConfig(rName, domain, email),