From 251905ed8e05a6777656de086ceb925802fedb2a Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Wed, 25 Jun 2025 15:34:05 -0400 Subject: [PATCH 01/31] glacier: Replace 'PlanOnly' acceptance test steps with 'plancheck's. --- internal/sdkv2/schema.go | 33 +++++ internal/service/glacier/vault.go | 144 ++++++++++++-------- internal/service/glacier/vault_lock.go | 39 ++---- internal/service/glacier/vault_lock_test.go | 29 ++-- internal/service/glacier/vault_test.go | 21 ++- 5 files changed, 170 insertions(+), 96 deletions(-) diff --git a/internal/sdkv2/schema.go b/internal/sdkv2/schema.go index 660cd02c4bdd..1c46ab8f1e8e 100644 --- a/internal/sdkv2/schema.go +++ b/internal/sdkv2/schema.go @@ -68,9 +68,15 @@ func ComputedOnlyFromResourceSchema(rs map[string]*schema.Schema) map[string]*sc return cs } +// IAMPolicyDocumentSchemaRequired returns the standard schema for an optional IAM policy JSON document. +var IAMPolicyDocumentSchemaOptional = sync.OnceValue(jsonDocumentSchemaOptionalFunc(SuppressEquivalentIAMPolicyDocuments)) + // IAMPolicyDocumentSchemaOptionalComputed returns the standard schema for an optional, computed IAM policy JSON document. var IAMPolicyDocumentSchemaOptionalComputed = sync.OnceValue(jsonDocumentSchemaOptionalComputedFunc(SuppressEquivalentIAMPolicyDocuments)) +// IAMPolicyDocumentSchemaRequiredForceNew returns the standard schema for a required, force-new IAM policy JSON document. +var IAMPolicyDocumentSchemaRequiredForceNew = sync.OnceValue(jsonDocumentSchemaRequiredForceNewFunc(SuppressEquivalentIAMPolicyDocuments)) + // JSONDocumentSchemaRequired returns the standard schema for an optional, force-new JSON document. var JSONDocumentSchemaOptionalForceNew = sync.OnceValue(jsonDocumentSchemaOptionalForceNewFunc(SuppressEquivalentJSONDocuments)) @@ -80,6 +86,19 @@ var JSONDocumentSchemaRequired = sync.OnceValue(jsonDocumentSchemaRequiredFunc(S // IAMPolicyDocumentSchemaRequired returns the standard schema for a required IAM policy JSON document. var IAMPolicyDocumentSchemaRequired = sync.OnceValue(jsonDocumentSchemaRequiredFunc(SuppressEquivalentIAMPolicyDocuments)) +func jsonDocumentSchemaOptionalFunc(diffSuppressFunc schema.SchemaDiffSuppressFunc) func() *schema.Schema { + return func() *schema.Schema { + return &schema.Schema{ + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringIsJSON, + DiffSuppressFunc: diffSuppressFunc, + DiffSuppressOnRefresh: true, + StateFunc: NormalizeJsonStringSchemaStateFunc, + } + } +} + func jsonDocumentSchemaOptionalComputedFunc(diffSuppressFunc schema.SchemaDiffSuppressFunc) func() *schema.Schema { return func() *schema.Schema { return &schema.Schema{ @@ -120,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/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) From bd6c4744530e71ca7a8d3bda16ae4aa719f55a77 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Wed, 25 Jun 2025 15:34:16 -0400 Subject: [PATCH 02/31] glue: Replace 'PlanOnly' acceptance test steps with 'plancheck's. --- internal/service/glue/exports_test.go | 1 + internal/service/glue/resource_policy.go | 91 +++++++++++-------- internal/service/glue/resource_policy_test.go | 64 +++++++------ 3 files changed, 93 insertions(+), 63 deletions(-) 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)) From aa0860a98b3dddaa0d8937dbca0d3fe024642e93 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Wed, 25 Jun 2025 15:41:39 -0400 Subject: [PATCH 03/31] iot: Replace 'PlanOnly' acceptance test steps with 'plancheck's. --- internal/service/inspector2/enabler_test.go | 1 - internal/service/iot/billing_group_test.go | 34 +++++++++++++++++++-- 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/internal/service/inspector2/enabler_test.go b/internal/service/inspector2/enabler_test.go index 02278f5594d2..10392202620a 100644 --- a/internal/service/inspector2/enabler_test.go +++ b/internal/service/inspector2/enabler_test.go @@ -524,7 +524,6 @@ func testAccEnabler_memberAccount_updateMemberAccountsAndScanTypes(t *testing.T) resource.TestCheckResourceAttr(resourceName, "resource_types.#", "1"), resource.TestCheckTypeSetElemAttr(resourceName, "resource_types.*", string(types.ResourceScanTypeLambda)), ), - // PlanOnly: true, }, }, }) diff --git a/internal/service/iot/billing_group_test.go b/internal/service/iot/billing_group_test.go index 6feadcd2df56..e72ae309a8d5 100644 --- a/internal/service/iot/billing_group_test.go +++ b/internal/service/iot/billing_group_test.go @@ -11,6 +11,7 @@ import ( "github.com/YakDriver/regexache" 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" @@ -186,11 +187,23 @@ func TestAccIoTBillingGroup_migrateFromPluginSDK(t *testing.T) { resource.TestCheckResourceAttr(resourceName, acctest.CtTagsPercent, "0"), resource.TestCheckResourceAttr(resourceName, names.AttrVersion, "1"), ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), + }, + }, }, { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, Config: testAccBillingGroupConfig_basic(rName), - PlanOnly: true, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -217,11 +230,23 @@ func TestAccIoTBillingGroup_migrateFromPluginSDK_properties(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckBillingGroupExists(ctx, resourceName), ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), + }, + }, }, { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, Config: testAccBillingGroupConfig_properties(rName), - PlanOnly: true, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, @@ -232,6 +257,11 @@ func TestAccIoTBillingGroup_migrateFromPluginSDK_properties(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "properties.0.description", "test description 2"), resource.TestCheckResourceAttr(resourceName, names.AttrVersion, "2"), ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), + }, + }, }, }, }) From 9189bf9aa95d33a0feb977bc29c38a522907a292 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Thu, 26 Jun 2025 08:27:50 -0400 Subject: [PATCH 04/31] kendra: Replace 'PlanOnly' acceptance test steps with 'plancheck's. --- internal/service/kendra/experience_test.go | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/internal/service/kendra/experience_test.go b/internal/service/kendra/experience_test.go index b2cded3d97bc..99ad5a37cc43 100644 --- a/internal/service/kendra/experience_test.go +++ b/internal/service/kendra/experience_test.go @@ -12,6 +12,7 @@ import ( "github.com/YakDriver/regexache" 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" @@ -562,12 +563,23 @@ func TestAccKendraExperience_Configuration_UserIdentityConfigurationWithContentS resource.TestCheckResourceAttr(resourceName, "configuration.0.user_identity_configuration.#", "1"), resource.TestCheckResourceAttr(resourceName, "configuration.0.user_identity_configuration.0.identity_attribute_name", userId), ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), + }, + }, }, { // Since configuration.content_source_configuration is Optional+Computed, removal in the test config should not trigger changes - PlanOnly: true, - Config: testAccExperienceConfig_configuration_userIdentityConfiguration(rName, userId), - ExpectNonEmptyPlan: false, + Config: testAccExperienceConfig_configuration_userIdentityConfiguration(rName, userId), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) From 8d1809546fc2a13ff8281b479acce3182cb959e9 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Fri, 27 Jun 2025 17:15:36 -0400 Subject: [PATCH 05/31] iam: Replace 'PlanOnly' acceptance test steps with 'plancheck's. --- internal/service/iam/group_policy.go | 13 +- .../iam/openid_connect_provider_test.go | 17 +- internal/service/iam/policy.go | 13 +- .../iam/policy_document_data_source_test.go | 9 +- internal/service/iam/policy_test.go | 139 +++++++------ internal/service/iam/role.go | 25 +-- internal/service/iam/role_policy.go | 13 +- internal/service/iam/role_policy_test.go | 17 +- internal/service/iam/role_test.go | 196 ++++++------------ internal/service/iam/user_policy.go | 13 +- internal/service/iam/user_policy_test.go | 17 +- 11 files changed, 208 insertions(+), 264 deletions(-) diff --git a/internal/service/iam/group_policy.go b/internal/service/iam/group_policy.go index 07c96ef64c5b..1fdf386f4205 100644 --- a/internal/service/iam/group_policy.go +++ b/internal/service/iam/group_policy.go @@ -20,6 +20,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/create" "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" @@ -57,17 +58,7 @@ func resourceGroupPolicy() *schema.Resource { ForceNew: true, ConflictsWith: []string{names.AttrName}, }, - names.AttrPolicy: { - Type: schema.TypeString, - Required: true, - ValidateFunc: verify.ValidIAMPolicyJSON, - DiffSuppressFunc: verify.SuppressEquivalentPolicyDiffs, - DiffSuppressOnRefresh: true, - StateFunc: func(v any) string { - json, _ := verify.LegacyPolicyNormalize(v) - return json - }, - }, + names.AttrPolicy: sdkv2.IAMPolicyDocumentSchemaRequired(), }, } } 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.go b/internal/service/iam/policy.go index 21a70731d43d..1535598c6ebd 100644 --- a/internal/service/iam/policy.go +++ b/internal/service/iam/policy.go @@ -22,6 +22,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/create" "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/slices" tftags "github.com/hashicorp/terraform-provider-aws/internal/tags" "github.com/hashicorp/terraform-provider-aws/internal/tfresource" @@ -84,17 +85,7 @@ func resourcePolicy() *schema.Resource { Default: "/", ForceNew: true, }, - names.AttrPolicy: { - Type: schema.TypeString, - Required: true, - ValidateFunc: verify.ValidIAMPolicyJSON, - DiffSuppressFunc: verify.SuppressEquivalentPolicyDiffs, - DiffSuppressOnRefresh: true, - StateFunc: func(v any) string { - json, _ := structure.NormalizeJsonString(v) - return json - }, - }, + names.AttrPolicy: sdkv2.IAMPolicyDocumentSchemaRequired(), "policy_id": { Type: schema.TypeString, Computed: true, diff --git a/internal/service/iam/policy_document_data_source_test.go b/internal/service/iam/policy_document_data_source_test.go index 6fe96960d552..ff9b78a9c1bc 100644 --- a/internal/service/iam/policy_document_data_source_test.go +++ b/internal/service/iam/policy_document_data_source_test.go @@ -10,6 +10,7 @@ import ( "github.com/YakDriver/regexache" "github.com/hashicorp/aws-sdk-go-base/v2/endpoints" "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/plancheck" "github.com/hashicorp/terraform-provider-aws/internal/acctest" "github.com/hashicorp/terraform-provider-aws/names" ) @@ -244,8 +245,12 @@ func TestAccIAMPolicyDocumentDataSource_invalidSidValid(t *testing.T) { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, Steps: []resource.TestStep{ { - Config: testAccPolicyDocumentDataSourceConfig_invalidSid, - PlanOnly: true, + Config: testAccPolicyDocumentDataSourceConfig_invalidSid, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction("data.aws_iam_policy_document.test", plancheck.ResourceActionCreate), + }, + }, }, }, }) diff --git a/internal/service/iam/policy_test.go b/internal/service/iam/policy_test.go index 5367e661eb04..12d6a26172e0 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,22 @@ 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.ResourceActionUpdate), + }, + }, }, { 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), + }, + }, }, }, }) diff --git a/internal/service/iam/role.go b/internal/service/iam/role.go index e99e8bc6facc..adbf2a3a3704 100644 --- a/internal/service/iam/role.go +++ b/internal/service/iam/role.go @@ -29,6 +29,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/errs/sdkdiag" "github.com/hashicorp/terraform-provider-aws/internal/flex" "github.com/hashicorp/terraform-provider-aws/internal/provider/sdkv2/importer" + "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" @@ -70,17 +71,7 @@ func resourceRole() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "assume_role_policy": { - Type: schema.TypeString, - Required: true, - ValidateFunc: verify.ValidIAMPolicyJSON, - DiffSuppressFunc: verify.SuppressEquivalentPolicyDiffs, - DiffSuppressOnRefresh: true, - StateFunc: func(v any) string { - json, _ := structure.NormalizeJsonString(v) - return json - }, - }, + "assume_role_policy": sdkv2.IAMPolicyDocumentSchemaRequired(), "create_date": { Type: schema.TypeString, Computed: true, @@ -118,17 +109,7 @@ func resourceRole() *schema.Resource { validRolePolicyName, ), }, - names.AttrPolicy: { - Type: schema.TypeString, - Optional: true, // semantically required but syntactically optional to allow empty inline_policy - ValidateFunc: verify.ValidIAMPolicyJSON, - DiffSuppressFunc: verify.SuppressEquivalentPolicyDiffs, - DiffSuppressOnRefresh: true, - StateFunc: func(v any) string { - json, _ := verify.LegacyPolicyNormalize(v) - return json - }, - }, + names.AttrPolicy: sdkv2.IAMPolicyDocumentSchemaOptional(), // semantically required but syntactically optional to allow empty inline_policy }, }, DiffSuppressFunc: func(k, _, _ string, d *schema.ResourceData) bool { diff --git a/internal/service/iam/role_policy.go b/internal/service/iam/role_policy.go index 9776a9b486cd..1962d6f468c0 100644 --- a/internal/service/iam/role_policy.go +++ b/internal/service/iam/role_policy.go @@ -21,6 +21,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/create" "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" @@ -60,17 +61,7 @@ func resourceRolePolicy() *schema.Resource { ConflictsWith: []string{names.AttrName}, ValidateFunc: validResourceName(rolePolicyNamePrefixMaxLen), }, - names.AttrPolicy: { - Type: schema.TypeString, - Required: true, - ValidateFunc: verify.ValidIAMPolicyJSON, - DiffSuppressFunc: verify.SuppressEquivalentPolicyDiffs, - DiffSuppressOnRefresh: true, - StateFunc: func(v any) string { - json, _ := verify.LegacyPolicyNormalize(v) - return json - }, - }, + names.AttrPolicy: sdkv2.IAMPolicyDocumentSchemaRequired(), names.AttrRole: { Type: schema.TypeString, Required: true, diff --git a/internal/service/iam/role_policy_test.go b/internal/service/iam/role_policy_test.go index 5681dc451996..68b09eaa2fc8 100644 --- a/internal/service/iam/role_policy_test.go +++ b/internal/service/iam/role_policy_test.go @@ -12,6 +12,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/id" 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" @@ -148,10 +149,22 @@ func TestAccIAMRolePolicy_policyOrder(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckRolePolicyExists(ctx, resourceName, &rolePolicy), ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), + }, + }, }, { - Config: testAccRolePolicyConfig_newOrder(rName), - PlanOnly: true, + Config: testAccRolePolicyConfig_newOrder(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/iam/role_test.go b/internal/service/iam/role_test.go index a25f36ab372d..5a32ed2e97c5 100644 --- a/internal/service/iam/role_test.go +++ b/internal/service/iam/role_test.go @@ -15,6 +15,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/id" 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" @@ -207,120 +208,47 @@ func TestAccIAMRole_diffs(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckRoleExists(ctx, resourceName, &conf), ), - }, - { - Config: testAccRoleConfig_diffs(rName, ""), - PlanOnly: true, - }, - { - Config: testAccRoleConfig_diffs(rName, ""), - Check: resource.ComposeTestCheckFunc( - testAccCheckRoleExists(ctx, resourceName, &conf), - ), - }, - { - Config: testAccRoleConfig_diffs(rName, ""), - PlanOnly: true, - }, - { - Config: testAccRoleConfig_diffs(rName, ""), - Check: resource.ComposeTestCheckFunc( - testAccCheckRoleExists(ctx, resourceName, &conf), - ), - }, - { - Config: testAccRoleConfig_diffs(rName, ""), - PlanOnly: true, - }, - { - Config: testAccRoleConfig_diffs(rName, ""), - Check: resource.ComposeTestCheckFunc( - testAccCheckRoleExists(ctx, resourceName, &conf), - ), - }, - { - Config: testAccRoleConfig_diffs(rName, ""), - PlanOnly: true, - }, - { - Config: testAccRoleConfig_diffs(rName, ""), - Check: resource.ComposeTestCheckFunc( - testAccCheckRoleExists(ctx, resourceName, &conf), - ), - }, - { - Config: testAccRoleConfig_diffs(rName, ""), - PlanOnly: true, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), + }, + }, }, { Config: testAccRoleConfig_diffs(rName, ""), Check: resource.ComposeTestCheckFunc( testAccCheckRoleExists(ctx, resourceName, &conf), ), - }, - { - Config: testAccRoleConfig_diffs(rName, ""), - PlanOnly: true, - }, - { - Config: testAccRoleConfig_diffs(rName, "tags = {}"), - Check: resource.ComposeTestCheckFunc( - testAccCheckRoleExists(ctx, resourceName, &conf), - ), - }, - { - Config: testAccRoleConfig_diffs(rName, "tags = {}"), - PlanOnly: true, - }, - { - Config: testAccRoleConfig_diffs(rName, "tags = {}"), - Check: resource.ComposeTestCheckFunc( - testAccCheckRoleExists(ctx, resourceName, &conf), - ), - }, - { - Config: testAccRoleConfig_diffs(rName, "tags = {}"), - PlanOnly: true, - }, - { - Config: testAccRoleConfig_diffs(rName, "tags = {}"), - Check: resource.ComposeTestCheckFunc( - testAccCheckRoleExists(ctx, resourceName, &conf), - ), - }, - { - Config: testAccRoleConfig_diffs(rName, "tags = {}"), - PlanOnly: true, - }, - { - Config: testAccRoleConfig_diffs(rName, "tags = {}"), - Check: resource.ComposeTestCheckFunc( - testAccCheckRoleExists(ctx, resourceName, &conf), - ), - }, - { - Config: testAccRoleConfig_diffs(rName, "tags = {}"), - PlanOnly: true, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, { Config: testAccRoleConfig_diffs(rName, "tags = {}"), Check: resource.ComposeTestCheckFunc( testAccCheckRoleExists(ctx, resourceName, &conf), ), - }, - { - Config: testAccRoleConfig_diffs(rName, "tags = {}"), - PlanOnly: true, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), + }, + }, }, { Config: testAccRoleConfig_diffs(rName, "tags = {}"), - Check: resource.ComposeTestCheckFunc( - testAccCheckRoleExists(ctx, resourceName, &conf), - ), - }, - { - Config: testAccRoleConfig_diffs(rName, "tags = {}"), - PlanOnly: true, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -344,30 +272,22 @@ func TestAccIAMRole_diffsCondition(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckRoleExists(ctx, resourceName, &conf), ), - }, - { - Config: testAccRoleConfig_diffsCondition(rName), - PlanOnly: true, - }, - { - Config: testAccRoleConfig_diffsCondition(rName), - Check: resource.ComposeTestCheckFunc( - testAccCheckRoleExists(ctx, resourceName, &conf), - ), - }, - { - Config: testAccRoleConfig_diffsCondition(rName), - PlanOnly: true, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), + }, + }, }, { Config: testAccRoleConfig_diffsCondition(rName), - Check: resource.ComposeTestCheckFunc( - testAccCheckRoleExists(ctx, resourceName, &conf), - ), - }, - { - Config: testAccRoleConfig_diffsCondition(rName), - PlanOnly: true, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -656,19 +576,41 @@ func TestAccIAMRole_InlinePolicy_ignoreOrder(t *testing.T) { resource.TestCheckResourceAttr(resourceName, names.AttrName, rName), resource.TestCheckResourceAttr(resourceName, "managed_policy_arns.#", "0"), ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), + }, + }, }, { - Config: testAccRoleConfig_policyInlineActionOrder(rName), - PlanOnly: true, + Config: testAccRoleConfig_policyInlineActionOrder(rName), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, { - Config: testAccRoleConfig_policyInlineActionNewOrder(rName), - PlanOnly: true, + Config: testAccRoleConfig_policyInlineActionNewOrder(rName), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, { - Config: testAccRoleConfig_policyInlineActionOrderActualDiff(rName), - PlanOnly: true, - ExpectNonEmptyPlan: true, + Config: testAccRoleConfig_policyInlineActionOrderActualDiff(rName), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), + }, + }, }, }, }) diff --git a/internal/service/iam/user_policy.go b/internal/service/iam/user_policy.go index 13f06d79edcf..6f4a2391cc96 100644 --- a/internal/service/iam/user_policy.go +++ b/internal/service/iam/user_policy.go @@ -20,6 +20,7 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/create" "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" @@ -52,17 +53,7 @@ func resourceUserPolicy() *schema.Resource { ForceNew: true, ConflictsWith: []string{names.AttrName}, }, - names.AttrPolicy: { - Type: schema.TypeString, - Required: true, - ValidateFunc: verify.ValidIAMPolicyJSON, - DiffSuppressFunc: verify.SuppressEquivalentPolicyDiffs, - DiffSuppressOnRefresh: true, - StateFunc: func(v any) string { - json, _ := verify.LegacyPolicyNormalize(v) - return json - }, - }, + names.AttrPolicy: sdkv2.IAMPolicyDocumentSchemaRequired(), "user": { Type: schema.TypeString, Required: true, diff --git a/internal/service/iam/user_policy_test.go b/internal/service/iam/user_policy_test.go index 22e5edc793d2..d6eb06bc42c3 100644 --- a/internal/service/iam/user_policy_test.go +++ b/internal/service/iam/user_policy_test.go @@ -15,6 +15,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/id" 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" @@ -218,10 +219,22 @@ func TestAccIAMUserPolicy_policyOrder(t *testing.T) { testAccCheckUserPolicyExists(ctx, resourceName, &userPolicy), testAccCheckUserPolicyExpectedPolicies(ctx, userResourceName, 1), ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), + }, + }, }, { - Config: testAccUserPolicyConfig_newOrder(rName), - PlanOnly: true, + Config: testAccUserPolicyConfig_newOrder(rName), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) From 5be8b3da2f48c36700e188c521901559fccc238a Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Fri, 27 Jun 2025 18:03:10 -0400 Subject: [PATCH 06/31] iam: Replace 'PlanOnly' acceptance test steps with 'plancheck's. --- internal/service/iam/group_policy.go | 13 ++++++++-- internal/service/iam/policy.go | 13 ++++++++-- .../iam/policy_document_data_source_test.go | 6 ----- internal/service/iam/policy_test.go | 7 ++++-- internal/service/iam/role.go | 25 ++++++++++++++++--- internal/service/iam/role_policy.go | 13 ++++++++-- internal/service/iam/role_test.go | 11 -------- internal/service/iam/user_policy.go | 13 ++++++++-- 8 files changed, 71 insertions(+), 30 deletions(-) diff --git a/internal/service/iam/group_policy.go b/internal/service/iam/group_policy.go index 1fdf386f4205..07c96ef64c5b 100644 --- a/internal/service/iam/group_policy.go +++ b/internal/service/iam/group_policy.go @@ -20,7 +20,6 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/create" "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" @@ -58,7 +57,17 @@ func resourceGroupPolicy() *schema.Resource { ForceNew: true, ConflictsWith: []string{names.AttrName}, }, - names.AttrPolicy: sdkv2.IAMPolicyDocumentSchemaRequired(), + names.AttrPolicy: { + Type: schema.TypeString, + Required: true, + ValidateFunc: verify.ValidIAMPolicyJSON, + DiffSuppressFunc: verify.SuppressEquivalentPolicyDiffs, + DiffSuppressOnRefresh: true, + StateFunc: func(v any) string { + json, _ := verify.LegacyPolicyNormalize(v) + return json + }, + }, }, } } diff --git a/internal/service/iam/policy.go b/internal/service/iam/policy.go index 1535598c6ebd..21a70731d43d 100644 --- a/internal/service/iam/policy.go +++ b/internal/service/iam/policy.go @@ -22,7 +22,6 @@ import ( "github.com/hashicorp/terraform-provider-aws/internal/create" "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/slices" tftags "github.com/hashicorp/terraform-provider-aws/internal/tags" "github.com/hashicorp/terraform-provider-aws/internal/tfresource" @@ -85,7 +84,17 @@ func resourcePolicy() *schema.Resource { Default: "/", ForceNew: true, }, - names.AttrPolicy: sdkv2.IAMPolicyDocumentSchemaRequired(), + names.AttrPolicy: { + Type: schema.TypeString, + Required: true, + ValidateFunc: verify.ValidIAMPolicyJSON, + DiffSuppressFunc: verify.SuppressEquivalentPolicyDiffs, + DiffSuppressOnRefresh: true, + StateFunc: func(v any) string { + json, _ := structure.NormalizeJsonString(v) + return json + }, + }, "policy_id": { Type: schema.TypeString, Computed: true, diff --git a/internal/service/iam/policy_document_data_source_test.go b/internal/service/iam/policy_document_data_source_test.go index ff9b78a9c1bc..6dda6e130ba5 100644 --- a/internal/service/iam/policy_document_data_source_test.go +++ b/internal/service/iam/policy_document_data_source_test.go @@ -10,7 +10,6 @@ import ( "github.com/YakDriver/regexache" "github.com/hashicorp/aws-sdk-go-base/v2/endpoints" "github.com/hashicorp/terraform-plugin-testing/helper/resource" - "github.com/hashicorp/terraform-plugin-testing/plancheck" "github.com/hashicorp/terraform-provider-aws/internal/acctest" "github.com/hashicorp/terraform-provider-aws/names" ) @@ -246,11 +245,6 @@ func TestAccIAMPolicyDocumentDataSource_invalidSidValid(t *testing.T) { Steps: []resource.TestStep{ { Config: testAccPolicyDocumentDataSourceConfig_invalidSid, - ConfigPlanChecks: resource.ConfigPlanChecks{ - PreApply: []plancheck.PlanCheck{ - plancheck.ExpectResourceAction("data.aws_iam_policy_document.test", plancheck.ResourceActionCreate), - }, - }, }, }, }) diff --git a/internal/service/iam/policy_test.go b/internal/service/iam/policy_test.go index 12d6a26172e0..f75bfd565914 100644 --- a/internal/service/iam/policy_test.go +++ b/internal/service/iam/policy_test.go @@ -325,7 +325,10 @@ func TestAccIAMPolicy_diffs(t *testing.T) { ), ConfigPlanChecks: resource.ConfigPlanChecks{ PreApply: []plancheck.PlanCheck{ - plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), }, }, }, @@ -663,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 = < Date: Sun, 29 Jun 2025 16:41:44 -0400 Subject: [PATCH 07/31] kms: Replace 'PlanOnly' acceptance test steps with 'plancheck's. --- internal/service/kms/alias_test.go | 25 +++++++++++++++++++++---- internal/service/kms/key_policy_test.go | 21 --------------------- internal/service/kms/key_test.go | 21 --------------------- 3 files changed, 21 insertions(+), 46 deletions(-) diff --git a/internal/service/kms/alias_test.go b/internal/service/kms/alias_test.go index d731f8ba51a8..883cce237743 100644 --- a/internal/service/kms/alias_test.go +++ b/internal/service/kms/alias_test.go @@ -13,7 +13,11 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/id" sdkacctest "github.com/hashicorp/terraform-plugin-testing/helper/acctest" "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/knownvalue" + "github.com/hashicorp/terraform-plugin-testing/plancheck" + "github.com/hashicorp/terraform-plugin-testing/statecheck" "github.com/hashicorp/terraform-plugin-testing/terraform" + "github.com/hashicorp/terraform-plugin-testing/tfjsonpath" "github.com/hashicorp/terraform-provider-aws/internal/acctest" "github.com/hashicorp/terraform-provider-aws/internal/conns" tfkms "github.com/hashicorp/terraform-provider-aws/internal/service/kms" @@ -224,8 +228,15 @@ func TestAccKMSAlias_arnDiffSuppress(t *testing.T) { Config: testAccAliasConfig_diffSuppress(rName), Check: resource.ComposeTestCheckFunc( testAccCheckAliasExists(ctx, resourceName, &alias), - resource.TestCheckResourceAttrSet(resourceName, "target_key_arn"), ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), + }, + }, + ConfigStateChecks: []statecheck.StateCheck{ + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New("target_key_arn"), knownvalue.NotNull()), + }, }, { ResourceName: resourceName, @@ -233,9 +244,15 @@ func TestAccKMSAlias_arnDiffSuppress(t *testing.T) { ImportStateVerify: true, }, { - ExpectNonEmptyPlan: false, - PlanOnly: true, - Config: testAccAliasConfig_diffSuppress(rName), + Config: testAccAliasConfig_diffSuppress(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/kms/key_policy_test.go b/internal/service/kms/key_policy_test.go index 0d4147eed6d2..c0381c429818 100644 --- a/internal/service/kms/key_policy_test.go +++ b/internal/service/kms/key_policy_test.go @@ -238,27 +238,6 @@ func TestAccKMSKeyPolicy_iamRoleOrder(t *testing.T) { testAccCheckKeyExists(ctx, keyResourceName, &key), ), }, - { - Config: testAccKeyPolicyConfig_policyIAMMultiRole(rName), - Check: resource.ComposeTestCheckFunc( - testAccCheckKeyExists(ctx, keyResourceName, &key), - ), - PlanOnly: true, - }, - { - Config: testAccKeyPolicyConfig_policyIAMMultiRole(rName), - Check: resource.ComposeTestCheckFunc( - testAccCheckKeyExists(ctx, keyResourceName, &key), - ), - PlanOnly: true, - }, - { - Config: testAccKeyPolicyConfig_policyIAMMultiRole(rName), - Check: resource.ComposeTestCheckFunc( - testAccCheckKeyExists(ctx, keyResourceName, &key), - ), - PlanOnly: true, - }, }, }) } diff --git a/internal/service/kms/key_test.go b/internal/service/kms/key_test.go index 2b8fdd63d8b7..784a20b47e27 100644 --- a/internal/service/kms/key_test.go +++ b/internal/service/kms/key_test.go @@ -369,27 +369,6 @@ func TestAccKMSKey_Policy_iamRoleOrder(t *testing.T) { testAccCheckKeyExists(ctx, resourceName, &key), ), }, - { - Config: testAccKeyConfig_policyIAMMultiRole(rName), - Check: resource.ComposeTestCheckFunc( - testAccCheckKeyExists(ctx, resourceName, &key), - ), - PlanOnly: true, - }, - { - Config: testAccKeyConfig_policyIAMMultiRole(rName), - Check: resource.ComposeTestCheckFunc( - testAccCheckKeyExists(ctx, resourceName, &key), - ), - PlanOnly: true, - }, - { - Config: testAccKeyConfig_policyIAMMultiRole(rName), - Check: resource.ComposeTestCheckFunc( - testAccCheckKeyExists(ctx, resourceName, &key), - ), - PlanOnly: true, - }, }, }) } From a9c1d09bbb322b41fe61425e36a0b9824ecbe2c4 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Sun, 29 Jun 2025 17:50:16 -0400 Subject: [PATCH 08/31] lambda: Replace 'PlanOnly' acceptance test steps with 'plancheck's. --- internal/service/lambda/alias_test.go | 23 ++- .../lambda/event_source_mapping_test.go | 139 +++++++++++++++--- internal/service/mq/broker_test.go | 2 +- 3 files changed, 143 insertions(+), 21 deletions(-) diff --git a/internal/service/lambda/alias_test.go b/internal/service/lambda/alias_test.go index eab85adb36d7..8a04cad52d0a 100644 --- a/internal/service/lambda/alias_test.go +++ b/internal/service/lambda/alias_test.go @@ -12,8 +12,12 @@ import ( "github.com/aws/aws-sdk-go-v2/service/lambda" 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/statecheck" "github.com/hashicorp/terraform-plugin-testing/terraform" + "github.com/hashicorp/terraform-plugin-testing/tfjsonpath" "github.com/hashicorp/terraform-provider-aws/internal/acctest" + tfknownvalue "github.com/hashicorp/terraform-provider-aws/internal/acctest/knownvalue" "github.com/hashicorp/terraform-provider-aws/internal/conns" tflambda "github.com/hashicorp/terraform-provider-aws/internal/service/lambda" "github.com/hashicorp/terraform-provider-aws/internal/tfresource" @@ -47,6 +51,14 @@ func TestAccLambdaAlias_basic(t *testing.T) { acctest.CheckResourceAttrRegionalARN(ctx, resourceName, names.AttrARN, "lambda", functionArnResourcePart), testAccCheckAliasInvokeARN(resourceName, &conf), ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), + }, + }, + ConfigStateChecks: []statecheck.StateCheck{ + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrARN), tfknownvalue.RegionalARNExact("lambda", functionArnResourcePart)), + }, }, { ResourceName: resourceName, @@ -55,8 +67,15 @@ func TestAccLambdaAlias_basic(t *testing.T) { ImportStateVerify: true, }, { - Config: testAccAliasConfig_usingFunctionName(roleName, policyName, attachmentName, funcName, aliasName), - PlanOnly: true, + Config: testAccAliasConfig_usingFunctionName(roleName, policyName, attachmentName, funcName, aliasName), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) diff --git a/internal/service/lambda/event_source_mapping_test.go b/internal/service/lambda/event_source_mapping_test.go index c7222de4365d..9bd2bf381a30 100644 --- a/internal/service/lambda/event_source_mapping_test.go +++ b/internal/service/lambda/event_source_mapping_test.go @@ -20,6 +20,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry" 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" @@ -62,13 +63,25 @@ func TestAccLambdaEventSourceMapping_Kinesis_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "provisioned_poller_config.#", "0"), resource.TestCheckResourceAttr(resourceName, "tumbling_window_in_seconds", "0"), ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), + }, + }, }, // batch_size became optional. Ensure that if the user supplies the default // value, but then moves to not providing the value, that we don't consider this // a diff. { - PlanOnly: true, - Config: testAccEventSourceMappingConfig_kinesisBatchSize(rName, "null"), + Config: testAccEventSourceMappingConfig_kinesisBatchSize(rName, "null"), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, { ResourceName: resourceName, @@ -86,6 +99,11 @@ func TestAccLambdaEventSourceMapping_Kinesis_basic(t *testing.T) { resource.TestCheckResourceAttrPair(resourceName, names.AttrFunctionARN, functionResourceNameUpdated, names.AttrARN), resource.TestCheckResourceAttrPair(resourceName, "function_name", functionResourceNameUpdated, names.AttrARN), ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), + }, + }, }, }, }) @@ -196,13 +214,25 @@ func TestAccLambdaEventSourceMapping_SQS_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "filter_criteria.#", "0"), resource.TestCheckResourceAttr(resourceName, "scaling_config.#", "0"), ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), + }, + }, }, // batch_size became optional. Ensure that if the user supplies the default // value, but then moves to not providing the value, that we don't consider this // a diff. { - PlanOnly: true, - Config: testAccEventSourceMappingConfig_sqsBatchSize(rName, "null"), + Config: testAccEventSourceMappingConfig_sqsBatchSize(rName, "null"), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, { ResourceName: resourceName, @@ -221,6 +251,11 @@ func TestAccLambdaEventSourceMapping_SQS_basic(t *testing.T) { resource.TestCheckResourceAttrPair(resourceName, names.AttrFunctionARN, functionResourceNameUpdated, names.AttrARN), acctest.CheckResourceAttrRFC3339(resourceName, "last_modified"), ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), + }, + }, }, }, }) @@ -253,13 +288,25 @@ func TestAccLambdaEventSourceMapping_DynamoDB_basic(t *testing.T) { acctest.CheckResourceAttrRFC3339(resourceName, "last_modified"), resource.TestCheckResourceAttr(resourceName, "tumbling_window_in_seconds", "0"), ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), + }, + }, }, // batch_size became optional. Ensure that if the user supplies the default // value, but then moves to not providing the value, that we don't consider this // a diff. { - PlanOnly: true, - Config: testAccEventSourceMappingConfig_dynamoDBBatchSize(rName, "null"), + Config: testAccEventSourceMappingConfig_dynamoDBBatchSize(rName, "null"), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, { ResourceName: resourceName, @@ -894,13 +941,25 @@ func TestAccLambdaEventSourceMapping_msk(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "topics.#", "1"), resource.TestCheckTypeSetElemAttr(resourceName, "topics.*", "test"), ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), + }, + }, }, // batch_size became optional. Ensure that if the user supplies the default // value, but then moves to not providing the value, that we don't consider this // a diff. { - PlanOnly: true, - Config: testAccEventSourceMappingConfig_msk(rName, "null"), + Config: testAccEventSourceMappingConfig_msk(rName, "null"), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, { ResourceName: resourceName, @@ -919,6 +978,11 @@ func TestAccLambdaEventSourceMapping_msk(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "topics.#", "1"), resource.TestCheckTypeSetElemAttr(resourceName, "topics.*", "test"), ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), + }, + }, }, }, }) @@ -992,14 +1056,26 @@ func TestAccLambdaEventSourceMapping_selfManagedKafka(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "topics.#", "1"), resource.TestCheckTypeSetElemAttr(resourceName, "topics.*", "test"), ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), + }, + }, }, // batch_size became optional. Ensure that if the user supplies the default // value, but then moves to not providing the value, that we don't consider this // a diff. // Verify also that bootstrap broker order does not matter. { - PlanOnly: true, - Config: testAccEventSourceMappingConfig_selfManagedKafka(rName, "null", "test2:9092,test1:9092"), + Config: testAccEventSourceMappingConfig_selfManagedKafka(rName, "null", "test2:9092,test1:9092"), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, { ResourceName: resourceName, @@ -1128,13 +1204,25 @@ func TestAccLambdaEventSourceMapping_activeMQ(t *testing.T) { resource.TestCheckTypeSetElemAttr(resourceName, "queues.*", "test"), resource.TestCheckResourceAttr(resourceName, "source_access_configuration.#", "1"), ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), + }, + }, }, // batch_size became optional. Ensure that if the user supplies the default // value, but then moves to not providing the value, that we don't consider this // a diff. { - PlanOnly: true, - Config: testAccEventSourceMappingConfig_activeMQ(rName, "null"), + Config: testAccEventSourceMappingConfig_activeMQ(rName, "null"), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -1171,13 +1259,25 @@ func TestAccLambdaEventSourceMapping_rabbitMQ(t *testing.T) { resource.TestCheckTypeSetElemAttr(resourceName, "queues.*", "test"), resource.TestCheckResourceAttr(resourceName, "source_access_configuration.#", "2"), ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), + }, + }, }, // batch_size became optional. Ensure that if the user supplies the default // value, but then moves to not providing the value, that we don't consider this // a diff. { - PlanOnly: true, - Config: testAccEventSourceMappingConfig_rabbitMQ(rName, "null"), + Config: testAccEventSourceMappingConfig_rabbitMQ(rName, "null"), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -1932,12 +2032,14 @@ resource "aws_security_group" "test" { resource "aws_mq_broker" "test" { broker_name = %[1]q engine_type = "ActiveMQ" - engine_version = "5.17.6" - host_instance_type = "mq.t2.micro" + engine_version = "5.18" + host_instance_type = "mq.t3.micro" security_groups = [aws_security_group.test.id] authentication_strategy = "simple" storage_type = "efs" + auto_minor_version_upgrade = true + logs { general = true } @@ -2020,9 +2122,10 @@ resource "aws_lambda_function" "test" { resource "aws_mq_broker" "test" { broker_name = %[1]q engine_type = "RabbitMQ" - engine_version = "3.8.11" + engine_version = "3.13" host_instance_type = "mq.t3.micro" - authentication_strategy = "simple" + + auto_minor_version_upgrade = true logs { general = true diff --git a/internal/service/mq/broker_test.go b/internal/service/mq/broker_test.go index 41d4af07d7e0..0a3b6c9b0e3f 100644 --- a/internal/service/mq/broker_test.go +++ b/internal/service/mq/broker_test.go @@ -1644,7 +1644,7 @@ func TestAccMQBroker_dataReplicationMode(t *testing.T) { testAccDeleteBrokerWithProvider(ctx, t, &brokerAlternate, acctest.RegionProviderFunc(ctx, acctest.AlternateRegion(), &providers)) }, Config: testAccBrokerConfig_dataReplicationMode(rName, testAccBrokerVersionNewer, string(types.DataReplicationModeNone)), - PlanOnly: true, + PlanOnly: true, // OK ExpectNonEmptyPlan: true, }, }, From 86458f27410e4783359dea79a21e9d59f862217f Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Mon, 30 Jun 2025 09:55:07 -0400 Subject: [PATCH 09/31] opensearch: Replace 'PlanOnly' acceptance test steps with 'plancheck's. --- internal/service/opensearch/domain_test.go | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/internal/service/opensearch/domain_test.go b/internal/service/opensearch/domain_test.go index be0bff81f3a8..870895e18b41 100644 --- a/internal/service/opensearch/domain_test.go +++ b/internal/service/opensearch/domain_test.go @@ -1647,10 +1647,22 @@ func TestAccOpenSearchDomain_Policy_ignoreEquivalent(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckDomainExists(ctx, resourceName, &domain), ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), + }, + }, }, { - Config: testAccDomainConfig_policyNewOrder(rName), - PlanOnly: true, + Config: testAccDomainConfig_policyNewOrder(rName), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) From 2507e0fe2a72aa57562ead3732fb1000b2530d30 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Mon, 30 Jun 2025 09:57:42 -0400 Subject: [PATCH 10/31] opensearchserverless: Replace 'PlanOnly' acceptance test steps with 'plancheck's. --- .../security_policy_test.go | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/internal/service/opensearchserverless/security_policy_test.go b/internal/service/opensearchserverless/security_policy_test.go index 89cba6f818e6..130aed3b2b0f 100644 --- a/internal/service/opensearchserverless/security_policy_test.go +++ b/internal/service/opensearchserverless/security_policy_test.go @@ -13,6 +13,7 @@ import ( "github.com/aws/aws-sdk-go-v2/service/opensearchserverless/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" @@ -143,11 +144,23 @@ func TestAccOpenSearchServerlessSecurityPolicy_string(t *testing.T) { testAccCheckSecurityPolicyExists(ctx, resourceName, &securitypolicy), acctest.CheckResourceAttrEquivalentJSON(resourceName, names.AttrPolicy, testAccSecurityPolicyConfig_String_ExpectedJSON(rName)), ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), + }, + }, }, { // verify no planned changes - Config: testAccSecurityPolicyConfig_string(rName), - PlanOnly: true, + Config: testAccSecurityPolicyConfig_string(rName), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, { ResourceName: resourceName, From f5faecf44296f6ccd4b65d30aa7ddc0232ee9eba Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Mon, 30 Jun 2025 10:04:49 -0400 Subject: [PATCH 11/31] Fix terrafmt errors. --- internal/service/lambda/event_source_mapping_test.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/service/lambda/event_source_mapping_test.go b/internal/service/lambda/event_source_mapping_test.go index 9bd2bf381a30..df5561f821f8 100644 --- a/internal/service/lambda/event_source_mapping_test.go +++ b/internal/service/lambda/event_source_mapping_test.go @@ -2120,10 +2120,10 @@ resource "aws_lambda_function" "test" { } resource "aws_mq_broker" "test" { - broker_name = %[1]q - engine_type = "RabbitMQ" - engine_version = "3.13" - host_instance_type = "mq.t3.micro" + broker_name = %[1]q + engine_type = "RabbitMQ" + engine_version = "3.13" + host_instance_type = "mq.t3.micro" auto_minor_version_upgrade = true From ef2fae77c0cbf0c211d4877d02e912f5d7f5f0e1 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Mon, 30 Jun 2025 10:25:23 -0400 Subject: [PATCH 12/31] osis: Replace 'PlanOnly' acceptance test steps with 'plancheck's. --- internal/service/osis/pipeline_test.go | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/internal/service/osis/pipeline_test.go b/internal/service/osis/pipeline_test.go index 7139a57d80e3..10af7f605516 100644 --- a/internal/service/osis/pipeline_test.go +++ b/internal/service/osis/pipeline_test.go @@ -13,6 +13,7 @@ import ( "github.com/aws/aws-sdk-go-v2/service/osis/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" @@ -314,11 +315,23 @@ func TestAccOpenSearchIngestionPipeline_upgradeV5_90_0(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckPipelineExists(ctx, resourceName, &pipeline), ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), + }, + }, }, { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, Config: testAccPipelineConfig_basic(rName), - PlanOnly: true, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -409,7 +422,7 @@ resource "aws_iam_role" "test" { resource "aws_osis_pipeline" "test" { pipeline_name = %[1]q - pipeline_configuration_body = <<-EOT + pipeline_configuration_body = < Date: Mon, 30 Jun 2025 12:08:00 -0400 Subject: [PATCH 13/31] rds: Replace 'PlanOnly' acceptance test steps with 'plancheck's. --- internal/service/rds/instance_test.go | 32 ++++++++++++++++++++--- internal/service/rds/option_group_test.go | 22 ++++++++++++++-- 2 files changed, 48 insertions(+), 6 deletions(-) diff --git a/internal/service/rds/instance_test.go b/internal/service/rds/instance_test.go index 483b22293c32..a4966d38e087 100644 --- a/internal/service/rds/instance_test.go +++ b/internal/service/rds/instance_test.go @@ -1258,6 +1258,11 @@ func TestAccRDSInstance_ReplicateSourceDB_basic(t *testing.T) { resource.TestCheckResourceAttr(sourceResourceName, "replicas.#", "0"), // Before refreshing source, it will not be aware of replicas ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), + }, + }, }, { // Confirm that `replicas` is populated after refreshing source @@ -1276,8 +1281,15 @@ func TestAccRDSInstance_ReplicateSourceDB_basic(t *testing.T) { }, }, { - Config: testAccInstanceConfig_ReplicateSourceDB_sourceARN(rName), - PlanOnly: true, + Config: testAccInstanceConfig_ReplicateSourceDB_sourceARN(rName), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -1432,6 +1444,11 @@ func TestAccRDSInstance_ReplicateSourceDB_sourceARN(t *testing.T) { resource.TestCheckResourceAttrPair(resourceName, "replicate_source_db", sourceResourceName, names.AttrARN), resource.TestCheckResourceAttrPair(resourceName, "db_name", sourceResourceName, "db_name"), ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), + }, + }, }, { ResourceName: resourceName, @@ -1447,8 +1464,15 @@ func TestAccRDSInstance_ReplicateSourceDB_sourceARN(t *testing.T) { }, }, { - Config: testAccInstanceConfig_ReplicateSourceDB_basic(rName), - PlanOnly: true, + Config: testAccInstanceConfig_ReplicateSourceDB_basic(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/rds/option_group_test.go b/internal/service/rds/option_group_test.go index 1755b52a3aa2..98cddf692e61 100644 --- a/internal/service/rds/option_group_test.go +++ b/internal/service/rds/option_group_test.go @@ -15,6 +15,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/id" 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" @@ -575,10 +576,22 @@ func TestAccRDSOptionGroup_badDiffs(t *testing.T) { "option_name": "S3_INTEGRATION", }), ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), + }, + }, }, { - Config: testAccOptionGroupConfig_badDiffs1(rName), - PlanOnly: true, + Config: testAccOptionGroupConfig_badDiffs1(rName), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, { Config: testAccOptionGroupConfig_badDiffs2(rName), @@ -596,6 +609,11 @@ func TestAccRDSOptionGroup_badDiffs(t *testing.T) { names.AttrVersion: "1.0", }), ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), + }, + }, }, }, }) From b337117f94b1c4cc18a1f3bb7c007b00306c5f09 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Mon, 30 Jun 2025 12:24:10 -0400 Subject: [PATCH 14/31] redshift: Replace 'PlanOnly' acceptance test steps with 'plancheck's. --- internal/service/redshift/cluster_test.go | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/internal/service/redshift/cluster_test.go b/internal/service/redshift/cluster_test.go index 821e329aacea..176700aa5b37 100644 --- a/internal/service/redshift/cluster_test.go +++ b/internal/service/redshift/cluster_test.go @@ -343,13 +343,6 @@ func TestAccRedshiftCluster_publiclyAccessible_default(t *testing.T) { resource.TestCheckResourceAttr(resourceName, names.AttrPubliclyAccessible, acctest.CtTrue), ), }, - { - // plan should not empty because the default value has changed and will for an update unless explicitly set - ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, - Config: testAccClusterConfig_publiclyAccessible_default(rName), - PlanOnly: true, - ExpectNonEmptyPlan: true, - }, { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, Config: testAccClusterConfig_publiclyAccessible_default(rName), @@ -1412,10 +1405,6 @@ func testAccCheckClusterExists(ctx context.Context, n string, v *awstypes.Cluste return fmt.Errorf("Not found: %s", n) } - if rs.Primary.ID == "" { - return fmt.Errorf("No Redshift Cluster ID is set") - } - conn := acctest.Provider.Meta().(*conns.AWSClient).RedshiftClient(ctx) output, err := tfredshift.FindClusterByID(ctx, conn, rs.Primary.ID) From 7518720aa93348adb0fc7834ffdb69fb5da1bb99 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Mon, 30 Jun 2025 14:42:09 -0400 Subject: [PATCH 15/31] redshiftserverless: Replace 'PlanOnly' acceptance test steps with 'plancheck's. --- internal/service/redshiftserverless/namespace_test.go | 4 ---- 1 file changed, 4 deletions(-) diff --git a/internal/service/redshiftserverless/namespace_test.go b/internal/service/redshiftserverless/namespace_test.go index 7ffef0cb5c9d..eaded0fd10a3 100644 --- a/internal/service/redshiftserverless/namespace_test.go +++ b/internal/service/redshiftserverless/namespace_test.go @@ -242,10 +242,6 @@ func TestAccRedshiftServerlessNamespace_withWorkgroup(t *testing.T) { testAccCheckNamespaceExists(ctx, resourceName), ), }, - { - Config: testAccNamespaceConfig_withWorkgroup(rName), - PlanOnly: true, - }, }, }) } From 8a66617571f864981cbc1c74c06ef6c57cf3cb05 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Mon, 30 Jun 2025 14:46:00 -0400 Subject: [PATCH 16/31] route53: Replace 'PlanOnly' acceptance test steps with 'plancheck's. --- internal/service/route53/health_check_test.go | 24 ++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/internal/service/route53/health_check_test.go b/internal/service/route53/health_check_test.go index 7859a72d49fc..648373d8029b 100644 --- a/internal/service/route53/health_check_test.go +++ b/internal/service/route53/health_check_test.go @@ -14,7 +14,11 @@ import ( "github.com/hashicorp/aws-sdk-go-base/v2/endpoints" sdkacctest "github.com/hashicorp/terraform-plugin-testing/helper/acctest" "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/knownvalue" + "github.com/hashicorp/terraform-plugin-testing/plancheck" + "github.com/hashicorp/terraform-plugin-testing/statecheck" "github.com/hashicorp/terraform-plugin-testing/terraform" + "github.com/hashicorp/terraform-plugin-testing/tfjsonpath" "github.com/hashicorp/terraform-provider-aws/internal/acctest" "github.com/hashicorp/terraform-provider-aws/internal/conns" tfroute53 "github.com/hashicorp/terraform-provider-aws/internal/service/route53" @@ -245,8 +249,15 @@ func TestAccRoute53HealthCheck_ipv6(t *testing.T) { Config: testAccHealthCheckConfig_ip("1234:5678:9abc:6811:0:0:0:4"), Check: resource.ComposeTestCheckFunc( testAccCheckHealthCheckExists(ctx, resourceName, &check), - resource.TestCheckResourceAttr(resourceName, names.AttrIPAddress, "1234:5678:9abc:6811:0:0:0:4"), ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), + }, + }, + ConfigStateChecks: []statecheck.StateCheck{ + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrIPAddress), knownvalue.StringExact("1234:5678:9abc:6811:0:0:0:4")), + }, }, { ResourceName: resourceName, @@ -254,8 +265,15 @@ func TestAccRoute53HealthCheck_ipv6(t *testing.T) { ImportStateVerify: true, }, { - Config: testAccHealthCheckConfig_ip("1234:5678:9abc:6811:0:0:0:4"), - PlanOnly: true, + Config: testAccHealthCheckConfig_ip("1234:5678:9abc:6811:0:0:0:4"), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) From 166794791f5e962b3ddd52688ae7a3d288b80a10 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Mon, 30 Jun 2025 15:11:17 -0400 Subject: [PATCH 17/31] s3: Replace 'PlanOnly' acceptance test steps with 'plancheck's. --- internal/service/s3/bucket_policy.go | 14 +---- internal/service/s3/bucket_policy_test.go | 73 ++++++++++++++--------- internal/service/s3/bucket_test.go | 16 ++++- internal/service/s3/object_copy_test.go | 26 ++++++-- internal/service/s3/object_test.go | 34 +++++++++-- 5 files changed, 111 insertions(+), 52 deletions(-) diff --git a/internal/service/s3/bucket_policy.go b/internal/service/s3/bucket_policy.go index 76b720e721cf..f40451769601 100644 --- a/internal/service/s3/bucket_policy.go +++ b/internal/service/s3/bucket_policy.go @@ -14,9 +14,9 @@ import ( "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/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" @@ -40,17 +40,7 @@ func resourceBucketPolicy() *schema.Resource { Required: true, ForceNew: true, }, - 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 - }, - }, + names.AttrPolicy: sdkv2.IAMPolicyDocumentSchemaRequired(), }, } } diff --git a/internal/service/s3/bucket_policy_test.go b/internal/service/s3/bucket_policy_test.go index 13f7a7957893..73fd1a976704 100644 --- a/internal/service/s3/bucket_policy_test.go +++ b/internal/service/s3/bucket_policy_test.go @@ -11,6 +11,7 @@ import ( awspolicy "github.com/hashicorp/awspolicyequivalence" 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" @@ -234,18 +235,6 @@ func TestAccS3BucketPolicy_IAMRoleOrder_policyDoc(t *testing.T) { { Config: testAccBucketPolicyConfig_iamRoleOrderIAMDoc(rName), }, - { - Config: testAccBucketPolicyConfig_iamRoleOrderIAMDoc(rName), - PlanOnly: true, - }, - { - Config: testAccBucketPolicyConfig_iamRoleOrderIAMDoc(rName), - PlanOnly: true, - }, - { - Config: testAccBucketPolicyConfig_iamRoleOrderIAMDoc(rName), - PlanOnly: true, - }, }, }) } @@ -265,17 +254,6 @@ func TestAccS3BucketPolicy_IAMRoleOrder_policyDocNotPrincipal(t *testing.T) { { Config: testAccBucketPolicyConfig_iamRoleOrderIAMDocNotPrincipal(rName), }, - { - Config: testAccBucketPolicyConfig_iamRoleOrderIAMDocNotPrincipal(rName), - }, - { - Config: testAccBucketPolicyConfig_iamRoleOrderIAMDocNotPrincipal(rName), - PlanOnly: true, - }, - { - Config: testAccBucketPolicyConfig_iamRoleOrderIAMDocNotPrincipal(rName), - PlanOnly: true, - }, }, }) } @@ -286,6 +264,7 @@ func TestAccS3BucketPolicy_IAMRoleOrder_jsonEncode(t *testing.T) { rName1 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) rName2 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) rName3 := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + resourceName := "aws_s3_bucket_policy.bucket" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) }, @@ -295,24 +274,60 @@ func TestAccS3BucketPolicy_IAMRoleOrder_jsonEncode(t *testing.T) { Steps: []resource.TestStep{ { Config: testAccBucketPolicyConfig_iamRoleOrderJSONEncode(rName1), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), + }, + }, }, { - Config: testAccBucketPolicyConfig_iamRoleOrderJSONEncode(rName1), - PlanOnly: true, + Config: testAccBucketPolicyConfig_iamRoleOrderJSONEncode(rName1), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, { Config: testAccBucketPolicyConfig_iamRoleOrderJSONEncodeOrder2(rName2), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionReplace), + }, + }, }, { - Config: testAccBucketPolicyConfig_iamRoleOrderJSONEncode(rName2), - PlanOnly: true, + Config: testAccBucketPolicyConfig_iamRoleOrderJSONEncode(rName2), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, { Config: testAccBucketPolicyConfig_iamRoleOrderJSONEncodeOrder3(rName3), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionReplace), + }, + }, }, { - Config: testAccBucketPolicyConfig_iamRoleOrderJSONEncode(rName3), - PlanOnly: true, + Config: testAccBucketPolicyConfig_iamRoleOrderJSONEncode(rName3), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) diff --git a/internal/service/s3/bucket_test.go b/internal/service/s3/bucket_test.go index 1e200bdfc988..af8d05d95d15 100644 --- a/internal/service/s3/bucket_test.go +++ b/internal/service/s3/bucket_test.go @@ -1036,10 +1036,22 @@ func TestAccS3Bucket_Manage_objectLock_migrate(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "object_lock_configuration.#", "1"), resource.TestCheckResourceAttr(resourceName, "object_lock_configuration.0.object_lock_enabled", string(types.ObjectLockEnabledEnabled)), ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), + }, + }, }, { - Config: testAccBucketConfig_objectLockEnabledNoDefaultRetention(bucketName), - PlanOnly: true, + Config: testAccBucketConfig_objectLockEnabledNoDefaultRetention(bucketName), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) diff --git a/internal/service/s3/object_copy_test.go b/internal/service/s3/object_copy_test.go index a2635c0c2824..9b888c722444 100644 --- a/internal/service/s3/object_copy_test.go +++ b/internal/service/s3/object_copy_test.go @@ -14,7 +14,11 @@ import ( "github.com/hashicorp/aws-sdk-go-base/v2/endpoints" sdkacctest "github.com/hashicorp/terraform-plugin-testing/helper/acctest" "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/knownvalue" + "github.com/hashicorp/terraform-plugin-testing/plancheck" + "github.com/hashicorp/terraform-plugin-testing/statecheck" "github.com/hashicorp/terraform-plugin-testing/terraform" + "github.com/hashicorp/terraform-plugin-testing/tfjsonpath" "github.com/hashicorp/terraform-provider-aws/internal/acctest" "github.com/hashicorp/terraform-provider-aws/internal/conns" tfs3 "github.com/hashicorp/terraform-provider-aws/internal/service/s3" @@ -513,15 +517,27 @@ func TestAccS3ObjectCopy_targetWithMultipleSlashesMigrated(t *testing.T) { }, }, Config: testAccObjectCopyConfig_basic(rName1, names.AttrSource, rName2, targetKey), - Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr(resourceName, names.AttrKey, targetKey), - resource.TestCheckResourceAttr(resourceName, names.AttrSource, fmt.Sprintf("%s/%s", rName1, names.AttrSource)), - ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), + }, + }, + ConfigStateChecks: []statecheck.StateCheck{ + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrKey), knownvalue.StringExact(targetKey)), + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrSource), knownvalue.StringExact(fmt.Sprintf("%s/%s", rName1, names.AttrSource))), + }, }, { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, Config: testAccObjectCopyConfig_basic(rName1, names.AttrSource, rName2, targetKey), - PlanOnly: true, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) diff --git a/internal/service/s3/object_test.go b/internal/service/s3/object_test.go index 6b75d29f333a..ea0f23692c6c 100644 --- a/internal/service/s3/object_test.go +++ b/internal/service/s3/object_test.go @@ -249,11 +249,23 @@ func TestAccS3Object_upgradeFromV4(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( testAccCheckObjectExists(ctx, resourceName, &obj), ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), + }, + }, }, { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, Config: testAccObjectConfig_basic(rName), - PlanOnly: true, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -1657,14 +1669,28 @@ func TestAccS3Object_keyWithSlashesMigrated(t *testing.T) { Config: testAccObjectConfig_keyWithSlashes(rName), Check: resource.ComposeAggregateTestCheckFunc( testAccCheckObjectExists(ctx, resourceName, &obj), - resource.TestCheckResourceAttr(resourceName, names.AttrBucket, rName), - resource.TestCheckResourceAttr(resourceName, names.AttrKey, "/a/b//c///d/////e/"), ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), + }, + }, + ConfigStateChecks: []statecheck.StateCheck{ + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrBucket), knownvalue.StringExact(rName)), + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New(names.AttrKey), knownvalue.StringExact("/a/b//c///d/////e/")), + }, }, { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, Config: testAccObjectConfig_keyWithSlashes(rName), - PlanOnly: true, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) From d517d47b529363a0a7a5b9404de422ac46e2ed7c Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Mon, 30 Jun 2025 15:21:18 -0400 Subject: [PATCH 18/31] sagemaker: Replace 'PlanOnly' acceptance test steps with 'plancheck's. --- .../sagemaker/endpoint_configuration_test.go | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/internal/service/sagemaker/endpoint_configuration_test.go b/internal/service/sagemaker/endpoint_configuration_test.go index e214ad7d0ebe..50b6d1dbb26a 100644 --- a/internal/service/sagemaker/endpoint_configuration_test.go +++ b/internal/service/sagemaker/endpoint_configuration_test.go @@ -12,6 +12,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/knownvalue" + "github.com/hashicorp/terraform-plugin-testing/plancheck" "github.com/hashicorp/terraform-plugin-testing/statecheck" "github.com/hashicorp/terraform-plugin-testing/terraform" "github.com/hashicorp/terraform-plugin-testing/tfjsonpath" @@ -871,11 +872,23 @@ func TestAccSageMakerEndpointConfiguration_upgradeToEnableSSMAccess(t *testing.T resource.TestCheckResourceAttr(resourceName, "async_inference_config.#", "0"), resource.TestCheckResourceAttr(resourceName, "shadow_production_variants.#", "0"), ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), + }, + }, }, { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, Config: testAccEndpointConfigurationConfig_basic(rName), - PlanOnly: true, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) From 1baabfade08e0ec486a72f58d30c2227d4df04c0 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Mon, 30 Jun 2025 15:30:02 -0400 Subject: [PATCH 19/31] securityhub: Replace 'PlanOnly' acceptance test steps with 'plancheck's. --- internal/service/securityhub/account_test.go | 38 ++++++++++++++------ 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/internal/service/securityhub/account_test.go b/internal/service/securityhub/account_test.go index f9956e69ec55..7b4dd4051cf3 100644 --- a/internal/service/securityhub/account_test.go +++ b/internal/service/securityhub/account_test.go @@ -10,7 +10,11 @@ import ( "github.com/hashicorp/aws-sdk-go-base/v2/endpoints" "github.com/hashicorp/terraform-plugin-testing/helper/resource" + "github.com/hashicorp/terraform-plugin-testing/knownvalue" + "github.com/hashicorp/terraform-plugin-testing/plancheck" + "github.com/hashicorp/terraform-plugin-testing/statecheck" "github.com/hashicorp/terraform-plugin-testing/terraform" + "github.com/hashicorp/terraform-plugin-testing/tfjsonpath" "github.com/hashicorp/terraform-provider-aws/internal/acctest" "github.com/hashicorp/terraform-provider-aws/internal/conns" tfsecurityhub "github.com/hashicorp/terraform-provider-aws/internal/service/securityhub" @@ -163,11 +167,6 @@ func testAccAccount_migrateV0(t *testing.T) { func testAccAccount_removeControlFindingGeneratorDefaultValue(t *testing.T) { ctx := acctest.Context(t) resourceName := "aws_securityhub_account.test" - controlFindingGeneratorExpectedValue := "SECURITY_CONTROL" - if acctest.Partition() == endpoints.AwsUsGovPartitionID { - controlFindingGeneratorExpectedValue = "" - } - expectNonEmptyPlan := acctest.Partition() == endpoints.AwsUsGovPartitionID resource.Test(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) }, @@ -184,16 +183,35 @@ func testAccAccount_removeControlFindingGeneratorDefaultValue(t *testing.T) { Config: testAccAccountConfig_basic, Check: resource.ComposeTestCheckFunc( testAccCheckAccountExists(ctx, resourceName), - resource.TestCheckResourceAttr(resourceName, "enable_default_standards", acctest.CtTrue), - resource.TestCheckResourceAttr(resourceName, "control_finding_generator", controlFindingGeneratorExpectedValue), - resource.TestCheckResourceAttr(resourceName, "auto_enable_controls", acctest.CtTrue), ), - ExpectNonEmptyPlan: expectNonEmptyPlan, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), + }, + PostApplyPreRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, + ConfigStateChecks: []statecheck.StateCheck{ + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New("auto_enable_controls"), knownvalue.Bool(true)), + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New("control_finding_generator"), knownvalue.StringExact("SECURITY_CONTROL")), + statecheck.ExpectKnownValue(resourceName, tfjsonpath.New("enable_default_standards"), knownvalue.Bool(true)), + }, }, { ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, Config: testAccAccountConfig_basic, - PlanOnly: true, + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) From 6a42f451ee202b6103ae704a0b630d2d7d7d1cff Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Mon, 30 Jun 2025 15:53:26 -0400 Subject: [PATCH 20/31] ses: Replace 'PlanOnly' acceptance test steps with 'plancheck's. --- internal/service/ses/identity_policy.go | 13 ++----------- internal/service/ses/identity_policy_test.go | 17 +++++++++++++++-- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/internal/service/ses/identity_policy.go b/internal/service/ses/identity_policy.go index e45180a7d68f..ca70be2aa4cc 100644 --- a/internal/service/ses/identity_policy.go +++ b/internal/service/ses/identity_policy.go @@ -19,6 +19,7 @@ import ( "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" @@ -51,17 +52,7 @@ func resourceIdentityPolicy() *schema.Resource { validation.StringMatch(regexache.MustCompile(`^[0-9A-Za-z_-]+$`), "must contain only alphanumeric characters, dashes, and underscores"), ), }, - 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 - }, - }, + names.AttrPolicy: sdkv2.IAMPolicyDocumentSchemaRequired(), }, } } diff --git a/internal/service/ses/identity_policy_test.go b/internal/service/ses/identity_policy_test.go index ad023e24ee13..8c53f2cdae39 100644 --- a/internal/service/ses/identity_policy_test.go +++ b/internal/service/ses/identity_policy_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" @@ -120,10 +121,22 @@ func TestAccSESIdentityPolicy_ignoreEquivalent(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckIdentityPolicyExists(ctx, resourceName), ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), + }, + }, }, { - Config: testAccIdentityPolicyConfig_equivalent2(rName, domain), - PlanOnly: true, + Config: testAccIdentityPolicyConfig_equivalent2(rName, domain), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) From f17e4cc3e402e696a61e56564a063932236ed06d Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Mon, 30 Jun 2025 15:58:42 -0400 Subject: [PATCH 21/31] sns: Replace 'PlanOnly' acceptance test steps with 'plancheck's. --- internal/service/sns/topic_policy.go | 16 +++------------- internal/service/sns/topic_policy_test.go | 17 +++++++++++++++-- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/internal/service/sns/topic_policy.go b/internal/service/sns/topic_policy.go index a7f1e815bae6..ff8a4823ec6f 100644 --- a/internal/service/sns/topic_policy.go +++ b/internal/service/sns/topic_policy.go @@ -13,10 +13,10 @@ 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" "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" @@ -45,17 +45,7 @@ func resourceTopicPolicy() *schema.Resource { Type: schema.TypeString, Computed: true, }, - 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 - }, - }, + names.AttrPolicy: sdkv2.IAMPolicyDocumentSchemaRequired(), }, } } @@ -66,7 +56,7 @@ func resourceTopicPolicyUpsert(ctx context.Context, d *schema.ResourceData, meta policy, err := structure.NormalizeJsonString(d.Get(names.AttrPolicy).(string)) if err != nil { - return sdkdiag.AppendErrorf(diags, "policy (%s) is invalid JSON: %s", d.Get(names.AttrPolicy).(string), err) + return sdkdiag.AppendFromErr(diags, err) } arn := d.Get(names.AttrARN).(string) diff --git a/internal/service/sns/topic_policy_test.go b/internal/service/sns/topic_policy_test.go index 4b092986da2f..de3a743c18cd 100644 --- a/internal/service/sns/topic_policy_test.go +++ b/internal/service/sns/topic_policy_test.go @@ -11,6 +11,7 @@ import ( "github.com/YakDriver/regexache" 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" @@ -153,10 +154,22 @@ func TestAccSNSTopicPolicy_ignoreEquivalent(t *testing.T) { resource.TestMatchResourceAttr(resourceName, names.AttrPolicy, regexache.MustCompile(fmt.Sprintf("\"Sid\":\"%[1]s\"", rName))), acctest.CheckResourceAttrAccountID(ctx, resourceName, names.AttrOwner), ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), + }, + }, }, { - Config: testAccTopicPolicyConfig_equivalent2(rName), - PlanOnly: true, + Config: testAccTopicPolicyConfig_equivalent2(rName), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) From 21eef8fff75380ae1206b5b6ce6d1809486e862a Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Mon, 30 Jun 2025 16:08:47 -0400 Subject: [PATCH 22/31] sqs: Replace 'PlanOnly' acceptance test steps with 'plancheck's. --- internal/service/sqs/queue_policy.go | 15 ++------------ internal/service/sqs/queue_policy_test.go | 20 ++++++++++++++----- .../service/sqs/queue_redrive_allow_policy.go | 14 ++----------- .../sqs/queue_redrive_allow_policy_test.go | 20 ++++++++++++++----- internal/service/sqs/queue_redrive_policy.go | 13 ++---------- .../service/sqs/queue_redrive_policy_test.go | 20 ++++++++++++++----- internal/service/sqs/queue_test.go | 17 ++++++++++++++-- 7 files changed, 66 insertions(+), 53 deletions(-) diff --git a/internal/service/sqs/queue_policy.go b/internal/service/sqs/queue_policy.go index 3b13973ce7ba..3031510863d1 100644 --- a/internal/service/sqs/queue_policy.go +++ b/internal/service/sqs/queue_policy.go @@ -6,8 +6,7 @@ package sqs import ( "github.com/aws/aws-sdk-go-v2/service/sqs/types" "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/sdkv2" "github.com/hashicorp/terraform-provider-aws/internal/verify" "github.com/hashicorp/terraform-provider-aws/names" ) @@ -35,17 +34,7 @@ func resourceQueuePolicy() *schema.Resource { SchemaVersion: 1, 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 - }, - }, + names.AttrPolicy: sdkv2.IAMPolicyDocumentSchemaRequired(), "queue_url": { Type: schema.TypeString, Required: true, diff --git a/internal/service/sqs/queue_policy_test.go b/internal/service/sqs/queue_policy_test.go index aed1dd2c758b..dc685ec9e9f5 100644 --- a/internal/service/sqs/queue_policy_test.go +++ b/internal/service/sqs/queue_policy_test.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/service/sqs/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-provider-aws/internal/acctest" tfsqs "github.com/hashicorp/terraform-provider-aws/internal/service/sqs" "github.com/hashicorp/terraform-provider-aws/names" @@ -34,6 +35,11 @@ func TestAccSQSQueuePolicy_basic(t *testing.T) { testAccCheckQueueExists(ctx, queueResourceName, &queueAttributes), resource.TestCheckResourceAttrSet(resourceName, names.AttrPolicy), ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), + }, + }, }, { ResourceName: resourceName, @@ -41,11 +47,15 @@ func TestAccSQSQueuePolicy_basic(t *testing.T) { ImportStateVerify: true, }, { - Config: testAccQueuePolicyConfig_basic(rName), - PlanOnly: true, - Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttrPair(resourceName, names.AttrPolicy, queueResourceName, names.AttrPolicy), - ), + Config: testAccQueuePolicyConfig_basic(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/sqs/queue_redrive_allow_policy.go b/internal/service/sqs/queue_redrive_allow_policy.go index 5b36a9dbc50e..6ae5ae30cbd0 100644 --- a/internal/service/sqs/queue_redrive_allow_policy.go +++ b/internal/service/sqs/queue_redrive_allow_policy.go @@ -6,8 +6,7 @@ package sqs import ( "github.com/aws/aws-sdk-go-v2/service/sqs/types" "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/sdkv2" "github.com/hashicorp/terraform-provider-aws/internal/verify" ) @@ -31,16 +30,7 @@ func resourceQueueRedriveAllowPolicy() *schema.Resource { Required: true, ForceNew: true, }, - "redrive_allow_policy": { - Type: schema.TypeString, - Required: true, - ValidateFunc: validation.StringIsJSON, - DiffSuppressFunc: verify.SuppressEquivalentJSONDiffs, - StateFunc: func(v any) string { - json, _ := structure.NormalizeJsonString(v) - return json - }, - }, + "redrive_allow_policy": sdkv2.JSONDocumentSchemaRequired(), }, Importer: &schema.ResourceImporter{ diff --git a/internal/service/sqs/queue_redrive_allow_policy_test.go b/internal/service/sqs/queue_redrive_allow_policy_test.go index c0250b974ed1..22fab997a567 100644 --- a/internal/service/sqs/queue_redrive_allow_policy_test.go +++ b/internal/service/sqs/queue_redrive_allow_policy_test.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/service/sqs/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-provider-aws/internal/acctest" tfsqs "github.com/hashicorp/terraform-provider-aws/internal/service/sqs" "github.com/hashicorp/terraform-provider-aws/names" @@ -34,6 +35,11 @@ func TestAccSQSQueueRedriveAllowPolicy_basic(t *testing.T) { testAccCheckQueueExists(ctx, queueResourceName, &queueAttributes), resource.TestCheckResourceAttrSet(resourceName, "redrive_allow_policy"), ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), + }, + }, }, { ResourceName: resourceName, @@ -41,11 +47,15 @@ func TestAccSQSQueueRedriveAllowPolicy_basic(t *testing.T) { ImportStateVerify: true, }, { - Config: testAccQueueRedriveAllowPolicyConfig_basic(rName), - PlanOnly: true, - Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttrPair(resourceName, "redrive_allow_policy", queueResourceName, "redrive_allow_policy"), - ), + Config: testAccQueueRedriveAllowPolicyConfig_basic(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/sqs/queue_redrive_policy.go b/internal/service/sqs/queue_redrive_policy.go index 38736d71b1e8..315564fd905d 100644 --- a/internal/service/sqs/queue_redrive_policy.go +++ b/internal/service/sqs/queue_redrive_policy.go @@ -6,8 +6,7 @@ package sqs import ( "github.com/aws/aws-sdk-go-v2/service/sqs/types" "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/sdkv2" "github.com/hashicorp/terraform-provider-aws/internal/verify" ) @@ -31,15 +30,7 @@ func resourceQueueRedrivePolicy() *schema.Resource { Required: true, ForceNew: true, }, - "redrive_policy": { - Type: schema.TypeString, - Required: true, - ValidateFunc: validation.StringIsJSON, - StateFunc: func(v any) string { - json, _ := structure.NormalizeJsonString(v) - return json - }, - }, + "redrive_policy": sdkv2.JSONDocumentSchemaRequired(), }, Importer: &schema.ResourceImporter{ diff --git a/internal/service/sqs/queue_redrive_policy_test.go b/internal/service/sqs/queue_redrive_policy_test.go index ef47ab9ca48c..7b737f293330 100644 --- a/internal/service/sqs/queue_redrive_policy_test.go +++ b/internal/service/sqs/queue_redrive_policy_test.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go-v2/service/sqs/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-provider-aws/internal/acctest" tfsqs "github.com/hashicorp/terraform-provider-aws/internal/service/sqs" "github.com/hashicorp/terraform-provider-aws/names" @@ -35,6 +36,11 @@ func TestAccSQSQueueRedrivePolicy_basic(t *testing.T) { testAccCheckQueueExists(ctx, fmt.Sprintf("%s_ddl", queueResourceName), &queueAttributes), resource.TestCheckResourceAttrSet(resourceName, "redrive_policy"), ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), + }, + }, }, { ResourceName: resourceName, @@ -42,11 +48,15 @@ func TestAccSQSQueueRedrivePolicy_basic(t *testing.T) { ImportStateVerify: true, }, { - Config: testAccQueueRedrivePolicyConfig_basic(rName), - PlanOnly: true, - Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttrPair(resourceName, "redrive_policy", queueResourceName, "redrive_policy"), - ), + Config: testAccQueueRedrivePolicyConfig_basic(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/sqs/queue_test.go b/internal/service/sqs/queue_test.go index b2f27f3f818d..c99e0f675363 100644 --- a/internal/service/sqs/queue_test.go +++ b/internal/service/sqs/queue_test.go @@ -16,6 +16,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/knownvalue" + "github.com/hashicorp/terraform-plugin-testing/plancheck" "github.com/hashicorp/terraform-plugin-testing/statecheck" "github.com/hashicorp/terraform-plugin-testing/terraform" "github.com/hashicorp/terraform-plugin-testing/tfjsonpath" @@ -440,10 +441,22 @@ func TestAccSQSQueue_Policy_ignoreEquivalent(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "receive_wait_time_seconds", "10"), resource.TestCheckResourceAttr(resourceName, "visibility_timeout_seconds", "60"), ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), + }, + }, }, { - Config: testAccQueueConfig_policyNewEquivalent(rName), - PlanOnly: true, + Config: testAccQueueConfig_policyNewEquivalent(rName), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) From d3e54f6ca56b1972a8c2f38c610d6f4338944be8 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Mon, 30 Jun 2025 16:34:43 -0400 Subject: [PATCH 23/31] ssm: Replace 'PlanOnly' acceptance test steps with 'plancheck's. --- internal/service/ssm/parameter_test.go | 46 ++++++++++++++++++++++---- 1 file changed, 40 insertions(+), 6 deletions(-) diff --git a/internal/service/ssm/parameter_test.go b/internal/service/ssm/parameter_test.go index 786d18571c1f..24e2009dc8a2 100644 --- a/internal/service/ssm/parameter_test.go +++ b/internal/service/ssm/parameter_test.go @@ -16,6 +16,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/knownvalue" + "github.com/hashicorp/terraform-plugin-testing/plancheck" "github.com/hashicorp/terraform-plugin-testing/statecheck" "github.com/hashicorp/terraform-plugin-testing/terraform" "github.com/hashicorp/terraform-plugin-testing/tfjsonpath" @@ -528,6 +529,7 @@ func TestAccSSMParameter_Overwrite_basic(t *testing.T) { func TestAccSSMParameter_Overwrite_cascade(t *testing.T) { ctx := acctest.Context(t) name := fmt.Sprintf("%s_%s", t.Name(), sdkacctest.RandString(10)) + resourceName := "aws_ssm_parameter.test_upstream" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t) }, @@ -537,14 +539,30 @@ func TestAccSSMParameter_Overwrite_cascade(t *testing.T) { Steps: []resource.TestStep{ { Config: testAccParameterConfig_cascadeOverwrite(name, "test1"), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), + }, + }, }, { Config: testAccParameterConfig_cascadeOverwrite(name, "test2"), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), + }, + }, }, { - Config: testAccParameterConfig_cascadeOverwrite(name, "test2"), - PlanOnly: true, - ExpectNonEmptyPlan: false, + Config: testAccParameterConfig_cascadeOverwrite(name, "test2"), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -879,6 +897,11 @@ func TestAccSSMParameter_Secure_insecure(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "insecure_value", "notsecret"), resource.TestCheckResourceAttr(resourceName, names.AttrType, "String"), ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), + }, + }, }, { Config: testAccParameterConfig_insecure(rName, "String", "newvalue"), @@ -887,11 +910,22 @@ func TestAccSSMParameter_Secure_insecure(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "insecure_value", "newvalue"), resource.TestCheckResourceAttr(resourceName, names.AttrType, "String"), ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), + }, + }, }, { - Config: testAccParameterConfig_insecure(rName, "String", "diff"), - PlanOnly: true, - ExpectNonEmptyPlan: true, + Config: testAccParameterConfig_insecure(rName, "String", "diff"), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionUpdate), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, { Config: testAccParameterConfig_insecure(rName, "SecureString", "notsecret"), From 79b6f7931b8be5f9da3fc4aeafc5eb646abd4553 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Mon, 30 Jun 2025 17:19:54 -0400 Subject: [PATCH 24/31] transfer: Replace 'PlanOnly' acceptance test steps with 'plancheck's. --- internal/service/transfer/user.go | 13 ++----------- internal/service/transfer/user_test.go | 20 ++++++++++++++------ 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/internal/service/transfer/user.go b/internal/service/transfer/user.go index a72b43e57abe..57c32b61d8b5 100644 --- a/internal/service/transfer/user.go +++ b/internal/service/transfer/user.go @@ -23,6 +23,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" @@ -80,17 +81,7 @@ func resourceUser() *schema.Resource { Default: awstypes.HomeDirectoryTypePath, ValidateDiagFunc: enum.Validate[awstypes.HomeDirectoryType](), }, - names.AttrPolicy: { - Type: schema.TypeString, - Optional: true, - ValidateFunc: verify.ValidIAMPolicyJSON, - DiffSuppressFunc: verify.SuppressEquivalentPolicyDiffs, - DiffSuppressOnRefresh: true, - StateFunc: func(v any) string { - json, _ := structure.NormalizeJsonString(v) - return json - }, - }, + names.AttrPolicy: sdkv2.IAMPolicyDocumentSchemaOptional(), "posix_profile": { Type: schema.TypeList, MaxItems: 1, diff --git a/internal/service/transfer/user_test.go b/internal/service/transfer/user_test.go index a83549244717..084930e01ff0 100644 --- a/internal/service/transfer/user_test.go +++ b/internal/service/transfer/user_test.go @@ -12,6 +12,7 @@ import ( awstypes "github.com/aws/aws-sdk-go-v2/service/transfer/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" @@ -206,6 +207,7 @@ func testAccUser_modifyWithOptions(t *testing.T) { func testAccUser_UserName_Validation(t *testing.T) { ctx := acctest.Context(t) rName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + resourceName := "aws_transfer_user.test" resource.Test(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(ctx, t); testAccPreCheck(ctx, t) }, @@ -222,9 +224,12 @@ func testAccUser_UserName_Validation(t *testing.T) { ExpectError: regexache.MustCompile(`Invalid "user_name": `), }, { - Config: testAccUserConfig_nameValidation(rName, sdkacctest.RandString(33)), - ExpectNonEmptyPlan: true, - PlanOnly: true, + Config: testAccUserConfig_nameValidation(rName, sdkacctest.RandString(33)), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), + }, + }, }, { Config: testAccUserConfig_nameValidation(rName, sdkacctest.RandString(101)), @@ -235,9 +240,12 @@ func testAccUser_UserName_Validation(t *testing.T) { ExpectError: regexache.MustCompile(`Invalid "user_name": `), }, { - Config: testAccUserConfig_nameValidation(rName, "valid_username"), - ExpectNonEmptyPlan: true, - PlanOnly: true, + Config: testAccUserConfig_nameValidation(rName, "valid_username"), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionReplace), + }, + }, }, }, }) From a79eb731454abb5fbfce62c1a712cde07474c659 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Tue, 1 Jul 2025 09:46:21 -0400 Subject: [PATCH 25/31] vpclattice: Replace 'PlanOnly' acceptance test steps with 'plancheck's. --- .../service/vpclattice/listener_rule_test.go | 33 ++++++++++++++++--- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/internal/service/vpclattice/listener_rule_test.go b/internal/service/vpclattice/listener_rule_test.go index 11172d14bfe5..21ed2b02960d 100644 --- a/internal/service/vpclattice/listener_rule_test.go +++ b/internal/service/vpclattice/listener_rule_test.go @@ -12,6 +12,7 @@ import ( "github.com/aws/aws-sdk-go-v2/service/vpclattice" 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" @@ -57,6 +58,11 @@ func TestAccVPCLatticeListenerRule_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, names.AttrPriority, "20"), resource.TestCheckResourceAttrPair(resourceName, "service_identifier", "aws_vpclattice_service.test", names.AttrID), ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), + }, + }, }, { ResourceName: resourceName, @@ -64,8 +70,15 @@ func TestAccVPCLatticeListenerRule_basic(t *testing.T) { ImportStateVerify: true, }, { - Config: testAccListenerRuleConfig_ARNs(rName), - PlanOnly: true, + Config: testAccListenerRuleConfig_ARNs(rName), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) @@ -122,6 +135,11 @@ func TestAccVPCLatticeListenerRule_ARNs(t *testing.T) { resource.TestCheckResourceAttrPair(resourceName, "listener_identifier", "aws_vpclattice_listener.test", names.AttrARN), resource.TestCheckResourceAttrPair(resourceName, "service_identifier", "aws_vpclattice_service.test", names.AttrARN), ), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionCreate), + }, + }, }, { ResourceName: resourceName, @@ -137,8 +155,15 @@ func TestAccVPCLatticeListenerRule_ARNs(t *testing.T) { }, }, { - Config: testAccListenerRuleConfig_basic(rName), - PlanOnly: true, + Config: testAccListenerRuleConfig_basic(rName), + ConfigPlanChecks: resource.ConfigPlanChecks{ + PreApply: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + PostApplyPostRefresh: []plancheck.PlanCheck{ + plancheck.ExpectResourceAction(resourceName, plancheck.ResourceActionNoop), + }, + }, }, }, }) From f1eec2346be53260697c0dae1b0f3ccc5e69ce8f Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Tue, 1 Jul 2025 09:51:13 -0400 Subject: [PATCH 26/31] wafv2: Replace 'PlanOnly' acceptance test steps with 'plancheck's. --- internal/service/wafv2/web_acl_test.go | 8 -------- 1 file changed, 8 deletions(-) diff --git a/internal/service/wafv2/web_acl_test.go b/internal/service/wafv2/web_acl_test.go index f8643d310df4..7eaf3e23dcaf 100644 --- a/internal/service/wafv2/web_acl_test.go +++ b/internal/service/wafv2/web_acl_test.go @@ -2745,10 +2745,6 @@ func TestAccWAFV2WebACL_RuleGroupReference_manageShieldMitigationRule(t *testing resource.TestCheckResourceAttr(resourceName, acctest.CtRulePound, "1"), ), }, - { - Config: testAccWebACLConfig_ruleGroupShieldMitigation(webACLName, "desc1"), - PlanOnly: true, - }, { Config: testAccWebACLConfig_ruleGroupShieldMitigation(webACLName, "desc2"), Check: resource.ComposeTestCheckFunc( @@ -2757,10 +2753,6 @@ func TestAccWAFV2WebACL_RuleGroupReference_manageShieldMitigationRule(t *testing resource.TestCheckResourceAttr(resourceName, acctest.CtRulePound, "1"), ), }, - { - Config: testAccWebACLConfig_ruleGroupShieldMitigation(webACLName, "desc2"), - PlanOnly: true, - }, }, }) } From f70e4a8c0ab2007a92da75e195d9b91e72a2dc3b Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Tue, 1 Jul 2025 10:15:07 -0400 Subject: [PATCH 27/31] Add semgrep rule 'replace-planonly-checks'. --- .ci/semgrep/acctest/checks/planonly.yml | 15 +++++++++++++++ internal/service/mq/broker_test.go | 5 +++-- 2 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 .ci/semgrep/acctest/checks/planonly.yml diff --git a/.ci/semgrep/acctest/checks/planonly.yml b/.ci/semgrep/acctest/checks/planonly.yml new file mode 100644 index 000000000000..41db49403c03 --- /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/**/*_test.go" + patterns: + - pattern: | + { + ..., + PlanOnly: true, + ... + } + severity: ERROR diff --git a/internal/service/mq/broker_test.go b/internal/service/mq/broker_test.go index 0a3b6c9b0e3f..db21d3168e5c 100644 --- a/internal/service/mq/broker_test.go +++ b/internal/service/mq/broker_test.go @@ -1629,10 +1629,11 @@ func TestAccMQBroker_dataReplicationMode(t *testing.T) { ImportStateVerify: true, ImportStateVerifyIgnore: []string{names.AttrApplyImmediately, "user", "data_replication_primary_broker_arn"}, }, + // nosemgrep:ci.semgrep.acctest.checks.replace-planonly-checks { // Preparation for destruction would require multiple configuration changes // and applies to unpair brokers. Instead, complete the necessary update, reboot, - // and delete opreations on the primary cluster out-of-band to ensure remaining + // and delete operations on the primary cluster out-of-band to ensure remaining // resources will be freed for clean up. PreConfig: func() { // In order to delete, replicated brokers must first be unpaired by setting @@ -1644,7 +1645,7 @@ func TestAccMQBroker_dataReplicationMode(t *testing.T) { testAccDeleteBrokerWithProvider(ctx, t, &brokerAlternate, acctest.RegionProviderFunc(ctx, acctest.AlternateRegion(), &providers)) }, Config: testAccBrokerConfig_dataReplicationMode(rName, testAccBrokerVersionNewer, string(types.DataReplicationModeNone)), - PlanOnly: true, // OK + PlanOnly: true, ExpectNonEmptyPlan: true, }, }, From d76e561318f15ffa1b2a6511faf8565b7a1b15ae Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Tue, 1 Jul 2025 11:50:37 -0400 Subject: [PATCH 28/31] generate/tagstests: Replace 'PlanOnly' with 'plancheck's. --- .../generate/tagstests/resource_test.go.gtpl | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) 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 }} }, From b593cf8fc1d49896b32cef1283830919c965dfaa Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Tue, 1 Jul 2025 11:51:25 -0400 Subject: [PATCH 29/31] Run 'make gen'. --- .../accessanalyzer/analyzer_tags_gen_test.go | 20 +++++++++++++++---- .../service/acm/certificate_tags_gen_test.go | 20 +++++++++++++++---- .../certificate_authority_tags_gen_test.go | 20 +++++++++++++++---- .../amp/rule_group_namespace_tags_gen_test.go | 20 +++++++++++++++---- .../service/amp/workspace_tags_gen_test.go | 20 +++++++++++++++---- internal/service/amplify/app_tags_gen_test.go | 20 +++++++++++++++---- .../service/amplify/branch_tags_gen_test.go | 20 +++++++++++++++---- .../apigateway/api_key_tags_gen_test.go | 20 +++++++++++++++---- .../client_certificate_tags_gen_test.go | 20 +++++++++++++++---- .../apigateway/domain_name_tags_gen_test.go | 20 +++++++++++++++---- .../apigateway/rest_api_tags_gen_test.go | 20 +++++++++++++++---- .../service/apigateway/stage_tags_gen_test.go | 20 +++++++++++++++---- .../apigateway/usage_plan_tags_gen_test.go | 20 +++++++++++++++---- .../apigateway/vpc_link_tags_gen_test.go | 20 +++++++++++++++---- .../service/apigatewayv2/api_tags_gen_test.go | 20 +++++++++++++++---- .../apigatewayv2/domain_name_tags_gen_test.go | 20 +++++++++++++++---- .../apigatewayv2/stage_tags_gen_test.go | 20 +++++++++++++++---- .../apigatewayv2/vpc_link_tags_gen_test.go | 20 +++++++++++++++---- .../appautoscaling/target_tags_gen_test.go | 20 +++++++++++++++---- .../appconfig/application_tags_gen_test.go | 20 +++++++++++++++---- .../configuration_profile_tags_gen_test.go | 20 +++++++++++++++---- .../deployment_strategy_tags_gen_test.go | 20 +++++++++++++++---- .../appconfig/deployment_tags_gen_test.go | 20 +++++++++++++++---- .../appconfig/extension_tags_gen_test.go | 20 +++++++++++++++---- .../service/appflow/flow_tags_gen_test.go | 20 +++++++++++++++---- .../event_integration_tags_gen_test.go | 20 +++++++++++++++---- .../application_tags_gen_test.go | 20 +++++++++++++++---- .../appmesh/gateway_route_tags_gen_test.go | 20 +++++++++++++++---- .../service/appmesh/mesh_tags_gen_test.go | 20 +++++++++++++++---- .../service/appmesh/route_tags_gen_test.go | 20 +++++++++++++++---- .../appmesh/virtual_gateway_tags_gen_test.go | 20 +++++++++++++++---- .../appmesh/virtual_node_tags_gen_test.go | 20 +++++++++++++++---- .../appmesh/virtual_router_tags_gen_test.go | 20 +++++++++++++++---- .../appmesh/virtual_service_tags_gen_test.go | 20 +++++++++++++++---- ...ing_configuration_version_tags_gen_test.go | 20 +++++++++++++++---- .../apprunner/connection_tags_gen_test.go | 20 +++++++++++++++---- ...servability_configuration_tags_gen_test.go | 20 +++++++++++++++---- .../apprunner/service_tags_gen_test.go | 20 +++++++++++++++---- .../apprunner/vpc_connector_tags_gen_test.go | 20 +++++++++++++++---- .../vpc_ingress_connection_tags_gen_test.go | 20 +++++++++++++++---- .../service/backup/framework_tags_gen_test.go | 20 +++++++++++++++---- internal/service/backup/plan_tags_gen_test.go | 20 +++++++++++++++---- .../backup/report_plan_tags_gen_test.go | 20 +++++++++++++++---- .../service/backup/vault_tags_gen_test.go | 20 +++++++++++++++---- .../compute_environment_tags_gen_test.go | 20 +++++++++++++++---- .../batch/job_definition_tags_gen_test.go | 20 +++++++++++++++---- .../batch/scheduling_policy_tags_gen_test.go | 20 +++++++++++++++---- .../service/budgets/budget_tags_gen_test.go | 20 +++++++++++++++---- .../composite_alarm_tags_gen_test.go | 20 +++++++++++++++---- .../cloudwatch/metric_alarm_tags_gen_test.go | 20 +++++++++++++++---- .../cloudwatch/metric_stream_tags_gen_test.go | 20 +++++++++++++++---- .../cognitoidp/user_pool_tags_gen_test.go | 20 +++++++++++++++---- .../datapipeline/pipeline_tags_gen_test.go | 20 +++++++++++++++---- .../service/dms/certificate_tags_gen_test.go | 20 +++++++++++++++---- .../service/dms/endpoint_tags_gen_test.go | 20 +++++++++++++++---- .../dms/event_subscription_tags_gen_test.go | 20 +++++++++++++++---- .../dms/replication_config_tags_gen_test.go | 20 +++++++++++++++---- .../dms/replication_instance_tags_gen_test.go | 20 +++++++++++++++---- .../replication_subnet_group_tags_gen_test.go | 20 +++++++++++++++---- .../dms/replication_task_tags_gen_test.go | 20 +++++++++++++++---- .../service/dms/s3_endpoint_tags_gen_test.go | 20 +++++++++++++++---- .../dynamodb/table_replica_tags_gen_test.go | 20 +++++++++++++++---- .../service/dynamodb/table_tags_gen_test.go | 20 +++++++++++++++---- .../service/ec2/ec2_instance_tags_gen_test.go | 20 +++++++++++++++---- .../ec2/vpc_route_table_tags_gen_test.go | 20 +++++++++++++++---- .../ec2/vpc_security_group_tags_gen_test.go | 20 +++++++++++++++---- .../service/ec2/vpc_subnet_tags_gen_test.go | 20 +++++++++++++++---- internal/service/ec2/vpc_tags_gen_test.go | 20 +++++++++++++++---- .../elbv2/listener_rule_tags_gen_test.go | 20 +++++++++++++++---- .../service/elbv2/listener_tags_gen_test.go | 20 +++++++++++++++---- .../elbv2/load_balancer_tags_gen_test.go | 20 +++++++++++++++---- .../elbv2/target_group_tags_gen_test.go | 20 +++++++++++++++---- .../elbv2/trust_store_tags_gen_test.go | 20 +++++++++++++++---- internal/service/fms/policy_tags_gen_test.go | 20 +++++++++++++++---- .../guardduty/detector_tags_gen_test.go | 20 +++++++++++++++---- .../service/guardduty/filter_tags_gen_test.go | 20 +++++++++++++++---- .../service/guardduty/ipset_tags_gen_test.go | 20 +++++++++++++++---- .../guardduty/threatintelset_tags_gen_test.go | 20 +++++++++++++++---- .../iam/instance_profile_tags_gen_test.go | 20 +++++++++++++++---- .../openid_connect_provider_tags_gen_test.go | 20 +++++++++++++++---- internal/service/iam/policy_tags_gen_test.go | 20 +++++++++++++++---- internal/service/iam/role_tags_gen_test.go | 20 +++++++++++++++---- .../iam/server_certificate_tags_gen_test.go | 20 +++++++++++++++---- .../iam/service_linked_role_tags_gen_test.go | 20 +++++++++++++++---- internal/service/iam/user_tags_gen_test.go | 20 +++++++++++++++---- .../iam/virtual_mfa_device_tags_gen_test.go | 20 +++++++++++++++---- .../service/kms/external_key_tags_gen_test.go | 20 +++++++++++++++---- internal/service/kms/key_tags_gen_test.go | 20 +++++++++++++++---- .../kms/replica_external_key_tags_gen_test.go | 20 +++++++++++++++---- .../service/kms/replica_key_tags_gen_test.go | 20 +++++++++++++++---- .../service/lambda/function_tags_gen_test.go | 20 +++++++++++++++---- .../service/logs/destination_tags_gen_test.go | 20 +++++++++++++++---- internal/service/logs/group_tags_gen_test.go | 20 +++++++++++++++---- .../medialive/channel_tags_gen_test.go | 20 +++++++++++++++---- .../input_security_group_tags_gen_test.go | 20 +++++++++++++++---- .../service/medialive/input_tags_gen_test.go | 20 +++++++++++++++---- .../medialive/multiplex_tags_gen_test.go | 20 +++++++++++++++---- .../quicksight/analysis_tags_gen_test.go | 20 +++++++++++++++---- .../quicksight/dashboard_tags_gen_test.go | 20 +++++++++++++++---- .../quicksight/data_set_tags_gen_test.go | 20 +++++++++++++++---- .../quicksight/data_source_tags_gen_test.go | 20 +++++++++++++++---- .../quicksight/folder_tags_gen_test.go | 20 +++++++++++++++---- .../quicksight/template_tags_gen_test.go | 20 +++++++++++++++---- .../service/quicksight/theme_tags_gen_test.go | 20 +++++++++++++++---- .../rds/global_cluster_tags_gen_test.go | 20 +++++++++++++++---- .../service/rds/instance_tags_gen_test.go | 20 +++++++++++++++---- .../service/s3/bucket_object_tags_gen_test.go | 20 +++++++++++++++---- internal/service/s3/bucket_tags_gen_test.go | 20 +++++++++++++++---- .../service/s3/object_copy_tags_gen_test.go | 20 +++++++++++++++---- internal/service/s3/object_tags_gen_test.go | 20 +++++++++++++++---- .../secretsmanager/secret_tags_gen_test.go | 20 +++++++++++++++---- .../servicecatalog/portfolio_tags_gen_test.go | 20 +++++++++++++++---- .../servicecatalog/product_tags_gen_test.go | 20 +++++++++++++++---- .../provisioned_product_tags_gen_test.go | 20 +++++++++++++++---- .../sesv2/configuration_set_tags_gen_test.go | 20 +++++++++++++++---- .../sesv2/contact_list_tags_gen_test.go | 20 +++++++++++++++---- .../sesv2/dedicated_ip_pool_tags_gen_test.go | 20 +++++++++++++++---- .../sesv2/email_identity_tags_gen_test.go | 20 +++++++++++++++---- internal/service/sns/topic_tags_gen_test.go | 20 +++++++++++++++---- internal/service/sqs/queue_tags_gen_test.go | 20 +++++++++++++++---- .../service/ssm/activation_tags_gen_test.go | 20 +++++++++++++++---- .../service/ssm/association_tags_gen_test.go | 20 +++++++++++++++---- .../service/ssm/document_tags_gen_test.go | 20 +++++++++++++++---- .../ssm/maintenance_window_tags_gen_test.go | 20 +++++++++++++++---- .../service/ssm/parameter_tags_gen_test.go | 20 +++++++++++++++---- .../ssm/patch_baseline_tags_gen_test.go | 20 +++++++++++++++---- .../ssmcontacts/contact_tags_gen_test.go | 20 +++++++++++++++---- internal/service/xray/group_tags_gen_test.go | 20 +++++++++++++++---- .../xray/sampling_rule_tags_gen_test.go | 20 +++++++++++++++---- 129 files changed, 2064 insertions(+), 516 deletions(-) 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_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/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/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/role_tags_gen_test.go b/internal/service/iam/role_tags_gen_test.go index 06c8fddfa075..67bb4e4836b7 100644 --- a/internal/service/iam/role_tags_gen_test.go +++ b/internal/service/iam/role_tags_gen_test.go @@ -253,8 +253,14 @@ func TestAccIAMRole_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 TestAccIAMRole_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/server_certificate_tags_gen_test.go b/internal/service/iam/server_certificate_tags_gen_test.go index fd78191180b0..1088748cf586 100644 --- a/internal/service/iam/server_certificate_tags_gen_test.go +++ b/internal/service/iam/server_certificate_tags_gen_test.go @@ -299,8 +299,14 @@ func TestAccIAMServerCertificate_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), + }, + }, }, }, }) @@ -368,8 +374,14 @@ func TestAccIAMServerCertificate_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/iam/service_linked_role_tags_gen_test.go b/internal/service/iam/service_linked_role_tags_gen_test.go index f7955930ffde..92f8067116be 100644 --- a/internal/service/iam/service_linked_role_tags_gen_test.go +++ b/internal/service/iam/service_linked_role_tags_gen_test.go @@ -250,8 +250,14 @@ func TestAccIAMServiceLinkedRole_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 TestAccIAMServiceLinkedRole_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/user_tags_gen_test.go b/internal/service/iam/user_tags_gen_test.go index 42387f433930..6257272804c3 100644 --- a/internal/service/iam/user_tags_gen_test.go +++ b/internal/service/iam/user_tags_gen_test.go @@ -268,8 +268,14 @@ func TestAccIAMUser_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 TestAccIAMUser_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/virtual_mfa_device_tags_gen_test.go b/internal/service/iam/virtual_mfa_device_tags_gen_test.go index 25355ac25e6c..c4a10b9887db 100644 --- a/internal/service/iam/virtual_mfa_device_tags_gen_test.go +++ b/internal/service/iam/virtual_mfa_device_tags_gen_test.go @@ -268,8 +268,14 @@ func TestAccIAMVirtualMFADevice_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 TestAccIAMVirtualMFADevice_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/kms/external_key_tags_gen_test.go b/internal/service/kms/external_key_tags_gen_test.go index d2349280e9e2..b88cb628adff 100644 --- a/internal/service/kms/external_key_tags_gen_test.go +++ b/internal/service/kms/external_key_tags_gen_test.go @@ -268,8 +268,14 @@ func TestAccKMSExternalKey_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 TestAccKMSExternalKey_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/kms/key_tags_gen_test.go b/internal/service/kms/key_tags_gen_test.go index fb493bc39644..a55589f554a0 100644 --- a/internal/service/kms/key_tags_gen_test.go +++ b/internal/service/kms/key_tags_gen_test.go @@ -268,8 +268,14 @@ func TestAccKMSKey_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 TestAccKMSKey_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/kms/replica_external_key_tags_gen_test.go b/internal/service/kms/replica_external_key_tags_gen_test.go index e791eadae35c..1753ff064392 100644 --- a/internal/service/kms/replica_external_key_tags_gen_test.go +++ b/internal/service/kms/replica_external_key_tags_gen_test.go @@ -288,8 +288,14 @@ func TestAccKMSReplicaExternalKey_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), + }, + }, }, }, }) @@ -353,8 +359,14 @@ func TestAccKMSReplicaExternalKey_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/kms/replica_key_tags_gen_test.go b/internal/service/kms/replica_key_tags_gen_test.go index 6e747c659336..9bc91d5c00c3 100644 --- a/internal/service/kms/replica_key_tags_gen_test.go +++ b/internal/service/kms/replica_key_tags_gen_test.go @@ -288,8 +288,14 @@ func TestAccKMSReplicaKey_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), + }, + }, }, }, }) @@ -353,8 +359,14 @@ func TestAccKMSReplicaKey_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/lambda/function_tags_gen_test.go b/internal/service/lambda/function_tags_gen_test.go index 4241a103b955..f46f352f489f 100644 --- a/internal/service/lambda/function_tags_gen_test.go +++ b/internal/service/lambda/function_tags_gen_test.go @@ -268,8 +268,14 @@ func TestAccLambdaFunction_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 TestAccLambdaFunction_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/logs/destination_tags_gen_test.go b/internal/service/logs/destination_tags_gen_test.go index 59fdc463b821..65ffb85e4776 100644 --- a/internal/service/logs/destination_tags_gen_test.go +++ b/internal/service/logs/destination_tags_gen_test.go @@ -253,8 +253,14 @@ func TestAccLogsDestination_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 TestAccLogsDestination_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/logs/group_tags_gen_test.go b/internal/service/logs/group_tags_gen_test.go index d7973d699c89..b1c8924b0a36 100644 --- a/internal/service/logs/group_tags_gen_test.go +++ b/internal/service/logs/group_tags_gen_test.go @@ -253,8 +253,14 @@ func TestAccLogsLogGroup_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 TestAccLogsLogGroup_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/medialive/channel_tags_gen_test.go b/internal/service/medialive/channel_tags_gen_test.go index f11422ea7a71..99d122ee9b5a 100644 --- a/internal/service/medialive/channel_tags_gen_test.go +++ b/internal/service/medialive/channel_tags_gen_test.go @@ -268,8 +268,14 @@ func TestAccMediaLiveChannel_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 TestAccMediaLiveChannel_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/medialive/input_security_group_tags_gen_test.go b/internal/service/medialive/input_security_group_tags_gen_test.go index d4a3d0f29268..4367e45660b0 100644 --- a/internal/service/medialive/input_security_group_tags_gen_test.go +++ b/internal/service/medialive/input_security_group_tags_gen_test.go @@ -239,8 +239,14 @@ func TestAccMediaLiveInputSecurityGroup_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 TestAccMediaLiveInputSecurityGroup_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/medialive/input_tags_gen_test.go b/internal/service/medialive/input_tags_gen_test.go index eeaef597e55f..f6834025912f 100644 --- a/internal/service/medialive/input_tags_gen_test.go +++ b/internal/service/medialive/input_tags_gen_test.go @@ -253,8 +253,14 @@ func TestAccMediaLiveInput_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 TestAccMediaLiveInput_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/medialive/multiplex_tags_gen_test.go b/internal/service/medialive/multiplex_tags_gen_test.go index 5be3c2146c94..f9fe8a8f302e 100644 --- a/internal/service/medialive/multiplex_tags_gen_test.go +++ b/internal/service/medialive/multiplex_tags_gen_test.go @@ -297,8 +297,14 @@ func testAccMediaLiveMultiplex_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), + }, + }, }, }, }) @@ -357,8 +363,14 @@ func testAccMediaLiveMultiplex_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/quicksight/analysis_tags_gen_test.go b/internal/service/quicksight/analysis_tags_gen_test.go index 5e0f703d2006..8e35bfdc5fbc 100644 --- a/internal/service/quicksight/analysis_tags_gen_test.go +++ b/internal/service/quicksight/analysis_tags_gen_test.go @@ -255,8 +255,14 @@ func TestAccQuickSightAnalysis_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), + }, + }, }, }, }) @@ -312,8 +318,14 @@ func TestAccQuickSightAnalysis_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/quicksight/dashboard_tags_gen_test.go b/internal/service/quicksight/dashboard_tags_gen_test.go index 76a7eac28afd..1b0103e741f2 100644 --- a/internal/service/quicksight/dashboard_tags_gen_test.go +++ b/internal/service/quicksight/dashboard_tags_gen_test.go @@ -255,8 +255,14 @@ func TestAccQuickSightDashboard_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), + }, + }, }, }, }) @@ -312,8 +318,14 @@ func TestAccQuickSightDashboard_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/quicksight/data_set_tags_gen_test.go b/internal/service/quicksight/data_set_tags_gen_test.go index ca9981d347ef..96227902da3d 100644 --- a/internal/service/quicksight/data_set_tags_gen_test.go +++ b/internal/service/quicksight/data_set_tags_gen_test.go @@ -255,8 +255,14 @@ func TestAccQuickSightDataSet_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), + }, + }, }, }, }) @@ -312,8 +318,14 @@ func TestAccQuickSightDataSet_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/quicksight/data_source_tags_gen_test.go b/internal/service/quicksight/data_source_tags_gen_test.go index 309072906287..ed94908f93dd 100644 --- a/internal/service/quicksight/data_source_tags_gen_test.go +++ b/internal/service/quicksight/data_source_tags_gen_test.go @@ -255,8 +255,14 @@ func TestAccQuickSightDataSource_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), + }, + }, }, }, }) @@ -312,8 +318,14 @@ func TestAccQuickSightDataSource_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/quicksight/folder_tags_gen_test.go b/internal/service/quicksight/folder_tags_gen_test.go index f8ad051bf7d5..8baa206a852a 100644 --- a/internal/service/quicksight/folder_tags_gen_test.go +++ b/internal/service/quicksight/folder_tags_gen_test.go @@ -255,8 +255,14 @@ func TestAccQuickSightFolder_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), + }, + }, }, }, }) @@ -312,8 +318,14 @@ func TestAccQuickSightFolder_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/quicksight/template_tags_gen_test.go b/internal/service/quicksight/template_tags_gen_test.go index 2765bb189118..7bc5b4181ef7 100644 --- a/internal/service/quicksight/template_tags_gen_test.go +++ b/internal/service/quicksight/template_tags_gen_test.go @@ -255,8 +255,14 @@ func TestAccQuickSightTemplate_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), + }, + }, }, }, }) @@ -312,8 +318,14 @@ func TestAccQuickSightTemplate_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/quicksight/theme_tags_gen_test.go b/internal/service/quicksight/theme_tags_gen_test.go index b080645a5155..9ba494283e15 100644 --- a/internal/service/quicksight/theme_tags_gen_test.go +++ b/internal/service/quicksight/theme_tags_gen_test.go @@ -255,8 +255,14 @@ func TestAccQuickSightTheme_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), + }, + }, }, }, }) @@ -312,8 +318,14 @@ func TestAccQuickSightTheme_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/rds/global_cluster_tags_gen_test.go b/internal/service/rds/global_cluster_tags_gen_test.go index b63680ba8be5..5c0268e1426a 100644 --- a/internal/service/rds/global_cluster_tags_gen_test.go +++ b/internal/service/rds/global_cluster_tags_gen_test.go @@ -253,8 +253,14 @@ func TestAccRDSGlobalCluster_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 TestAccRDSGlobalCluster_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/rds/instance_tags_gen_test.go b/internal/service/rds/instance_tags_gen_test.go index a5117ea6220d..044f5d543036 100644 --- a/internal/service/rds/instance_tags_gen_test.go +++ b/internal/service/rds/instance_tags_gen_test.go @@ -268,8 +268,14 @@ func TestAccRDSDBInstance_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 TestAccRDSDBInstance_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/s3/bucket_object_tags_gen_test.go b/internal/service/s3/bucket_object_tags_gen_test.go index 2f1e1d957940..f78a42ab6a0c 100644 --- a/internal/service/s3/bucket_object_tags_gen_test.go +++ b/internal/service/s3/bucket_object_tags_gen_test.go @@ -268,8 +268,14 @@ func TestAccS3BucketObject_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 TestAccS3BucketObject_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/s3/bucket_tags_gen_test.go b/internal/service/s3/bucket_tags_gen_test.go index 6acd8bc492cb..7062ba77fbe8 100644 --- a/internal/service/s3/bucket_tags_gen_test.go +++ b/internal/service/s3/bucket_tags_gen_test.go @@ -250,8 +250,14 @@ func TestAccS3Bucket_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 TestAccS3Bucket_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/s3/object_copy_tags_gen_test.go b/internal/service/s3/object_copy_tags_gen_test.go index d21a918dc2e2..d13121c432f4 100644 --- a/internal/service/s3/object_copy_tags_gen_test.go +++ b/internal/service/s3/object_copy_tags_gen_test.go @@ -195,8 +195,14 @@ func TestAccS3ObjectCopy_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), + }, + }, }, }, }) @@ -242,8 +248,14 @@ func TestAccS3ObjectCopy_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/s3/object_tags_gen_test.go b/internal/service/s3/object_tags_gen_test.go index 8ef920732ddd..8757dbcd11d7 100644 --- a/internal/service/s3/object_tags_gen_test.go +++ b/internal/service/s3/object_tags_gen_test.go @@ -268,8 +268,14 @@ func TestAccS3Object_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 TestAccS3Object_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/secretsmanager/secret_tags_gen_test.go b/internal/service/secretsmanager/secret_tags_gen_test.go index 1d30a45d3427..d94c9eaf35b9 100644 --- a/internal/service/secretsmanager/secret_tags_gen_test.go +++ b/internal/service/secretsmanager/secret_tags_gen_test.go @@ -268,8 +268,14 @@ func TestAccSecretsManagerSecret_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 TestAccSecretsManagerSecret_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/servicecatalog/portfolio_tags_gen_test.go b/internal/service/servicecatalog/portfolio_tags_gen_test.go index 92ad9c23ec2d..2e38e34ae074 100644 --- a/internal/service/servicecatalog/portfolio_tags_gen_test.go +++ b/internal/service/servicecatalog/portfolio_tags_gen_test.go @@ -258,8 +258,14 @@ func TestAccServiceCatalogPortfolio_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), + }, + }, }, }, }) @@ -315,8 +321,14 @@ func TestAccServiceCatalogPortfolio_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/servicecatalog/product_tags_gen_test.go b/internal/service/servicecatalog/product_tags_gen_test.go index 6407d7224e1a..0c31ccf3a7d7 100644 --- a/internal/service/servicecatalog/product_tags_gen_test.go +++ b/internal/service/servicecatalog/product_tags_gen_test.go @@ -270,8 +270,14 @@ func TestAccServiceCatalogProduct_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), + }, + }, }, }, }) @@ -329,8 +335,14 @@ func TestAccServiceCatalogProduct_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/servicecatalog/provisioned_product_tags_gen_test.go b/internal/service/servicecatalog/provisioned_product_tags_gen_test.go index 1b18f7fec563..3ebe0ae7af99 100644 --- a/internal/service/servicecatalog/provisioned_product_tags_gen_test.go +++ b/internal/service/servicecatalog/provisioned_product_tags_gen_test.go @@ -277,8 +277,14 @@ func TestAccServiceCatalogProvisionedProduct_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), + }, + }, }, }, }) @@ -337,8 +343,14 @@ func TestAccServiceCatalogProvisionedProduct_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/sesv2/configuration_set_tags_gen_test.go b/internal/service/sesv2/configuration_set_tags_gen_test.go index 2d0882277294..52655d946f7d 100644 --- a/internal/service/sesv2/configuration_set_tags_gen_test.go +++ b/internal/service/sesv2/configuration_set_tags_gen_test.go @@ -250,8 +250,14 @@ func TestAccSESV2ConfigurationSet_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 TestAccSESV2ConfigurationSet_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/sesv2/contact_list_tags_gen_test.go b/internal/service/sesv2/contact_list_tags_gen_test.go index be44cb9929d1..5eae5ca551db 100644 --- a/internal/service/sesv2/contact_list_tags_gen_test.go +++ b/internal/service/sesv2/contact_list_tags_gen_test.go @@ -279,8 +279,14 @@ func testAccSESV2ContactList_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), + }, + }, }, }, }) @@ -335,8 +341,14 @@ func testAccSESV2ContactList_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/sesv2/dedicated_ip_pool_tags_gen_test.go b/internal/service/sesv2/dedicated_ip_pool_tags_gen_test.go index ea931d470de0..8306c45d63cf 100644 --- a/internal/service/sesv2/dedicated_ip_pool_tags_gen_test.go +++ b/internal/service/sesv2/dedicated_ip_pool_tags_gen_test.go @@ -250,8 +250,14 @@ func TestAccSESV2DedicatedIPPool_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 TestAccSESV2DedicatedIPPool_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/sesv2/email_identity_tags_gen_test.go b/internal/service/sesv2/email_identity_tags_gen_test.go index f83356a03709..8aa06db87d6b 100644 --- a/internal/service/sesv2/email_identity_tags_gen_test.go +++ b/internal/service/sesv2/email_identity_tags_gen_test.go @@ -250,8 +250,14 @@ func TestAccSESV2EmailIdentity_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 TestAccSESV2EmailIdentity_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/sns/topic_tags_gen_test.go b/internal/service/sns/topic_tags_gen_test.go index 6616cd4612d6..fd9d10136ba1 100644 --- a/internal/service/sns/topic_tags_gen_test.go +++ b/internal/service/sns/topic_tags_gen_test.go @@ -252,8 +252,14 @@ func TestAccSNSTopic_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 TestAccSNSTopic_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/sqs/queue_tags_gen_test.go b/internal/service/sqs/queue_tags_gen_test.go index 8f19f9935112..8170bf726ee4 100644 --- a/internal/service/sqs/queue_tags_gen_test.go +++ b/internal/service/sqs/queue_tags_gen_test.go @@ -253,8 +253,14 @@ func TestAccSQSQueue_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 TestAccSQSQueue_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/ssm/activation_tags_gen_test.go b/internal/service/ssm/activation_tags_gen_test.go index f230e59ff522..d58277e8f15b 100644 --- a/internal/service/ssm/activation_tags_gen_test.go +++ b/internal/service/ssm/activation_tags_gen_test.go @@ -273,8 +273,14 @@ func TestAccSSMActivation_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), + }, + }, }, }, }) @@ -333,8 +339,14 @@ func TestAccSSMActivation_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/ssm/association_tags_gen_test.go b/internal/service/ssm/association_tags_gen_test.go index 1015adf744d3..c1cf98a9f9ac 100644 --- a/internal/service/ssm/association_tags_gen_test.go +++ b/internal/service/ssm/association_tags_gen_test.go @@ -250,8 +250,14 @@ func TestAccSSMAssociation_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 TestAccSSMAssociation_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/ssm/document_tags_gen_test.go b/internal/service/ssm/document_tags_gen_test.go index 010715a661a3..f3ecde75c4c9 100644 --- a/internal/service/ssm/document_tags_gen_test.go +++ b/internal/service/ssm/document_tags_gen_test.go @@ -250,8 +250,14 @@ func TestAccSSMDocument_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 TestAccSSMDocument_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/ssm/maintenance_window_tags_gen_test.go b/internal/service/ssm/maintenance_window_tags_gen_test.go index bbd006517394..14d9bc482fcd 100644 --- a/internal/service/ssm/maintenance_window_tags_gen_test.go +++ b/internal/service/ssm/maintenance_window_tags_gen_test.go @@ -253,8 +253,14 @@ func TestAccSSMMaintenanceWindow_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 TestAccSSMMaintenanceWindow_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/ssm/parameter_tags_gen_test.go b/internal/service/ssm/parameter_tags_gen_test.go index 28718018055f..8e8b7819989a 100644 --- a/internal/service/ssm/parameter_tags_gen_test.go +++ b/internal/service/ssm/parameter_tags_gen_test.go @@ -268,8 +268,14 @@ func TestAccSSMParameter_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 TestAccSSMParameter_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/ssm/patch_baseline_tags_gen_test.go b/internal/service/ssm/patch_baseline_tags_gen_test.go index bef0759a0649..7f46c3f54131 100644 --- a/internal/service/ssm/patch_baseline_tags_gen_test.go +++ b/internal/service/ssm/patch_baseline_tags_gen_test.go @@ -253,8 +253,14 @@ func TestAccSSMPatchBaseline_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 TestAccSSMPatchBaseline_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/ssmcontacts/contact_tags_gen_test.go b/internal/service/ssmcontacts/contact_tags_gen_test.go index 34a9d767eef4..79ded3a352da 100644 --- a/internal/service/ssmcontacts/contact_tags_gen_test.go +++ b/internal/service/ssmcontacts/contact_tags_gen_test.go @@ -281,8 +281,14 @@ func testAccSSMContactsContact_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), + }, + }, }, }, }) @@ -337,8 +343,14 @@ func testAccSSMContactsContact_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/xray/group_tags_gen_test.go b/internal/service/xray/group_tags_gen_test.go index 08253cf258e1..f8ccf209a26e 100644 --- a/internal/service/xray/group_tags_gen_test.go +++ b/internal/service/xray/group_tags_gen_test.go @@ -253,8 +253,14 @@ func TestAccXRayGroup_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 TestAccXRayGroup_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/xray/sampling_rule_tags_gen_test.go b/internal/service/xray/sampling_rule_tags_gen_test.go index 498e50b019ca..6bcaea61bff8 100644 --- a/internal/service/xray/sampling_rule_tags_gen_test.go +++ b/internal/service/xray/sampling_rule_tags_gen_test.go @@ -253,8 +253,14 @@ func TestAccXRaySamplingRule_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 TestAccXRaySamplingRule_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), + }, + }, }, }, }) From 5f44bc7d0726de4965b43820af57a67e69022411 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Tue, 1 Jul 2025 13:42:41 -0400 Subject: [PATCH 30/31] Run semgrep 'replace-planonly-checks' only on service acceptance tests. --- .ci/semgrep/acctest/checks/planonly.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/semgrep/acctest/checks/planonly.yml b/.ci/semgrep/acctest/checks/planonly.yml index 41db49403c03..55bf4ff4299d 100644 --- a/.ci/semgrep/acctest/checks/planonly.yml +++ b/.ci/semgrep/acctest/checks/planonly.yml @@ -4,7 +4,7 @@ rules: message: Replace `PlanOnly` acceptance test steps with `plancheck`s paths: include: - - "internal/**/*_test.go" + - "internal/service/*/*_test.go" patterns: - pattern: | { From af9c3f1759a13ca847865ecf03658c3fe81f5f7c Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Tue, 1 Jul 2025 13:48:28 -0400 Subject: [PATCH 31/31] ec2: Replace 'PlanOnly' acceptance test steps with 'plancheck's. --- internal/service/ec2/vpc_endpoint.go | 15 ++---------- internal/service/ec2/vpc_endpoint_policy.go | 15 ++---------- internal/service/ec2/vpc_endpoint_test.go | 27 +++++++++++++++++++-- 3 files changed, 29 insertions(+), 28 deletions(-) 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), + }, + }, }, }, })