diff --git a/.ci/semgrep/acctest/checks/planonly.yml b/.ci/semgrep/acctest/checks/planonly.yml new file mode 100644 index 000000000000..55bf4ff4299d --- /dev/null +++ b/.ci/semgrep/acctest/checks/planonly.yml @@ -0,0 +1,15 @@ +rules: + - id: replace-planonly-checks + languages: [go] + message: Replace `PlanOnly` acceptance test steps with `plancheck`s + paths: + include: + - "internal/service/*/*_test.go" + patterns: + - pattern: | + { + ..., + PlanOnly: true, + ... + } + severity: ERROR diff --git a/internal/generate/tagstests/resource_test.go.gtpl b/internal/generate/tagstests/resource_test.go.gtpl index 79fbb24520e9..0320ac8dd2d3 100644 --- a/internal/generate/tagstests/resource_test.go.gtpl +++ b/internal/generate/tagstests/resource_test.go.gtpl @@ -492,8 +492,14 @@ func {{ template "testname" . }}_tags_null(t *testing.T) { acctest.CtResourceTags: nil, {{ template "AdditionalTfVars" . }} }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, {{- end }} }, @@ -567,8 +573,14 @@ func {{ template "testname" . }}_tags_EmptyMap(t *testing.T) { acctest.CtResourceTags: nil, {{ template "AdditionalTfVars" . }} }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, {{- end }} }, diff --git a/internal/sdkv2/schema.go b/internal/sdkv2/schema.go index a899401c0f69..bc007e8aa9b0 100644 --- a/internal/sdkv2/schema.go +++ b/internal/sdkv2/schema.go @@ -77,6 +77,9 @@ var IAMPolicyDocumentSchemaOptionalComputed = sync.OnceValue(jsonDocumentSchemaO // IAMPolicyDocumentSchemaRequired returns the standard schema for a required IAM policy JSON document. var IAMPolicyDocumentSchemaRequired = sync.OnceValue(jsonDocumentSchemaRequiredFunc(SuppressEquivalentIAMPolicyDocuments)) +// IAMPolicyDocumentSchemaRequiredForceNew returns the standard schema for a required, force-new IAM policy JSON document. +var IAMPolicyDocumentSchemaRequiredForceNew = sync.OnceValue(jsonDocumentSchemaRequiredForceNewFunc(SuppressEquivalentIAMPolicyDocuments)) + // JSONDocumentSchemaOptionalForceNew returns the standard schema for an optional, force-new JSON document. var JSONDocumentSchemaOptionalForceNew = sync.OnceValue(jsonDocumentSchemaOptionalForceNewFunc(SuppressEquivalentJSONDocuments)) @@ -136,3 +139,17 @@ func jsonDocumentSchemaRequiredFunc(diffSuppressFunc schema.SchemaDiffSuppressFu } } } + +func jsonDocumentSchemaRequiredForceNewFunc(diffSuppressFunc schema.SchemaDiffSuppressFunc) func() *schema.Schema { + return func() *schema.Schema { + return &schema.Schema{ + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringIsJSON, + DiffSuppressFunc: diffSuppressFunc, + DiffSuppressOnRefresh: true, + StateFunc: NormalizeJsonStringSchemaStateFunc, + } + } +} diff --git a/internal/service/accessanalyzer/analyzer_tags_gen_test.go b/internal/service/accessanalyzer/analyzer_tags_gen_test.go index 6f995250af38..bed30f0deda3 100644 --- a/internal/service/accessanalyzer/analyzer_tags_gen_test.go +++ b/internal/service/accessanalyzer/analyzer_tags_gen_test.go @@ -288,8 +288,14 @@ func testAccAccessAnalyzerAnalyzer_tags_null(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -348,8 +354,14 @@ func testAccAccessAnalyzerAnalyzer_tags_EmptyMap(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) diff --git a/internal/service/acm/certificate_tags_gen_test.go b/internal/service/acm/certificate_tags_gen_test.go index 049641f3ed2d..313de408b08c 100644 --- a/internal/service/acm/certificate_tags_gen_test.go +++ b/internal/service/acm/certificate_tags_gen_test.go @@ -280,8 +280,14 @@ func TestAccACMCertificate_tags_null(t *testing.T) { acctest.CtCertificatePEM: config.StringVariable(certificatePEM), acctest.CtPrivateKeyPEM: config.StringVariable(privateKeyPEM), }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -344,8 +350,14 @@ func TestAccACMCertificate_tags_EmptyMap(t *testing.T) { acctest.CtCertificatePEM: config.StringVariable(certificatePEM), acctest.CtPrivateKeyPEM: config.StringVariable(privateKeyPEM), }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) diff --git a/internal/service/acmpca/certificate_authority_tags_gen_test.go b/internal/service/acmpca/certificate_authority_tags_gen_test.go index 88a31dcf427d..f6e87de444bb 100644 --- a/internal/service/acmpca/certificate_authority_tags_gen_test.go +++ b/internal/service/acmpca/certificate_authority_tags_gen_test.go @@ -267,8 +267,14 @@ func TestAccACMPCACertificateAuthority_tags_null(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -327,8 +333,14 @@ func TestAccACMPCACertificateAuthority_tags_EmptyMap(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) diff --git a/internal/service/amp/rule_group_namespace_tags_gen_test.go b/internal/service/amp/rule_group_namespace_tags_gen_test.go index 2779c1218d9a..f9e046698971 100644 --- a/internal/service/amp/rule_group_namespace_tags_gen_test.go +++ b/internal/service/amp/rule_group_namespace_tags_gen_test.go @@ -253,8 +253,14 @@ func TestAccAMPRuleGroupNamespace_tags_null(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -310,8 +316,14 @@ func TestAccAMPRuleGroupNamespace_tags_EmptyMap(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) diff --git a/internal/service/amp/workspace_tags_gen_test.go b/internal/service/amp/workspace_tags_gen_test.go index 36bb5978d4a1..f219d174fa4e 100644 --- a/internal/service/amp/workspace_tags_gen_test.go +++ b/internal/service/amp/workspace_tags_gen_test.go @@ -239,8 +239,14 @@ func TestAccAMPWorkspace_tags_null(t *testing.T) { ConfigVariables: config.Variables{ acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -292,8 +298,14 @@ func TestAccAMPWorkspace_tags_EmptyMap(t *testing.T) { ConfigVariables: config.Variables{ acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) diff --git a/internal/service/amplify/app_tags_gen_test.go b/internal/service/amplify/app_tags_gen_test.go index 612617ab4f78..ea7b7a469d44 100644 --- a/internal/service/amplify/app_tags_gen_test.go +++ b/internal/service/amplify/app_tags_gen_test.go @@ -282,8 +282,14 @@ func testAccAmplifyApp_tags_null(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -339,8 +345,14 @@ func testAccAmplifyApp_tags_EmptyMap(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) diff --git a/internal/service/amplify/branch_tags_gen_test.go b/internal/service/amplify/branch_tags_gen_test.go index 4d7c406b065c..cc810c4a5a5a 100644 --- a/internal/service/amplify/branch_tags_gen_test.go +++ b/internal/service/amplify/branch_tags_gen_test.go @@ -282,8 +282,14 @@ func testAccAmplifyBranch_tags_null(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -339,8 +345,14 @@ func testAccAmplifyBranch_tags_EmptyMap(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) diff --git a/internal/service/apigateway/api_key_tags_gen_test.go b/internal/service/apigateway/api_key_tags_gen_test.go index 201388e89ad5..208927e759ff 100644 --- a/internal/service/apigateway/api_key_tags_gen_test.go +++ b/internal/service/apigateway/api_key_tags_gen_test.go @@ -253,8 +253,14 @@ func TestAccAPIGatewayAPIKey_tags_null(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -310,8 +316,14 @@ func TestAccAPIGatewayAPIKey_tags_EmptyMap(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) diff --git a/internal/service/apigateway/client_certificate_tags_gen_test.go b/internal/service/apigateway/client_certificate_tags_gen_test.go index fa8df33b91b9..12178c2ed316 100644 --- a/internal/service/apigateway/client_certificate_tags_gen_test.go +++ b/internal/service/apigateway/client_certificate_tags_gen_test.go @@ -239,8 +239,14 @@ func TestAccAPIGatewayClientCertificate_tags_null(t *testing.T) { ConfigVariables: config.Variables{ acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -292,8 +298,14 @@ func TestAccAPIGatewayClientCertificate_tags_EmptyMap(t *testing.T) { ConfigVariables: config.Variables{ acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) diff --git a/internal/service/apigateway/domain_name_tags_gen_test.go b/internal/service/apigateway/domain_name_tags_gen_test.go index c3a8acc36a27..bfbf6d8444d2 100644 --- a/internal/service/apigateway/domain_name_tags_gen_test.go +++ b/internal/service/apigateway/domain_name_tags_gen_test.go @@ -278,8 +278,14 @@ func TestAccAPIGatewayDomainName_tags_null(t *testing.T) { acctest.CtCertificatePEM: config.StringVariable(certificatePEM), acctest.CtPrivateKeyPEM: config.StringVariable(privateKeyPEM), }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -343,8 +349,14 @@ func TestAccAPIGatewayDomainName_tags_EmptyMap(t *testing.T) { acctest.CtCertificatePEM: config.StringVariable(certificatePEM), acctest.CtPrivateKeyPEM: config.StringVariable(privateKeyPEM), }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) diff --git a/internal/service/apigateway/rest_api_tags_gen_test.go b/internal/service/apigateway/rest_api_tags_gen_test.go index 7a2b1648a9cc..40886e06109e 100644 --- a/internal/service/apigateway/rest_api_tags_gen_test.go +++ b/internal/service/apigateway/rest_api_tags_gen_test.go @@ -268,8 +268,14 @@ func TestAccAPIGatewayRESTAPI_tags_null(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -328,8 +334,14 @@ func TestAccAPIGatewayRESTAPI_tags_EmptyMap(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) diff --git a/internal/service/apigateway/stage_tags_gen_test.go b/internal/service/apigateway/stage_tags_gen_test.go index c3c22d99f2fd..2130ddabd56e 100644 --- a/internal/service/apigateway/stage_tags_gen_test.go +++ b/internal/service/apigateway/stage_tags_gen_test.go @@ -288,8 +288,14 @@ func testAccAPIGatewayStage_tags_null(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -346,8 +352,14 @@ func testAccAPIGatewayStage_tags_EmptyMap(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) diff --git a/internal/service/apigateway/usage_plan_tags_gen_test.go b/internal/service/apigateway/usage_plan_tags_gen_test.go index 7d7949f274c4..f6bc62728e26 100644 --- a/internal/service/apigateway/usage_plan_tags_gen_test.go +++ b/internal/service/apigateway/usage_plan_tags_gen_test.go @@ -253,8 +253,14 @@ func TestAccAPIGatewayUsagePlan_tags_null(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -310,8 +316,14 @@ func TestAccAPIGatewayUsagePlan_tags_EmptyMap(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) diff --git a/internal/service/apigateway/vpc_link_tags_gen_test.go b/internal/service/apigateway/vpc_link_tags_gen_test.go index 9ab31e11bcc1..8b8c80be6d81 100644 --- a/internal/service/apigateway/vpc_link_tags_gen_test.go +++ b/internal/service/apigateway/vpc_link_tags_gen_test.go @@ -250,8 +250,14 @@ func TestAccAPIGatewayVPCLink_tags_null(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -306,8 +312,14 @@ func TestAccAPIGatewayVPCLink_tags_EmptyMap(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) diff --git a/internal/service/apigatewayv2/api_tags_gen_test.go b/internal/service/apigatewayv2/api_tags_gen_test.go index a42ad30e6aaf..a00d0f18b028 100644 --- a/internal/service/apigatewayv2/api_tags_gen_test.go +++ b/internal/service/apigatewayv2/api_tags_gen_test.go @@ -253,8 +253,14 @@ func TestAccAPIGatewayV2API_tags_null(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -310,8 +316,14 @@ func TestAccAPIGatewayV2API_tags_EmptyMap(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) diff --git a/internal/service/apigatewayv2/domain_name_tags_gen_test.go b/internal/service/apigatewayv2/domain_name_tags_gen_test.go index 007f1fb251ef..b3ff752ebe1c 100644 --- a/internal/service/apigatewayv2/domain_name_tags_gen_test.go +++ b/internal/service/apigatewayv2/domain_name_tags_gen_test.go @@ -278,8 +278,14 @@ func TestAccAPIGatewayV2DomainName_tags_null(t *testing.T) { acctest.CtCertificatePEM: config.StringVariable(certificatePEM), acctest.CtPrivateKeyPEM: config.StringVariable(privateKeyPEM), }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -343,8 +349,14 @@ func TestAccAPIGatewayV2DomainName_tags_EmptyMap(t *testing.T) { acctest.CtCertificatePEM: config.StringVariable(certificatePEM), acctest.CtPrivateKeyPEM: config.StringVariable(privateKeyPEM), }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) diff --git a/internal/service/apigatewayv2/stage_tags_gen_test.go b/internal/service/apigatewayv2/stage_tags_gen_test.go index 3e00c14253ee..1d5adc0ffd15 100644 --- a/internal/service/apigatewayv2/stage_tags_gen_test.go +++ b/internal/service/apigatewayv2/stage_tags_gen_test.go @@ -258,8 +258,14 @@ func TestAccAPIGatewayV2Stage_tags_null(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -316,8 +322,14 @@ func TestAccAPIGatewayV2Stage_tags_EmptyMap(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) diff --git a/internal/service/apigatewayv2/vpc_link_tags_gen_test.go b/internal/service/apigatewayv2/vpc_link_tags_gen_test.go index ee14fdf654c6..8636fd63c069 100644 --- a/internal/service/apigatewayv2/vpc_link_tags_gen_test.go +++ b/internal/service/apigatewayv2/vpc_link_tags_gen_test.go @@ -253,8 +253,14 @@ func TestAccAPIGatewayV2VPCLink_tags_null(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -310,8 +316,14 @@ func TestAccAPIGatewayV2VPCLink_tags_EmptyMap(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) diff --git a/internal/service/appautoscaling/target_tags_gen_test.go b/internal/service/appautoscaling/target_tags_gen_test.go index dce093f22f4b..2bbb26163f54 100644 --- a/internal/service/appautoscaling/target_tags_gen_test.go +++ b/internal/service/appautoscaling/target_tags_gen_test.go @@ -258,8 +258,14 @@ func TestAccAppAutoScalingTarget_tags_null(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -316,8 +322,14 @@ func TestAccAppAutoScalingTarget_tags_EmptyMap(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) diff --git a/internal/service/appconfig/application_tags_gen_test.go b/internal/service/appconfig/application_tags_gen_test.go index 05f581a4e78d..f9d8d6b88a79 100644 --- a/internal/service/appconfig/application_tags_gen_test.go +++ b/internal/service/appconfig/application_tags_gen_test.go @@ -250,8 +250,14 @@ func TestAccAppConfigApplication_tags_null(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -306,8 +312,14 @@ func TestAccAppConfigApplication_tags_EmptyMap(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) diff --git a/internal/service/appconfig/configuration_profile_tags_gen_test.go b/internal/service/appconfig/configuration_profile_tags_gen_test.go index 7acb20f417ea..5d7d67c852a8 100644 --- a/internal/service/appconfig/configuration_profile_tags_gen_test.go +++ b/internal/service/appconfig/configuration_profile_tags_gen_test.go @@ -250,8 +250,14 @@ func TestAccAppConfigConfigurationProfile_tags_null(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -306,8 +312,14 @@ func TestAccAppConfigConfigurationProfile_tags_EmptyMap(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) diff --git a/internal/service/appconfig/deployment_strategy_tags_gen_test.go b/internal/service/appconfig/deployment_strategy_tags_gen_test.go index 9d518926b509..9b805f2af719 100644 --- a/internal/service/appconfig/deployment_strategy_tags_gen_test.go +++ b/internal/service/appconfig/deployment_strategy_tags_gen_test.go @@ -250,8 +250,14 @@ func TestAccAppConfigDeploymentStrategy_tags_null(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -306,8 +312,14 @@ func TestAccAppConfigDeploymentStrategy_tags_EmptyMap(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) diff --git a/internal/service/appconfig/deployment_tags_gen_test.go b/internal/service/appconfig/deployment_tags_gen_test.go index c8f715eef568..7f5bdf86ac5e 100644 --- a/internal/service/appconfig/deployment_tags_gen_test.go +++ b/internal/service/appconfig/deployment_tags_gen_test.go @@ -265,8 +265,14 @@ func TestAccAppConfigDeployment_tags_null(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -324,8 +330,14 @@ func TestAccAppConfigDeployment_tags_EmptyMap(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) diff --git a/internal/service/appconfig/extension_tags_gen_test.go b/internal/service/appconfig/extension_tags_gen_test.go index 7ab0277a632f..a9dfda20ca56 100644 --- a/internal/service/appconfig/extension_tags_gen_test.go +++ b/internal/service/appconfig/extension_tags_gen_test.go @@ -250,8 +250,14 @@ func TestAccAppConfigExtension_tags_null(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -306,8 +312,14 @@ func TestAccAppConfigExtension_tags_EmptyMap(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) diff --git a/internal/service/appflow/flow_tags_gen_test.go b/internal/service/appflow/flow_tags_gen_test.go index d215c13a3041..982f44fb0306 100644 --- a/internal/service/appflow/flow_tags_gen_test.go +++ b/internal/service/appflow/flow_tags_gen_test.go @@ -253,8 +253,14 @@ func TestAccAppFlowFlow_tags_null(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -310,8 +316,14 @@ func TestAccAppFlowFlow_tags_EmptyMap(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) diff --git a/internal/service/appintegrations/event_integration_tags_gen_test.go b/internal/service/appintegrations/event_integration_tags_gen_test.go index a24c6a0ca535..aebd9e5e7547 100644 --- a/internal/service/appintegrations/event_integration_tags_gen_test.go +++ b/internal/service/appintegrations/event_integration_tags_gen_test.go @@ -253,8 +253,14 @@ func TestAccAppIntegrationsEventIntegration_tags_null(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -310,8 +316,14 @@ func TestAccAppIntegrationsEventIntegration_tags_EmptyMap(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) diff --git a/internal/service/applicationinsights/application_tags_gen_test.go b/internal/service/applicationinsights/application_tags_gen_test.go index 8e23476fcd16..6b760277492f 100644 --- a/internal/service/applicationinsights/application_tags_gen_test.go +++ b/internal/service/applicationinsights/application_tags_gen_test.go @@ -253,8 +253,14 @@ func TestAccApplicationInsightsApplication_tags_null(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -310,8 +316,14 @@ func TestAccApplicationInsightsApplication_tags_EmptyMap(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) diff --git a/internal/service/appmesh/gateway_route_tags_gen_test.go b/internal/service/appmesh/gateway_route_tags_gen_test.go index f1f777591392..4f40b74ecae9 100644 --- a/internal/service/appmesh/gateway_route_tags_gen_test.go +++ b/internal/service/appmesh/gateway_route_tags_gen_test.go @@ -287,8 +287,14 @@ func testAccAppMeshGatewayRoute_tags_null(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -345,8 +351,14 @@ func testAccAppMeshGatewayRoute_tags_EmptyMap(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) diff --git a/internal/service/appmesh/mesh_tags_gen_test.go b/internal/service/appmesh/mesh_tags_gen_test.go index acff615dfeab..c5bea0c3c4bf 100644 --- a/internal/service/appmesh/mesh_tags_gen_test.go +++ b/internal/service/appmesh/mesh_tags_gen_test.go @@ -282,8 +282,14 @@ func testAccAppMeshServiceMesh_tags_null(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -339,8 +345,14 @@ func testAccAppMeshServiceMesh_tags_EmptyMap(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) diff --git a/internal/service/appmesh/route_tags_gen_test.go b/internal/service/appmesh/route_tags_gen_test.go index c47ece01f0bb..916419c2bb33 100644 --- a/internal/service/appmesh/route_tags_gen_test.go +++ b/internal/service/appmesh/route_tags_gen_test.go @@ -287,8 +287,14 @@ func testAccAppMeshRoute_tags_null(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -345,8 +351,14 @@ func testAccAppMeshRoute_tags_EmptyMap(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) diff --git a/internal/service/appmesh/virtual_gateway_tags_gen_test.go b/internal/service/appmesh/virtual_gateway_tags_gen_test.go index 5d32e533e85d..814e0c8b2d5d 100644 --- a/internal/service/appmesh/virtual_gateway_tags_gen_test.go +++ b/internal/service/appmesh/virtual_gateway_tags_gen_test.go @@ -287,8 +287,14 @@ func testAccAppMeshVirtualGateway_tags_null(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -345,8 +351,14 @@ func testAccAppMeshVirtualGateway_tags_EmptyMap(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) diff --git a/internal/service/appmesh/virtual_node_tags_gen_test.go b/internal/service/appmesh/virtual_node_tags_gen_test.go index 720e90d92690..85f595a05259 100644 --- a/internal/service/appmesh/virtual_node_tags_gen_test.go +++ b/internal/service/appmesh/virtual_node_tags_gen_test.go @@ -287,8 +287,14 @@ func testAccAppMeshVirtualNode_tags_null(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -345,8 +351,14 @@ func testAccAppMeshVirtualNode_tags_EmptyMap(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) diff --git a/internal/service/appmesh/virtual_router_tags_gen_test.go b/internal/service/appmesh/virtual_router_tags_gen_test.go index c56767d35968..b716f9687a01 100644 --- a/internal/service/appmesh/virtual_router_tags_gen_test.go +++ b/internal/service/appmesh/virtual_router_tags_gen_test.go @@ -287,8 +287,14 @@ func testAccAppMeshVirtualRouter_tags_null(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -345,8 +351,14 @@ func testAccAppMeshVirtualRouter_tags_EmptyMap(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) diff --git a/internal/service/appmesh/virtual_service_tags_gen_test.go b/internal/service/appmesh/virtual_service_tags_gen_test.go index 5ea40776e7e3..2305a345db3b 100644 --- a/internal/service/appmesh/virtual_service_tags_gen_test.go +++ b/internal/service/appmesh/virtual_service_tags_gen_test.go @@ -287,8 +287,14 @@ func testAccAppMeshVirtualService_tags_null(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -345,8 +351,14 @@ func testAccAppMeshVirtualService_tags_EmptyMap(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) diff --git a/internal/service/apprunner/auto_scaling_configuration_version_tags_gen_test.go b/internal/service/apprunner/auto_scaling_configuration_version_tags_gen_test.go index 34540db56011..030592650fe9 100644 --- a/internal/service/apprunner/auto_scaling_configuration_version_tags_gen_test.go +++ b/internal/service/apprunner/auto_scaling_configuration_version_tags_gen_test.go @@ -250,8 +250,14 @@ func TestAccAppRunnerAutoScalingConfigurationVersion_tags_null(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -306,8 +312,14 @@ func TestAccAppRunnerAutoScalingConfigurationVersion_tags_EmptyMap(t *testing.T) acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) diff --git a/internal/service/apprunner/connection_tags_gen_test.go b/internal/service/apprunner/connection_tags_gen_test.go index 72f9ec891cbc..0ad8afed181a 100644 --- a/internal/service/apprunner/connection_tags_gen_test.go +++ b/internal/service/apprunner/connection_tags_gen_test.go @@ -250,8 +250,14 @@ func TestAccAppRunnerConnection_tags_null(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -306,8 +312,14 @@ func TestAccAppRunnerConnection_tags_EmptyMap(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) diff --git a/internal/service/apprunner/observability_configuration_tags_gen_test.go b/internal/service/apprunner/observability_configuration_tags_gen_test.go index e4560b9c7342..1f1e2e3126cc 100644 --- a/internal/service/apprunner/observability_configuration_tags_gen_test.go +++ b/internal/service/apprunner/observability_configuration_tags_gen_test.go @@ -250,8 +250,14 @@ func TestAccAppRunnerObservabilityConfiguration_tags_null(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -306,8 +312,14 @@ func TestAccAppRunnerObservabilityConfiguration_tags_EmptyMap(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) diff --git a/internal/service/apprunner/service_tags_gen_test.go b/internal/service/apprunner/service_tags_gen_test.go index 9c5923e46154..2c54c50ed1d1 100644 --- a/internal/service/apprunner/service_tags_gen_test.go +++ b/internal/service/apprunner/service_tags_gen_test.go @@ -250,8 +250,14 @@ func TestAccAppRunnerService_tags_null(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -306,8 +312,14 @@ func TestAccAppRunnerService_tags_EmptyMap(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) diff --git a/internal/service/apprunner/vpc_connector_tags_gen_test.go b/internal/service/apprunner/vpc_connector_tags_gen_test.go index a80414c5baa2..db9e5357b1ce 100644 --- a/internal/service/apprunner/vpc_connector_tags_gen_test.go +++ b/internal/service/apprunner/vpc_connector_tags_gen_test.go @@ -250,8 +250,14 @@ func TestAccAppRunnerVPCConnector_tags_null(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -306,8 +312,14 @@ func TestAccAppRunnerVPCConnector_tags_EmptyMap(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) diff --git a/internal/service/apprunner/vpc_ingress_connection_tags_gen_test.go b/internal/service/apprunner/vpc_ingress_connection_tags_gen_test.go index 402a9dfbc114..16b3f1d64ca5 100644 --- a/internal/service/apprunner/vpc_ingress_connection_tags_gen_test.go +++ b/internal/service/apprunner/vpc_ingress_connection_tags_gen_test.go @@ -250,8 +250,14 @@ func TestAccAppRunnerVPCIngressConnection_tags_null(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -306,8 +312,14 @@ func TestAccAppRunnerVPCIngressConnection_tags_EmptyMap(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) diff --git a/internal/service/backup/framework_tags_gen_test.go b/internal/service/backup/framework_tags_gen_test.go index cf6c50f0944c..66652093f7b7 100644 --- a/internal/service/backup/framework_tags_gen_test.go +++ b/internal/service/backup/framework_tags_gen_test.go @@ -281,8 +281,14 @@ func testAccBackupFramework_tags_null(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -338,8 +344,14 @@ func testAccBackupFramework_tags_EmptyMap(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) diff --git a/internal/service/backup/plan_tags_gen_test.go b/internal/service/backup/plan_tags_gen_test.go index 7d04fa03332d..9eadddb8997c 100644 --- a/internal/service/backup/plan_tags_gen_test.go +++ b/internal/service/backup/plan_tags_gen_test.go @@ -253,8 +253,14 @@ func TestAccBackupPlan_tags_null(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -310,8 +316,14 @@ func TestAccBackupPlan_tags_EmptyMap(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) diff --git a/internal/service/backup/report_plan_tags_gen_test.go b/internal/service/backup/report_plan_tags_gen_test.go index 417ee4adb7da..2c78a936ebe8 100644 --- a/internal/service/backup/report_plan_tags_gen_test.go +++ b/internal/service/backup/report_plan_tags_gen_test.go @@ -252,8 +252,14 @@ func TestAccBackupReportPlan_tags_null(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -309,8 +315,14 @@ func TestAccBackupReportPlan_tags_EmptyMap(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) diff --git a/internal/service/backup/vault_tags_gen_test.go b/internal/service/backup/vault_tags_gen_test.go index 74465b46eb33..e9e61af20ca3 100644 --- a/internal/service/backup/vault_tags_gen_test.go +++ b/internal/service/backup/vault_tags_gen_test.go @@ -268,8 +268,14 @@ func TestAccBackupVault_tags_null(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -328,8 +334,14 @@ func TestAccBackupVault_tags_EmptyMap(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) diff --git a/internal/service/batch/compute_environment_tags_gen_test.go b/internal/service/batch/compute_environment_tags_gen_test.go index cabdd8754f3a..8e858d67c007 100644 --- a/internal/service/batch/compute_environment_tags_gen_test.go +++ b/internal/service/batch/compute_environment_tags_gen_test.go @@ -253,8 +253,14 @@ func TestAccBatchComputeEnvironment_tags_null(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -310,8 +316,14 @@ func TestAccBatchComputeEnvironment_tags_EmptyMap(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) diff --git a/internal/service/batch/job_definition_tags_gen_test.go b/internal/service/batch/job_definition_tags_gen_test.go index de0cc49d0c28..e468a64d9c04 100644 --- a/internal/service/batch/job_definition_tags_gen_test.go +++ b/internal/service/batch/job_definition_tags_gen_test.go @@ -253,8 +253,14 @@ func TestAccBatchJobDefinition_tags_null(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -310,8 +316,14 @@ func TestAccBatchJobDefinition_tags_EmptyMap(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) diff --git a/internal/service/batch/scheduling_policy_tags_gen_test.go b/internal/service/batch/scheduling_policy_tags_gen_test.go index 98d0d1213037..825c96a05806 100644 --- a/internal/service/batch/scheduling_policy_tags_gen_test.go +++ b/internal/service/batch/scheduling_policy_tags_gen_test.go @@ -253,8 +253,14 @@ func TestAccBatchSchedulingPolicy_tags_null(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -310,8 +316,14 @@ func TestAccBatchSchedulingPolicy_tags_EmptyMap(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) diff --git a/internal/service/budgets/budget_tags_gen_test.go b/internal/service/budgets/budget_tags_gen_test.go index dd7d427efc52..933bca5bdc97 100644 --- a/internal/service/budgets/budget_tags_gen_test.go +++ b/internal/service/budgets/budget_tags_gen_test.go @@ -253,8 +253,14 @@ func TestAccBudgetsBudget_tags_null(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -310,8 +316,14 @@ func TestAccBudgetsBudget_tags_EmptyMap(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) diff --git a/internal/service/cloudwatch/composite_alarm_tags_gen_test.go b/internal/service/cloudwatch/composite_alarm_tags_gen_test.go index 03e65f22ac47..8897e0e4853e 100644 --- a/internal/service/cloudwatch/composite_alarm_tags_gen_test.go +++ b/internal/service/cloudwatch/composite_alarm_tags_gen_test.go @@ -250,8 +250,14 @@ func TestAccCloudWatchCompositeAlarm_tags_null(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -306,8 +312,14 @@ func TestAccCloudWatchCompositeAlarm_tags_EmptyMap(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) diff --git a/internal/service/cloudwatch/metric_alarm_tags_gen_test.go b/internal/service/cloudwatch/metric_alarm_tags_gen_test.go index 60e30e9ed306..1b1117c3003c 100644 --- a/internal/service/cloudwatch/metric_alarm_tags_gen_test.go +++ b/internal/service/cloudwatch/metric_alarm_tags_gen_test.go @@ -253,8 +253,14 @@ func TestAccCloudWatchMetricAlarm_tags_null(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -310,8 +316,14 @@ func TestAccCloudWatchMetricAlarm_tags_EmptyMap(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) diff --git a/internal/service/cloudwatch/metric_stream_tags_gen_test.go b/internal/service/cloudwatch/metric_stream_tags_gen_test.go index bfe9767b368e..466e3465b6e4 100644 --- a/internal/service/cloudwatch/metric_stream_tags_gen_test.go +++ b/internal/service/cloudwatch/metric_stream_tags_gen_test.go @@ -250,8 +250,14 @@ func TestAccCloudWatchMetricStream_tags_null(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -306,8 +312,14 @@ func TestAccCloudWatchMetricStream_tags_EmptyMap(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) diff --git a/internal/service/cognitoidp/user_pool_tags_gen_test.go b/internal/service/cognitoidp/user_pool_tags_gen_test.go index c57d7b17a1bd..8404271ef55f 100644 --- a/internal/service/cognitoidp/user_pool_tags_gen_test.go +++ b/internal/service/cognitoidp/user_pool_tags_gen_test.go @@ -253,8 +253,14 @@ func TestAccCognitoIDPUserPool_tags_null(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -310,8 +316,14 @@ func TestAccCognitoIDPUserPool_tags_EmptyMap(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) diff --git a/internal/service/datapipeline/pipeline_tags_gen_test.go b/internal/service/datapipeline/pipeline_tags_gen_test.go index f5895fa955af..1af5f3580100 100644 --- a/internal/service/datapipeline/pipeline_tags_gen_test.go +++ b/internal/service/datapipeline/pipeline_tags_gen_test.go @@ -253,8 +253,14 @@ func TestAccDataPipelinePipeline_tags_null(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -310,8 +316,14 @@ func TestAccDataPipelinePipeline_tags_EmptyMap(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) diff --git a/internal/service/dms/certificate_tags_gen_test.go b/internal/service/dms/certificate_tags_gen_test.go index b7b91cd7e789..40503dbbca29 100644 --- a/internal/service/dms/certificate_tags_gen_test.go +++ b/internal/service/dms/certificate_tags_gen_test.go @@ -250,8 +250,14 @@ func TestAccDMSCertificate_tags_null(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -306,8 +312,14 @@ func TestAccDMSCertificate_tags_EmptyMap(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) diff --git a/internal/service/dms/endpoint_tags_gen_test.go b/internal/service/dms/endpoint_tags_gen_test.go index ab9d2ae6383a..21f428a62b61 100644 --- a/internal/service/dms/endpoint_tags_gen_test.go +++ b/internal/service/dms/endpoint_tags_gen_test.go @@ -265,8 +265,14 @@ func TestAccDMSEndpoint_tags_null(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -324,8 +330,14 @@ func TestAccDMSEndpoint_tags_EmptyMap(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) diff --git a/internal/service/dms/event_subscription_tags_gen_test.go b/internal/service/dms/event_subscription_tags_gen_test.go index 62fe6fe8841d..1908d8dd4d61 100644 --- a/internal/service/dms/event_subscription_tags_gen_test.go +++ b/internal/service/dms/event_subscription_tags_gen_test.go @@ -253,8 +253,14 @@ func TestAccDMSEventSubscription_tags_null(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -310,8 +316,14 @@ func TestAccDMSEventSubscription_tags_EmptyMap(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) diff --git a/internal/service/dms/replication_config_tags_gen_test.go b/internal/service/dms/replication_config_tags_gen_test.go index 8f9a7588e3ff..03411f3733fa 100644 --- a/internal/service/dms/replication_config_tags_gen_test.go +++ b/internal/service/dms/replication_config_tags_gen_test.go @@ -268,8 +268,14 @@ func TestAccDMSReplicationConfig_tags_null(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -328,8 +334,14 @@ func TestAccDMSReplicationConfig_tags_EmptyMap(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) diff --git a/internal/service/dms/replication_instance_tags_gen_test.go b/internal/service/dms/replication_instance_tags_gen_test.go index a95258c37d83..c153411681cf 100644 --- a/internal/service/dms/replication_instance_tags_gen_test.go +++ b/internal/service/dms/replication_instance_tags_gen_test.go @@ -265,8 +265,14 @@ func TestAccDMSReplicationInstance_tags_null(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -324,8 +330,14 @@ func TestAccDMSReplicationInstance_tags_EmptyMap(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) diff --git a/internal/service/dms/replication_subnet_group_tags_gen_test.go b/internal/service/dms/replication_subnet_group_tags_gen_test.go index 778be0a6ce55..e32325d7d25d 100644 --- a/internal/service/dms/replication_subnet_group_tags_gen_test.go +++ b/internal/service/dms/replication_subnet_group_tags_gen_test.go @@ -250,8 +250,14 @@ func TestAccDMSReplicationSubnetGroup_tags_null(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -306,8 +312,14 @@ func TestAccDMSReplicationSubnetGroup_tags_EmptyMap(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) diff --git a/internal/service/dms/replication_task_tags_gen_test.go b/internal/service/dms/replication_task_tags_gen_test.go index c726c8bcd681..c22f8829524a 100644 --- a/internal/service/dms/replication_task_tags_gen_test.go +++ b/internal/service/dms/replication_task_tags_gen_test.go @@ -268,8 +268,14 @@ func TestAccDMSReplicationTask_tags_null(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -328,8 +334,14 @@ func TestAccDMSReplicationTask_tags_EmptyMap(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) diff --git a/internal/service/dms/s3_endpoint_tags_gen_test.go b/internal/service/dms/s3_endpoint_tags_gen_test.go index 63b844c4b8fd..0102c4fc9350 100644 --- a/internal/service/dms/s3_endpoint_tags_gen_test.go +++ b/internal/service/dms/s3_endpoint_tags_gen_test.go @@ -250,8 +250,14 @@ func TestAccDMSS3Endpoint_tags_null(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -306,8 +312,14 @@ func TestAccDMSS3Endpoint_tags_EmptyMap(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) diff --git a/internal/service/dynamodb/table_replica_tags_gen_test.go b/internal/service/dynamodb/table_replica_tags_gen_test.go index 3a66710abd9d..3957adacea59 100644 --- a/internal/service/dynamodb/table_replica_tags_gen_test.go +++ b/internal/service/dynamodb/table_replica_tags_gen_test.go @@ -270,8 +270,14 @@ func TestAccDynamoDBTableReplica_tags_null(t *testing.T) { acctest.CtResourceTags: nil, "alt_region": config.StringVariable(acctest.AlternateRegion()), }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -331,8 +337,14 @@ func TestAccDynamoDBTableReplica_tags_EmptyMap(t *testing.T) { acctest.CtResourceTags: nil, "alt_region": config.StringVariable(acctest.AlternateRegion()), }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) diff --git a/internal/service/dynamodb/table_tags_gen_test.go b/internal/service/dynamodb/table_tags_gen_test.go index ced8a65e73a8..532763c208cc 100644 --- a/internal/service/dynamodb/table_tags_gen_test.go +++ b/internal/service/dynamodb/table_tags_gen_test.go @@ -253,8 +253,14 @@ func TestAccDynamoDBTable_tags_null(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -310,8 +316,14 @@ func TestAccDynamoDBTable_tags_EmptyMap(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) diff --git a/internal/service/ec2/ec2_instance_tags_gen_test.go b/internal/service/ec2/ec2_instance_tags_gen_test.go index 3e44426c3699..aac10fe296a5 100644 --- a/internal/service/ec2/ec2_instance_tags_gen_test.go +++ b/internal/service/ec2/ec2_instance_tags_gen_test.go @@ -254,8 +254,14 @@ func TestAccEC2Instance_tags_null(t *testing.T) { ConfigVariables: config.Variables{ acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -310,8 +316,14 @@ func TestAccEC2Instance_tags_EmptyMap(t *testing.T) { ConfigVariables: config.Variables{ acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) diff --git a/internal/service/ec2/vpc_endpoint.go b/internal/service/ec2/vpc_endpoint.go index 2485c8d2bacf..cf35bf9fe2d9 100644 --- a/internal/service/ec2/vpc_endpoint.go +++ b/internal/service/ec2/vpc_endpoint.go @@ -20,12 +20,12 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/id" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/structure" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" "github.com/hashicorp/terraform-provider-aws/internal/conns" "github.com/hashicorp/terraform-provider-aws/internal/enum" "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/flex" + "github.com/hashicorp/terraform-provider-aws/internal/sdkv2" tftags "github.com/hashicorp/terraform-provider-aws/internal/tags" "github.com/hashicorp/terraform-provider-aws/internal/tfresource" "github.com/hashicorp/terraform-provider-aws/internal/verify" @@ -117,18 +117,7 @@ func resourceVPCEndpoint() *schema.Resource { Type: schema.TypeString, Computed: true, }, - names.AttrPolicy: { - Type: schema.TypeString, - Optional: true, - Computed: true, - ValidateFunc: validation.StringIsJSON, - DiffSuppressFunc: verify.SuppressEquivalentPolicyDiffs, - DiffSuppressOnRefresh: true, - StateFunc: func(v any) string { - json, _ := structure.NormalizeJsonString(v) - return json - }, - }, + names.AttrPolicy: sdkv2.IAMPolicyDocumentSchemaOptionalComputed(), "prefix_list_id": { Type: schema.TypeString, Computed: true, diff --git a/internal/service/ec2/vpc_endpoint_policy.go b/internal/service/ec2/vpc_endpoint_policy.go index c07e1c16f354..f7561294eca3 100644 --- a/internal/service/ec2/vpc_endpoint_policy.go +++ b/internal/service/ec2/vpc_endpoint_policy.go @@ -14,9 +14,9 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/structure" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" "github.com/hashicorp/terraform-provider-aws/internal/conns" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" + "github.com/hashicorp/terraform-provider-aws/internal/sdkv2" "github.com/hashicorp/terraform-provider-aws/internal/tfresource" "github.com/hashicorp/terraform-provider-aws/internal/verify" "github.com/hashicorp/terraform-provider-aws/names" @@ -34,18 +34,7 @@ func resourceVPCEndpointPolicy() *schema.Resource { }, Schema: map[string]*schema.Schema{ - names.AttrPolicy: { - Type: schema.TypeString, - Optional: true, - Computed: true, - ValidateFunc: validation.StringIsJSON, - DiffSuppressFunc: verify.SuppressEquivalentPolicyDiffs, - DiffSuppressOnRefresh: true, - StateFunc: func(v any) string { - json, _ := structure.NormalizeJsonString(v) - return json - }, - }, + names.AttrPolicy: sdkv2.IAMPolicyDocumentSchemaOptionalComputed(), names.AttrVPCEndpointID: { Type: schema.TypeString, Required: true, diff --git a/internal/service/ec2/vpc_endpoint_test.go b/internal/service/ec2/vpc_endpoint_test.go index 40915c822126..b218089d04d3 100644 --- a/internal/service/ec2/vpc_endpoint_test.go +++ b/internal/service/ec2/vpc_endpoint_test.go @@ -13,6 +13,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" sdkacctest "github.com/hashicorp/terraform-plugin-testing/helper/acctest" "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/plancheck" "github.com/hashicorp/terraform-plugin-testing/terraform" "github.com/hashicorp/terraform-provider-aws/internal/acctest" "github.com/hashicorp/terraform-provider-aws/internal/conns" @@ -440,6 +441,11 @@ func TestAccVPCEndpoint_gatewayPolicy(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckVPCEndpointExists(ctx, resourceName, &endpoint), ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), + }, + }, }, { ResourceName: resourceName, @@ -451,6 +457,11 @@ func TestAccVPCEndpoint_gatewayPolicy(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckVPCEndpointExists(ctx, resourceName, &endpoint), ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), + }, + }, }, }, }) @@ -473,10 +484,22 @@ func TestAccVPCEndpoint_ignoreEquivalent(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckVPCEndpointExists(ctx, resourceName, &endpoint), ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), + }, + }, }, { - Config: testAccVPCEndpointConfig_newOrderPolicy(rName), - PlanOnly: true, + Config: testAccVPCEndpointConfig_newOrderPolicy(rName), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) diff --git a/internal/service/ec2/vpc_route_table_tags_gen_test.go b/internal/service/ec2/vpc_route_table_tags_gen_test.go index 413edbbec4be..62765eb10e1e 100644 --- a/internal/service/ec2/vpc_route_table_tags_gen_test.go +++ b/internal/service/ec2/vpc_route_table_tags_gen_test.go @@ -239,8 +239,14 @@ func TestAccVPCRouteTable_tags_null(t *testing.T) { ConfigVariables: config.Variables{ acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -292,8 +298,14 @@ func TestAccVPCRouteTable_tags_EmptyMap(t *testing.T) { ConfigVariables: config.Variables{ acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) diff --git a/internal/service/ec2/vpc_security_group_tags_gen_test.go b/internal/service/ec2/vpc_security_group_tags_gen_test.go index d6ee36c56678..ac69432d495c 100644 --- a/internal/service/ec2/vpc_security_group_tags_gen_test.go +++ b/internal/service/ec2/vpc_security_group_tags_gen_test.go @@ -268,8 +268,14 @@ func TestAccVPCSecurityGroup_tags_null(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -328,8 +334,14 @@ func TestAccVPCSecurityGroup_tags_EmptyMap(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) diff --git a/internal/service/ec2/vpc_subnet_tags_gen_test.go b/internal/service/ec2/vpc_subnet_tags_gen_test.go index 42626cb3bc8d..0e79bfa4c433 100644 --- a/internal/service/ec2/vpc_subnet_tags_gen_test.go +++ b/internal/service/ec2/vpc_subnet_tags_gen_test.go @@ -239,8 +239,14 @@ func TestAccVPCSubnet_tags_null(t *testing.T) { ConfigVariables: config.Variables{ acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -292,8 +298,14 @@ func TestAccVPCSubnet_tags_EmptyMap(t *testing.T) { ConfigVariables: config.Variables{ acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) diff --git a/internal/service/ec2/vpc_tags_gen_test.go b/internal/service/ec2/vpc_tags_gen_test.go index 72662beaf60f..6d0c1737b50e 100644 --- a/internal/service/ec2/vpc_tags_gen_test.go +++ b/internal/service/ec2/vpc_tags_gen_test.go @@ -239,8 +239,14 @@ func TestAccVPCVPC_tags_null(t *testing.T) { ConfigVariables: config.Variables{ acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -292,8 +298,14 @@ func TestAccVPCVPC_tags_EmptyMap(t *testing.T) { ConfigVariables: config.Variables{ acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) diff --git a/internal/service/elbv2/listener_rule_tags_gen_test.go b/internal/service/elbv2/listener_rule_tags_gen_test.go index 2288930bd466..9c9d1fddfd35 100644 --- a/internal/service/elbv2/listener_rule_tags_gen_test.go +++ b/internal/service/elbv2/listener_rule_tags_gen_test.go @@ -268,8 +268,14 @@ func TestAccELBV2ListenerRule_tags_null(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -328,8 +334,14 @@ func TestAccELBV2ListenerRule_tags_EmptyMap(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) diff --git a/internal/service/elbv2/listener_tags_gen_test.go b/internal/service/elbv2/listener_tags_gen_test.go index 4c6e59f6200e..69745529831b 100644 --- a/internal/service/elbv2/listener_tags_gen_test.go +++ b/internal/service/elbv2/listener_tags_gen_test.go @@ -268,8 +268,14 @@ func TestAccELBV2Listener_tags_null(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -328,8 +334,14 @@ func TestAccELBV2Listener_tags_EmptyMap(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) diff --git a/internal/service/elbv2/load_balancer_tags_gen_test.go b/internal/service/elbv2/load_balancer_tags_gen_test.go index 9716e98dbb3a..7a96814e3d21 100644 --- a/internal/service/elbv2/load_balancer_tags_gen_test.go +++ b/internal/service/elbv2/load_balancer_tags_gen_test.go @@ -253,8 +253,14 @@ func TestAccELBV2LoadBalancer_tags_null(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -310,8 +316,14 @@ func TestAccELBV2LoadBalancer_tags_EmptyMap(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) diff --git a/internal/service/elbv2/target_group_tags_gen_test.go b/internal/service/elbv2/target_group_tags_gen_test.go index da97152fddb9..ea823a2b5ad8 100644 --- a/internal/service/elbv2/target_group_tags_gen_test.go +++ b/internal/service/elbv2/target_group_tags_gen_test.go @@ -268,8 +268,14 @@ func TestAccELBV2TargetGroup_tags_null(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -328,8 +334,14 @@ func TestAccELBV2TargetGroup_tags_EmptyMap(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) diff --git a/internal/service/elbv2/trust_store_tags_gen_test.go b/internal/service/elbv2/trust_store_tags_gen_test.go index bd98e41034f1..735de85f891d 100644 --- a/internal/service/elbv2/trust_store_tags_gen_test.go +++ b/internal/service/elbv2/trust_store_tags_gen_test.go @@ -268,8 +268,14 @@ func TestAccELBV2TrustStore_tags_null(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -328,8 +334,14 @@ func TestAccELBV2TrustStore_tags_EmptyMap(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) diff --git a/internal/service/fms/policy_tags_gen_test.go b/internal/service/fms/policy_tags_gen_test.go index f232ad7ad223..255c6107ee40 100644 --- a/internal/service/fms/policy_tags_gen_test.go +++ b/internal/service/fms/policy_tags_gen_test.go @@ -294,8 +294,14 @@ func testAccFMSPolicy_tags_null(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -353,8 +359,14 @@ func testAccFMSPolicy_tags_EmptyMap(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) diff --git a/internal/service/glacier/vault.go b/internal/service/glacier/vault.go index eb6ec466a4fd..5ac2936ba23b 100644 --- a/internal/service/glacier/vault.go +++ b/internal/service/glacier/vault.go @@ -21,6 +21,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/flex" + "github.com/hashicorp/terraform-provider-aws/internal/sdkv2" tftags "github.com/hashicorp/terraform-provider-aws/internal/tags" "github.com/hashicorp/terraform-provider-aws/internal/tfresource" "github.com/hashicorp/terraform-provider-aws/internal/verify" @@ -41,17 +42,7 @@ func resourceVault() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "access_policy": { - Type: schema.TypeString, - Optional: true, - ValidateFunc: validation.StringIsJSON, - DiffSuppressFunc: verify.SuppressEquivalentPolicyDiffs, - DiffSuppressOnRefresh: true, - StateFunc: func(v any) string { - json, _ := structure.NormalizeJsonString(v) - return json - }, - }, + "access_policy": sdkv2.IAMPolicyDocumentSchemaOptional(), names.AttrARN: { Type: schema.TypeString, Computed: true, @@ -106,11 +97,11 @@ func resourceVaultCreate(ctx context.Context, d *schema.ResourceData, meta any) conn := meta.(*conns.AWSClient).GlacierClient(ctx) name := d.Get(names.AttrName).(string) - input := &glacier.CreateVaultInput{ + input := glacier.CreateVaultInput{ VaultName: aws.String(name), } - _, err := conn.CreateVault(ctx, input) + _, err := conn.CreateVault(ctx, &input) if err != nil { return sdkdiag.AppendErrorf(diags, "creating Glacier Vault (%s): %s", name, err) @@ -124,19 +115,18 @@ func resourceVaultCreate(ctx context.Context, d *schema.ResourceData, meta any) if v, ok := d.GetOk("access_policy"); ok { policy, err := structure.NormalizeJsonString(v.(string)) - if err != nil { return sdkdiag.AppendFromErr(diags, err) } - input := &glacier.SetVaultAccessPolicyInput{ + input := glacier.SetVaultAccessPolicyInput{ Policy: &types.VaultAccessPolicy{ Policy: aws.String(policy), }, VaultName: aws.String(d.Id()), } - _, err = conn.SetVaultAccessPolicy(ctx, input) + _, err = conn.SetVaultAccessPolicy(ctx, &input) if err != nil { return sdkdiag.AppendErrorf(diags, "setting Glacier Vault (%s) access policy: %s", d.Id(), err) @@ -144,12 +134,12 @@ func resourceVaultCreate(ctx context.Context, d *schema.ResourceData, meta any) } if v, ok := d.GetOk("notification"); ok && len(v.([]any)) > 0 && v.([]any)[0] != nil { - input := &glacier.SetVaultNotificationsInput{ + input := glacier.SetVaultNotificationsInput{ VaultName: aws.String(d.Id()), VaultNotificationConfig: expandVaultNotificationConfig(v.([]any)[0].(map[string]any)), } - _, err := conn.SetVaultNotifications(ctx, input) + _, err := conn.SetVaultNotifications(ctx, &input) if err != nil { return sdkdiag.AppendErrorf(diags, "setting Glacier Vault (%s) notifications: %s", d.Id(), err) @@ -166,7 +156,7 @@ func resourceVaultRead(ctx context.Context, d *schema.ResourceData, meta any) di output, err := findVaultByName(ctx, conn, d.Id()) if !d.IsNewResource() && tfresource.NotFound(err) { - log.Printf("[WARN] Glaier Vault (%s) not found, removing from state", d.Id()) + log.Printf("[WARN] Glacier Vault (%s) not found, removing from state", d.Id()) d.SetId("") return diags } @@ -175,22 +165,18 @@ func resourceVaultRead(ctx context.Context, d *schema.ResourceData, meta any) di return sdkdiag.AppendErrorf(diags, "reading Glacier Vault (%s): %s", d.Id(), err) } - d.Set("access_policy", nil) d.Set(names.AttrARN, output.VaultARN) d.Set(names.AttrLocation, fmt.Sprintf("/%s/vaults/%s", meta.(*conns.AWSClient).AccountID(ctx), d.Id())) d.Set(names.AttrName, output.VaultName) - d.Set("notification", nil) - - if output, err := conn.GetVaultAccessPolicy(ctx, &glacier.GetVaultAccessPolicyInput{ - VaultName: aws.String(d.Id()), - }); err != nil { - // "An error occurred (ResourceNotFoundException) when calling the GetVaultAccessPolicy operation: No vault access policy is set for: ..." - if !errs.IsA[*types.ResourceNotFoundException](err) { - return sdkdiag.AppendErrorf(diags, "reading Glacier Vault (%s) access policy: %s", d.Id(), err) - } - } else if output != nil && output.Policy != nil { - policy, err := verify.PolicyToSet(d.Get("access_policy").(string), aws.ToString(output.Policy.Policy)) + accessPolicy, err := findVaultAccessPolicyByName(ctx, conn, d.Id()) + switch { + case tfresource.NotFound(err): + d.Set("access_policy", nil) + case err != nil: + return sdkdiag.AppendErrorf(diags, "reading Glacier Vault (%s) access policy: %s", d.Id(), err) + default: + policy, err := verify.PolicyToSet(d.Get("access_policy").(string), aws.ToString(accessPolicy.Policy)) if err != nil { return sdkdiag.AppendFromErr(diags, err) } @@ -198,22 +184,20 @@ func resourceVaultRead(ctx context.Context, d *schema.ResourceData, meta any) di d.Set("access_policy", policy) } - if output, err := conn.GetVaultNotifications(ctx, &glacier.GetVaultNotificationsInput{ - VaultName: aws.String(d.Id()), - }); err != nil { - // "An error occurred (ResourceNotFoundException) when calling the GetVaultNotifications operation: No notification configuration is set for vault: ..." - if !errs.IsA[*types.ResourceNotFoundException](err) { - return sdkdiag.AppendErrorf(diags, "reading Glacier Vault (%s) notifications: %s", d.Id(), err) - } - } else if output != nil && output.VaultNotificationConfig != nil { - apiObject := output.VaultNotificationConfig + notificationConfig, err := findVaultNotificationsByName(ctx, conn, d.Id()) + switch { + case tfresource.NotFound(err): + d.Set("notification", nil) + case err != nil: + return sdkdiag.AppendErrorf(diags, "reading Glacier Vault (%s) notifications: %s", d.Id(), err) + default: tfMap := map[string]any{} - if v := apiObject.Events; v != nil { + if v := notificationConfig.Events; v != nil { tfMap["events"] = v } - if v := apiObject.SNSTopic; v != nil { + if v := notificationConfig.SNSTopic; v != nil { tfMap["sns_topic"] = aws.ToString(v) } @@ -232,29 +216,28 @@ func resourceVaultUpdate(ctx context.Context, d *schema.ResourceData, meta any) if d.HasChange("access_policy") { if v, ok := d.GetOk("access_policy"); ok { policy, err := structure.NormalizeJsonString(v.(string)) - if err != nil { return sdkdiag.AppendFromErr(diags, err) } - input := &glacier.SetVaultAccessPolicyInput{ + input := glacier.SetVaultAccessPolicyInput{ Policy: &types.VaultAccessPolicy{ Policy: aws.String(policy), }, VaultName: aws.String(d.Id()), } - _, err = conn.SetVaultAccessPolicy(ctx, input) + _, err = conn.SetVaultAccessPolicy(ctx, &input) if err != nil { return sdkdiag.AppendErrorf(diags, "setting Glacier Vault (%s) access policy: %s", d.Id(), err) } } else { - input := &glacier.DeleteVaultAccessPolicyInput{ + input := glacier.DeleteVaultAccessPolicyInput{ VaultName: aws.String(d.Id()), } - _, err := conn.DeleteVaultAccessPolicy(ctx, input) + _, err := conn.DeleteVaultAccessPolicy(ctx, &input) if err != nil { return sdkdiag.AppendErrorf(diags, "deleting Glacier Vault (%s) access policy: %s", d.Id(), err) @@ -264,22 +247,22 @@ func resourceVaultUpdate(ctx context.Context, d *schema.ResourceData, meta any) if d.HasChange("notification") { if v, ok := d.GetOk("notification"); ok && len(v.([]any)) > 0 && v.([]any)[0] != nil { - input := &glacier.SetVaultNotificationsInput{ + input := glacier.SetVaultNotificationsInput{ VaultName: aws.String(d.Id()), VaultNotificationConfig: expandVaultNotificationConfig(v.([]any)[0].(map[string]any)), } - _, err := conn.SetVaultNotifications(ctx, input) + _, err := conn.SetVaultNotifications(ctx, &input) if err != nil { return sdkdiag.AppendErrorf(diags, "setting Glacier Vault (%s) notifications: %s", d.Id(), err) } } else { - input := &glacier.DeleteVaultNotificationsInput{ + input := glacier.DeleteVaultNotificationsInput{ VaultName: aws.String(d.Id()), } - _, err := conn.DeleteVaultNotifications(ctx, input) + _, err := conn.DeleteVaultNotifications(ctx, &input) if err != nil { return sdkdiag.AppendErrorf(diags, "deleting Glacier Vault (%s) notifications: %s", d.Id(), err) @@ -295,9 +278,10 @@ func resourceVaultDelete(ctx context.Context, d *schema.ResourceData, meta any) conn := meta.(*conns.AWSClient).GlacierClient(ctx) log.Printf("[DEBUG] Deleting Glacier Vault: %s", d.Id()) - _, err := conn.DeleteVault(ctx, &glacier.DeleteVaultInput{ + input := glacier.DeleteVaultInput{ VaultName: aws.String(d.Id()), - }) + } + _, err := conn.DeleteVault(ctx, &input) if err != nil { return sdkdiag.AppendErrorf(diags, "deleting Glacier Vault (%s): %s", d.Id(), err) @@ -307,11 +291,11 @@ func resourceVaultDelete(ctx context.Context, d *schema.ResourceData, meta any) } func findVaultByName(ctx context.Context, conn *glacier.Client, name string) (*glacier.DescribeVaultOutput, error) { - input := &glacier.DescribeVaultInput{ + input := glacier.DescribeVaultInput{ VaultName: aws.String(name), } - output, err := conn.DescribeVault(ctx, input) + output, err := conn.DescribeVault(ctx, &input) if errs.IsA[*types.ResourceNotFoundException](err) { return nil, &retry.NotFoundError{ @@ -331,6 +315,56 @@ func findVaultByName(ctx context.Context, conn *glacier.Client, name string) (*g return output, nil } +func findVaultAccessPolicyByName(ctx context.Context, conn *glacier.Client, name string) (*types.VaultAccessPolicy, error) { + input := glacier.GetVaultAccessPolicyInput{ + VaultName: aws.String(name), + } + + output, err := conn.GetVaultAccessPolicy(ctx, &input) + + if errs.IsA[*types.ResourceNotFoundException](err) { + return nil, &retry.NotFoundError{ + LastError: err, + LastRequest: input, + } + } + + if err != nil { + return nil, err + } + + if output == nil || output.Policy == nil { + return nil, tfresource.NewEmptyResultError(input) + } + + return output.Policy, nil +} + +func findVaultNotificationsByName(ctx context.Context, conn *glacier.Client, name string) (*types.VaultNotificationConfig, error) { + input := glacier.GetVaultNotificationsInput{ + VaultName: aws.String(name), + } + + output, err := conn.GetVaultNotifications(ctx, &input) + + if errs.IsA[*types.ResourceNotFoundException](err) { + return nil, &retry.NotFoundError{ + LastError: err, + LastRequest: input, + } + } + + if err != nil { + return nil, err + } + + if output == nil || output.VaultNotificationConfig == nil { + return nil, tfresource.NewEmptyResultError(input) + } + + return output.VaultNotificationConfig, nil +} + func expandVaultNotificationConfig(tfMap map[string]any) *types.VaultNotificationConfig { if tfMap == nil { return nil diff --git a/internal/service/glacier/vault_lock.go b/internal/service/glacier/vault_lock.go index caa15889c0b3..75d3693a39de 100644 --- a/internal/service/glacier/vault_lock.go +++ b/internal/service/glacier/vault_lock.go @@ -19,6 +19,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/conns" "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" + "github.com/hashicorp/terraform-provider-aws/internal/sdkv2" "github.com/hashicorp/terraform-provider-aws/internal/tfresource" "github.com/hashicorp/terraform-provider-aws/internal/verify" "github.com/hashicorp/terraform-provider-aws/names" @@ -47,18 +48,7 @@ func resourceVaultLock() *schema.Resource { Optional: true, Default: false, }, - names.AttrPolicy: { - Type: schema.TypeString, - Required: true, - ForceNew: true, - DiffSuppressFunc: verify.SuppressEquivalentPolicyDiffs, - DiffSuppressOnRefresh: true, - ValidateFunc: verify.ValidIAMPolicyJSON, - StateFunc: func(v any) string { - json, _ := structure.NormalizeJsonString(v) - return json - }, - }, + names.AttrPolicy: sdkv2.IAMPolicyDocumentSchemaRequiredForceNew(), "vault_name": { Type: schema.TypeString, Required: true, @@ -79,13 +69,12 @@ func resourceVaultLockCreate(ctx context.Context, d *schema.ResourceData, meta a conn := meta.(*conns.AWSClient).GlacierClient(ctx) policy, err := structure.NormalizeJsonString(d.Get(names.AttrPolicy).(string)) - if err != nil { return sdkdiag.AppendFromErr(diags, err) } vaultName := d.Get("vault_name").(string) - input := &glacier.InitiateVaultLockInput{ + input := glacier.InitiateVaultLockInput{ AccountId: aws.String("-"), Policy: &types.VaultLockPolicy{ Policy: aws.String(policy), @@ -93,7 +82,7 @@ func resourceVaultLockCreate(ctx context.Context, d *schema.ResourceData, meta a VaultName: aws.String(vaultName), } - output, err := conn.InitiateVaultLock(ctx, input) + output, err := conn.InitiateVaultLock(ctx, &input) if err != nil { return sdkdiag.AppendErrorf(diags, "creating Glacier Vault Lock (%s): %s", vaultName, err) @@ -102,19 +91,19 @@ func resourceVaultLockCreate(ctx context.Context, d *schema.ResourceData, meta a d.SetId(vaultName) if d.Get("complete_lock").(bool) { - input := &glacier.CompleteVaultLockInput{ + input := glacier.CompleteVaultLockInput{ LockId: output.LockId, VaultName: aws.String(vaultName), } - _, err := conn.CompleteVaultLock(ctx, input) + _, err := conn.CompleteVaultLock(ctx, &input) if err != nil { return sdkdiag.AppendErrorf(diags, "completing Glacier Vault Lock (%s): %s", d.Id(), err) } - if err := waitVaultLockComplete(ctx, conn, d.Id()); err != nil { - return sdkdiag.AppendErrorf(diags, "waiting for Glacier Vault Lock (%s) completion: %s", d.Id(), err) + if err := waitVaultLockLocked(ctx, conn, d.Id()); err != nil { + return sdkdiag.AppendErrorf(diags, "waiting for Glacier Vault Lock (%s) complete: %s", d.Id(), err) } } @@ -141,7 +130,6 @@ func resourceVaultLockRead(ctx context.Context, d *schema.ResourceData, meta any d.Set("vault_name", d.Id()) policyToSet, err := verify.PolicyToSet(d.Get(names.AttrPolicy).(string), aws.ToString(output.Policy)) - if err != nil { return sdkdiag.AppendFromErr(diags, err) } @@ -156,9 +144,10 @@ func resourceVaultLockDelete(ctx context.Context, d *schema.ResourceData, meta a conn := meta.(*conns.AWSClient).GlacierClient(ctx) log.Printf("[DEBUG] Deleting Glacier Vault Lock: %s", d.Id()) - _, err := conn.AbortVaultLock(ctx, &glacier.AbortVaultLockInput{ + input := glacier.AbortVaultLockInput{ VaultName: aws.String(d.Id()), - }) + } + _, err := conn.AbortVaultLock(ctx, &input) if errs.IsA[*types.ResourceNotFoundException](err) { return diags @@ -172,12 +161,12 @@ func resourceVaultLockDelete(ctx context.Context, d *schema.ResourceData, meta a } func findVaultLockByName(ctx context.Context, conn *glacier.Client, name string) (*glacier.GetVaultLockOutput, error) { - input := &glacier.GetVaultLockInput{ + input := glacier.GetVaultLockInput{ AccountId: aws.String("-"), VaultName: aws.String(name), } - output, err := conn.GetVaultLock(ctx, input) + output, err := conn.GetVaultLock(ctx, &input) if errs.IsA[*types.ResourceNotFoundException](err) { return nil, &retry.NotFoundError{ @@ -213,7 +202,7 @@ func statusLockState(ctx context.Context, conn *glacier.Client, name string) ret } } -func waitVaultLockComplete(ctx context.Context, conn *glacier.Client, name string) error { +func waitVaultLockLocked(ctx context.Context, conn *glacier.Client, name string) error { stateConf := &retry.StateChangeConf{ Pending: []string{lockStateInProgress}, Target: []string{lockStateLocked}, diff --git a/internal/service/glacier/vault_lock_test.go b/internal/service/glacier/vault_lock_test.go index 35f25c74b1df..3346ba326906 100644 --- a/internal/service/glacier/vault_lock_test.go +++ b/internal/service/glacier/vault_lock_test.go @@ -11,6 +11,7 @@ import ( "github.com/aws/aws-sdk-go-v2/service/glacier" sdkacctest "github.com/hashicorp/terraform-plugin-testing/helper/acctest" "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/plancheck" "github.com/hashicorp/terraform-plugin-testing/terraform" "github.com/hashicorp/terraform-provider-aws/internal/acctest" "github.com/hashicorp/terraform-provider-aws/internal/conns" @@ -107,10 +108,22 @@ func TestAccGlacierVaultLock_ignoreEquivalentPolicy(t *testing.T) { resource.TestCheckResourceAttrSet(resourceName, names.AttrPolicy), resource.TestCheckResourceAttrPair(resourceName, "vault_name", vaultResourceName, names.AttrName), ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), + }, + }, }, { - Config: testAccVaultLockConfig_policyNewOrder(rName, false), - PlanOnly: true, + Config: testAccVaultLockConfig_policyNewOrder(rName, false), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -123,10 +136,6 @@ func testAccCheckVaultLockExists(ctx context.Context, n string, v *glacier.GetVa return fmt.Errorf("Not found: %s", n) } - if rs.Primary.ID == "" { - return fmt.Errorf("No Glacier Vault Lock ID is set") - } - conn := acctest.Provider.Meta().(*conns.AWSClient).GlacierClient(ctx) output, err := tfglacier.FindVaultLockByName(ctx, conn, rs.Primary.ID) @@ -170,7 +179,7 @@ func testAccCheckVaultLockDestroy(ctx context.Context) resource.TestCheckFunc { func testAccVaultLockConfig_complete(rName string, completeLock bool) string { return fmt.Sprintf(` resource "aws_glacier_vault" "test" { - name = %q + name = %[1]q } data "aws_caller_identity" "current" {} @@ -197,12 +206,12 @@ data "aws_iam_policy_document" "test" { } resource "aws_glacier_vault_lock" "test" { - complete_lock = %t - ignore_deletion_error = %t + complete_lock = %[2]t + ignore_deletion_error = %[2]t policy = data.aws_iam_policy_document.test.json vault_name = aws_glacier_vault.test.name } -`, rName, completeLock, completeLock) +`, rName, completeLock) } func testAccVaultLockConfig_policyOrder(rName string, completeLock bool) string { diff --git a/internal/service/glacier/vault_test.go b/internal/service/glacier/vault_test.go index 86c7ad7b4151..6f4d8bfd93c1 100644 --- a/internal/service/glacier/vault_test.go +++ b/internal/service/glacier/vault_test.go @@ -12,6 +12,7 @@ import ( "github.com/aws/aws-sdk-go-v2/service/glacier" sdkacctest "github.com/hashicorp/terraform-plugin-testing/helper/acctest" "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/plancheck" "github.com/hashicorp/terraform-plugin-testing/terraform" "github.com/hashicorp/terraform-provider-aws/internal/acctest" "github.com/hashicorp/terraform-provider-aws/internal/conns" @@ -235,10 +236,22 @@ func TestAccGlacierVault_ignoreEquivalent(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "notification.#", "0"), resource.TestMatchResourceAttr(resourceName, "access_policy", regexache.MustCompile(fmt.Sprintf(`"Sid":"%s"`, rName))), ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), + }, + }, }, { - Config: testAccVaultConfig_policyNewOrder(rName), - PlanOnly: true, + Config: testAccVaultConfig_policyNewOrder(rName), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -251,10 +264,6 @@ func testAccCheckVaultExists(ctx context.Context, n string, v *glacier.DescribeV return fmt.Errorf("Not found: %s", n) } - if rs.Primary.ID == "" { - return fmt.Errorf("No Glacier Vault ID is set") - } - conn := acctest.Provider.Meta().(*conns.AWSClient).GlacierClient(ctx) output, err := tfglacier.FindVaultByName(ctx, conn, rs.Primary.ID) diff --git a/internal/service/glue/exports_test.go b/internal/service/glue/exports_test.go index dd9f4aab7c6f..e9a03f248817 100644 --- a/internal/service/glue/exports_test.go +++ b/internal/service/glue/exports_test.go @@ -37,6 +37,7 @@ var ( FindPartitionByValues = findPartitionByValues FindPartitionIndexByName = findPartitionIndexByName FindRegistryByID = findRegistryByID + FindResourcePolicy = findResourcePolicy FindSchemaByID = findSchemaByID FindTableByName = findTableByName FindTriggerByName = findTriggerByName diff --git a/internal/service/glue/resource_policy.go b/internal/service/glue/resource_policy.go index c87398375ce1..464e4d0b1291 100644 --- a/internal/service/glue/resource_policy.go +++ b/internal/service/glue/resource_policy.go @@ -11,13 +11,15 @@ import ( "github.com/aws/aws-sdk-go-v2/service/glue" awstypes "github.com/aws/aws-sdk-go-v2/service/glue/types" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/structure" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" "github.com/hashicorp/terraform-provider-aws/internal/conns" "github.com/hashicorp/terraform-provider-aws/internal/enum" "github.com/hashicorp/terraform-provider-aws/internal/errs" "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" + "github.com/hashicorp/terraform-provider-aws/internal/sdkv2" + "github.com/hashicorp/terraform-provider-aws/internal/tfresource" "github.com/hashicorp/terraform-provider-aws/internal/verify" "github.com/hashicorp/terraform-provider-aws/names" ) @@ -34,22 +36,12 @@ func resourceResourcePolicy() *schema.Resource { DeleteWithoutTimeout: resourceResourcePolicyDelete, Schema: map[string]*schema.Schema{ - names.AttrPolicy: { - Type: schema.TypeString, - Required: true, - ValidateFunc: validation.StringIsJSON, - DiffSuppressFunc: verify.SuppressEquivalentPolicyDiffs, - DiffSuppressOnRefresh: true, - StateFunc: func(v any) string { - json, _ := structure.NormalizeJsonString(v) - return json - }, - }, "enable_hybrid": { Type: schema.TypeString, Optional: true, ValidateDiagFunc: enum.Validate[awstypes.EnableHybridValues](), }, + names.AttrPolicy: sdkv2.IAMPolicyDocumentSchemaRequired(), }, } } @@ -60,25 +52,28 @@ func resourceResourcePolicyPut(condition awstypes.ExistCondition) func(context.C conn := meta.(*conns.AWSClient).GlueClient(ctx) policy, err := structure.NormalizeJsonString(d.Get(names.AttrPolicy).(string)) - if err != nil { - return sdkdiag.AppendErrorf(diags, "policy is invalid JSON: %s", err) + return sdkdiag.AppendFromErr(diags, err) } - input := &glue.PutResourcePolicyInput{ - PolicyInJson: aws.String(policy), + input := glue.PutResourcePolicyInput{ PolicyExistsCondition: condition, + PolicyInJson: aws.String(policy), } if v, ok := d.GetOk("enable_hybrid"); ok { input.EnableHybrid = awstypes.EnableHybridValues(v.(string)) } - _, err = conn.PutResourcePolicy(ctx, input) + _, err = conn.PutResourcePolicy(ctx, &input) + if err != nil { - return sdkdiag.AppendErrorf(diags, "putting policy request: %s", err) + return sdkdiag.AppendErrorf(diags, "putting Glue Resource Policy: %s", err) + } + + if d.IsNewResource() { + d.SetId(meta.(*conns.AWSClient).Region(ctx)) } - d.SetId(meta.(*conns.AWSClient).Region(ctx)) return append(diags, resourceResourcePolicyRead(ctx, d, meta)...) } @@ -88,28 +83,25 @@ func resourceResourcePolicyRead(ctx context.Context, d *schema.ResourceData, met var diags diag.Diagnostics conn := meta.(*conns.AWSClient).GlueClient(ctx) - resourcePolicy, err := conn.GetResourcePolicy(ctx, &glue.GetResourcePolicyInput{}) - if errs.IsA[*awstypes.EntityNotFoundException](err) { - log.Printf("[WARN] Glue Resource (%s) not found, removing from state", d.Id()) + output, err := findResourcePolicy(ctx, conn) + + if !d.IsNewResource() && tfresource.NotFound(err) { + log.Printf("[WARN] Glue Resource Policy (%s) not found, removing from state", d.Id()) d.SetId("") return diags } + if err != nil { return sdkdiag.AppendErrorf(diags, "reading Glue Resource Policy (%s): %s", d.Id(), err) } - if aws.ToString(resourcePolicy.PolicyInJson) == "" { - //Since the glue resource policy is global we expect it to be deleted when the policy is empty - d.SetId("") - } else { - policyToSet, err := verify.PolicyToSet(d.Get(names.AttrPolicy).(string), aws.ToString(resourcePolicy.PolicyInJson)) + policyToSet, err := verify.PolicyToSet(d.Get(names.AttrPolicy).(string), aws.ToString(output.PolicyInJson)) + if err != nil { + return sdkdiag.AppendFromErr(diags, err) + } - if err != nil { - return sdkdiag.AppendErrorf(diags, "reading Glue Resource Policy (%s): %s", d.Id(), err) - } + d.Set(names.AttrPolicy, policyToSet) - d.Set(names.AttrPolicy, policyToSet) - } return diags } @@ -117,13 +109,38 @@ func resourceResourcePolicyDelete(ctx context.Context, d *schema.ResourceData, m var diags diag.Diagnostics conn := meta.(*conns.AWSClient).GlueClient(ctx) - _, err := conn.DeleteResourcePolicy(ctx, &glue.DeleteResourcePolicyInput{}) + input := glue.DeleteResourcePolicyInput{} + _, err := conn.DeleteResourcePolicy(ctx, &input) + + if errs.IsA[*awstypes.EntityNotFoundException](err) { + return diags + } + if err != nil { - if errs.IsA[*awstypes.EntityNotFoundException](err) { - return diags - } - return sdkdiag.AppendErrorf(diags, "deleting policy request: %s", err) + return sdkdiag.AppendErrorf(diags, "deleting Glue Resource Policy (%s): %s", d.Id(), err) } return diags } + +func findResourcePolicy(ctx context.Context, conn *glue.Client) (*glue.GetResourcePolicyOutput, error) { + input := &glue.GetResourcePolicyInput{} + output, err := conn.GetResourcePolicy(ctx, input) + + if errs.IsA[*awstypes.EntityNotFoundException](err) { + return nil, &retry.NotFoundError{ + LastError: err, + LastRequest: input, + } + } + + if err != nil { + return nil, err + } + + if output == nil || aws.ToString(output.PolicyInJson) == "" { + return nil, tfresource.NewEmptyResultError(input) + } + + return output, nil +} diff --git a/internal/service/glue/resource_policy_test.go b/internal/service/glue/resource_policy_test.go index 58422ed8dea8..b20e44f8afb6 100644 --- a/internal/service/glue/resource_policy_test.go +++ b/internal/service/glue/resource_policy_test.go @@ -9,15 +9,14 @@ import ( "testing" "github.com/aws/aws-sdk-go-v2/aws" - "github.com/aws/aws-sdk-go-v2/service/glue" - awstypes "github.com/aws/aws-sdk-go-v2/service/glue/types" awspolicy "github.com/hashicorp/awspolicyequivalence" "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/plancheck" "github.com/hashicorp/terraform-plugin-testing/terraform" "github.com/hashicorp/terraform-provider-aws/internal/acctest" "github.com/hashicorp/terraform-provider-aws/internal/conns" - "github.com/hashicorp/terraform-provider-aws/internal/errs" tfglue "github.com/hashicorp/terraform-provider-aws/internal/service/glue" + "github.com/hashicorp/terraform-provider-aws/internal/tfresource" "github.com/hashicorp/terraform-provider-aws/names" ) @@ -149,10 +148,22 @@ func testAccResourcePolicy_ignoreEquivalent(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccResourcePolicy(ctx, resourceName, "glue:CreateTable"), ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), + }, + }, }, { - Config: testAccResourcePolicyConfig_equivalent2(), - PlanOnly: true, + Config: testAccResourcePolicyConfig_equivalent2(), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -160,25 +171,20 @@ func testAccResourcePolicy_ignoreEquivalent(t *testing.T) { func testAccResourcePolicy(ctx context.Context, n string, action string) resource.TestCheckFunc { return func(s *terraform.State) error { - rs, ok := s.RootModule().Resources[n] + _, ok := s.RootModule().Resources[n] if !ok { return fmt.Errorf("Not found: %s", n) } - if rs.Primary.ID == "" { - return fmt.Errorf("No policy id set") - } - conn := acctest.Provider.Meta().(*conns.AWSClient).GlueClient(ctx) - policy, err := conn.GetResourcePolicy(ctx, &glue.GetResourcePolicyInput{}) + output, err := tfglue.FindResourcePolicy(ctx, conn) + if err != nil { - return fmt.Errorf("Get resource policy error: %v", err) + return err } - actualPolicyText := aws.ToString(policy.PolicyInJson) - - expectedPolicy := CreateTablePolicy(ctx, action) + actualPolicyText, expectedPolicy := aws.ToString(output.PolicyInJson), testAccNewResourcePolicy(ctx, action) equivalent, err := awspolicy.PoliciesAreEquivalent(actualPolicyText, expectedPolicy) if err != nil { return fmt.Errorf("Error testing policy equivalence: %s", err) @@ -196,35 +202,41 @@ func testAccCheckResourcePolicyDestroy(ctx context.Context) resource.TestCheckFu return func(s *terraform.State) error { conn := acctest.Provider.Meta().(*conns.AWSClient).GlueClient(ctx) - policy, err := conn.GetResourcePolicy(ctx, &glue.GetResourcePolicyInput{}) + for _, rs := range s.RootModule().Resources { + if rs.Type != "aws_glue_resource_policy" { + continue + } - if err != nil { - if errs.IsAErrorMessageContains[*awstypes.EntityNotFoundException](err, "Policy not found") { - return nil + _, err := tfglue.FindResourcePolicy(ctx, conn) + + if tfresource.NotFound(err) { + continue } - return err - } - if *policy.PolicyInJson != "" { - return fmt.Errorf("Aws glue resource policy still exists: %s", *policy.PolicyInJson) + if err != nil { + return err + } + + return fmt.Errorf("Glue Resource Policy %s still exists", rs.Primary.ID) } + return nil } } -func CreateTablePolicy(ctx context.Context, action string) string { +func testAccNewResourcePolicy(ctx context.Context, action string) string { return fmt.Sprintf(`{ "Version" : "2012-10-17", "Statement" : [ { "Effect" : "Allow", "Action" : [ - "%s" + %[1]q ], "Principal" : { "AWS": "*" }, - "Resource" : "arn:%s:glue:%s:%s:*" + "Resource" : "arn:%[2]s:glue:%[3]s:%[4]s:*" } ] }`, action, acctest.Partition(), acctest.Region(), acctest.AccountID(ctx)) diff --git a/internal/service/guardduty/detector_tags_gen_test.go b/internal/service/guardduty/detector_tags_gen_test.go index 9d29ea2c7321..61c6b493b528 100644 --- a/internal/service/guardduty/detector_tags_gen_test.go +++ b/internal/service/guardduty/detector_tags_gen_test.go @@ -271,8 +271,14 @@ func testAccGuardDutyDetector_tags_null(t *testing.T) { ConfigVariables: config.Variables{ acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -326,8 +332,14 @@ func testAccGuardDutyDetector_tags_EmptyMap(t *testing.T) { ConfigVariables: config.Variables{ acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) diff --git a/internal/service/guardduty/filter_tags_gen_test.go b/internal/service/guardduty/filter_tags_gen_test.go index 2841a3894a60..73809a5bdf29 100644 --- a/internal/service/guardduty/filter_tags_gen_test.go +++ b/internal/service/guardduty/filter_tags_gen_test.go @@ -274,8 +274,14 @@ func testAccGuardDutyFilter_tags_null(t *testing.T) { ConfigVariables: config.Variables{ acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -330,8 +336,14 @@ func testAccGuardDutyFilter_tags_EmptyMap(t *testing.T) { ConfigVariables: config.Variables{ acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) diff --git a/internal/service/guardduty/ipset_tags_gen_test.go b/internal/service/guardduty/ipset_tags_gen_test.go index 49a561f3db44..df51e5fd5cbb 100644 --- a/internal/service/guardduty/ipset_tags_gen_test.go +++ b/internal/service/guardduty/ipset_tags_gen_test.go @@ -285,8 +285,14 @@ func testAccGuardDutyIPSet_tags_null(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -344,8 +350,14 @@ func testAccGuardDutyIPSet_tags_EmptyMap(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) diff --git a/internal/service/guardduty/threatintelset_tags_gen_test.go b/internal/service/guardduty/threatintelset_tags_gen_test.go index 0402ea7576df..5921f28fbb8b 100644 --- a/internal/service/guardduty/threatintelset_tags_gen_test.go +++ b/internal/service/guardduty/threatintelset_tags_gen_test.go @@ -285,8 +285,14 @@ func testAccGuardDutyThreatIntelSet_tags_null(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -344,8 +350,14 @@ func testAccGuardDutyThreatIntelSet_tags_EmptyMap(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) diff --git a/internal/service/iam/instance_profile_tags_gen_test.go b/internal/service/iam/instance_profile_tags_gen_test.go index 20f52b8823c9..bf2ad6dae3bf 100644 --- a/internal/service/iam/instance_profile_tags_gen_test.go +++ b/internal/service/iam/instance_profile_tags_gen_test.go @@ -253,8 +253,14 @@ func TestAccIAMInstanceProfile_tags_null(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -310,8 +316,14 @@ func TestAccIAMInstanceProfile_tags_EmptyMap(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) diff --git a/internal/service/iam/openid_connect_provider_tags_gen_test.go b/internal/service/iam/openid_connect_provider_tags_gen_test.go index ef0162821d0a..ef51411bc4a6 100644 --- a/internal/service/iam/openid_connect_provider_tags_gen_test.go +++ b/internal/service/iam/openid_connect_provider_tags_gen_test.go @@ -250,8 +250,14 @@ func TestAccIAMOpenIDConnectProvider_tags_null(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -306,8 +312,14 @@ func TestAccIAMOpenIDConnectProvider_tags_EmptyMap(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) diff --git a/internal/service/iam/openid_connect_provider_test.go b/internal/service/iam/openid_connect_provider_test.go index 3f56ef6f65c1..faec1cc3aa1e 100644 --- a/internal/service/iam/openid_connect_provider_test.go +++ b/internal/service/iam/openid_connect_provider_test.go @@ -10,6 +10,7 @@ import ( sdkacctest "github.com/hashicorp/terraform-plugin-testing/helper/acctest" "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/plancheck" "github.com/hashicorp/terraform-plugin-testing/terraform" "github.com/hashicorp/terraform-provider-aws/internal/acctest" "github.com/hashicorp/terraform-provider-aws/internal/conns" @@ -221,14 +222,26 @@ func TestAccIAMOpenIDConnectProvider_clientIDListOrder(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckOpenIDConnectProviderExists(ctx, resourceName), ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), + }, + }, }, { Config: testAccOpenIDConnectProviderConfig_clientIDList_second(rString), Check: resource.ComposeTestCheckFunc( testAccCheckOpenIDConnectProviderExists(ctx, resourceName), ), - ExpectNonEmptyPlan: false, // Expect an empty plan as only the order has been changed - PlanOnly: true, // Expect an empty plan as only the order has been changed + // Expect an empty plan as only the order has been changed + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) diff --git a/internal/service/iam/policy_document_data_source_test.go b/internal/service/iam/policy_document_data_source_test.go index 6fe96960d552..6dda6e130ba5 100644 --- a/internal/service/iam/policy_document_data_source_test.go +++ b/internal/service/iam/policy_document_data_source_test.go @@ -244,8 +244,7 @@ func TestAccIAMPolicyDocumentDataSource_invalidSidValid(t *testing.T) { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, Steps: []resource.TestStep{ { - Config: testAccPolicyDocumentDataSourceConfig_invalidSid, - PlanOnly: true, + Config: testAccPolicyDocumentDataSourceConfig_invalidSid, }, }, }) diff --git a/internal/service/iam/policy_tags_gen_test.go b/internal/service/iam/policy_tags_gen_test.go index 54e3014c2c44..821ada261d82 100644 --- a/internal/service/iam/policy_tags_gen_test.go +++ b/internal/service/iam/policy_tags_gen_test.go @@ -253,8 +253,14 @@ func TestAccIAMPolicy_tags_null(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -310,8 +316,14 @@ func TestAccIAMPolicy_tags_EmptyMap(t *testing.T) { acctest.CtRName: config.StringVariable(rName), acctest.CtResourceTags: nil, }, - PlanOnly: true, - ExpectNonEmptyPlan: false, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) diff --git a/internal/service/iam/policy_test.go b/internal/service/iam/policy_test.go index 5367e661eb04..f75bfd565914 100644 --- a/internal/service/iam/policy_test.go +++ b/internal/service/iam/policy_test.go @@ -12,6 +12,7 @@ import ( awstypes "github.com/aws/aws-sdk-go-v2/service/iam/types" sdkacctest "github.com/hashicorp/terraform-plugin-testing/helper/acctest" "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/plancheck" "github.com/hashicorp/terraform-plugin-testing/terraform" "github.com/hashicorp/terraform-provider-aws/internal/acctest" "github.com/hashicorp/terraform-provider-aws/internal/conns" @@ -101,22 +102,55 @@ func TestAccIAMPolicy_whitespace(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckPolicyExists(ctx, resourceName, &out), ), - }, - { - Config: testAccPolicyConfig_whitespace(rName, " ", "", ""), - PlanOnly: true, - }, - { - Config: testAccPolicyConfig_whitespace(rName, " ", "\n", ""), - PlanOnly: true, - }, - { - Config: testAccPolicyConfig_whitespace(rName, " ", "\n", " "), - PlanOnly: true, - }, - { - Config: testAccPolicyConfig_whitespace(rName, " \n", "\n", "\t "), - PlanOnly: true, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), + }, + }, + }, + { + Config: testAccPolicyConfig_whitespace(rName, " ", "", ""), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, + }, + { + Config: testAccPolicyConfig_whitespace(rName, " ", "\n", ""), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, + }, + { + Config: testAccPolicyConfig_whitespace(rName, " ", "\n", " "), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, + }, + { + Config: testAccPolicyConfig_whitespace(rName, " \n", "\n", "\t "), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -261,6 +295,11 @@ func TestAccIAMPolicy_diffs(t *testing.T) { testAccCheckPolicyExists(ctx, resourceName, &out), resource.TestCheckResourceAttr(resourceName, acctest.CtTagsPercent, "0"), ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), + }, + }, }, { ResourceName: resourceName, @@ -269,26 +308,14 @@ func TestAccIAMPolicy_diffs(t *testing.T) { }, { Config: testAccPolicyConfig_diffs(rName, ""), - Check: resource.ComposeTestCheckFunc( - testAccCheckPolicyExists(ctx, resourceName, &out), - resource.TestCheckResourceAttr(resourceName, acctest.CtTagsPercent, "0"), - ), - }, - { - Config: testAccPolicyConfig_diffs(rName, ""), - PlanOnly: true, - }, - { - Config: testAccPolicyConfig_diffs(rName, ""), - PlanOnly: true, - }, - { - Config: testAccPolicyConfig_diffs(rName, ""), - PlanOnly: true, - }, - { - Config: testAccPolicyConfig_diffs(rName, ""), - PlanOnly: true, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, { Config: testAccPolicyConfig_diffs(rName, "tags = {}"), @@ -296,36 +323,25 @@ func TestAccIAMPolicy_diffs(t *testing.T) { testAccCheckPolicyExists(ctx, resourceName, &out), resource.TestCheckResourceAttr(resourceName, acctest.CtTagsPercent, "0"), ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, { Config: testAccPolicyConfig_diffs(rName, "tags = {}"), - Check: resource.ComposeTestCheckFunc( - testAccCheckPolicyExists(ctx, resourceName, &out), - resource.TestCheckResourceAttr(resourceName, acctest.CtTagsPercent, "0"), - ), - }, - { - Config: testAccPolicyConfig_diffs(rName, "tags = {}"), - PlanOnly: true, - }, - { - Config: testAccPolicyConfig_diffs(rName, "tags = {}"), - PlanOnly: true, - }, - { - Config: testAccPolicyConfig_diffs(rName, "tags = {}"), - PlanOnly: true, - }, - { - Config: testAccPolicyConfig_diffs(rName, "tags = {}"), - PlanOnly: true, - }, - { - Config: testAccPolicyConfig_diffs(rName, "tags = {}"), - Check: resource.ComposeTestCheckFunc( - testAccCheckPolicyExists(ctx, resourceName, &out), - resource.TestCheckResourceAttr(resourceName, acctest.CtTagsPercent, "0"), - ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -650,7 +666,7 @@ resource "aws_iam_policy" "test" { func testAccPolicyConfig_policyDuplicateKeys(rName string) string { return fmt.Sprintf(` resource "aws_iam_policy" "test" { - name = %q + name = %[1]q policy = <