From b3d5cb86ad7d4ac7d97f33a6e97c048a286717cd Mon Sep 17 00:00:00 2001 From: Anthony Wat Date: Sat, 28 Sep 2024 18:07:09 -0400 Subject: [PATCH] fix: Fix policy_version inconsistent result after apply error for aws_opensearchserverless_lifecycle_policy --- .changelog/39528.txt | 3 +++ internal/service/opensearchserverless/lifecycle_policy.go | 4 +--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.changelog/39528.txt b/.changelog/39528.txt index d7d947ed07d..8e502786abf 100644 --- a/.changelog/39528.txt +++ b/.changelog/39528.txt @@ -1,3 +1,6 @@ ```release-note:bug +resource/aws_opensearchserverless_lifecycle_policy: Fix "Provider produced inconsistent result after apply" error on update due to `policy_version` computed attribute changing +``` +```release-note:bug resource/aws_opensearchserverless_security_policy: Fix "Provider produced inconsistent result after apply" error on update due to `policy_version` computed attribute changing ``` diff --git a/internal/service/opensearchserverless/lifecycle_policy.go b/internal/service/opensearchserverless/lifecycle_policy.go index 165e26065de..dd8cf9dda58 100644 --- a/internal/service/opensearchserverless/lifecycle_policy.go +++ b/internal/service/opensearchserverless/lifecycle_policy.go @@ -76,9 +76,6 @@ func (r *resourceLifecyclePolicy) Schema(ctx context.Context, _ resource.SchemaR }, "policy_version": schema.StringAttribute{ Computed: true, - PlanModifiers: []planmodifier.String{ - stringplanmodifier.UseStateForUnknown(), - }, }, names.AttrType: schema.StringAttribute{ CustomType: fwtypes.StringEnumType[awstypes.LifecyclePolicyType](), @@ -187,6 +184,7 @@ func (r *resourceLifecyclePolicy) Update(ctx context.Context, req resource.Updat } in.ClientToken = aws.String(id.UniqueId()) + in.PolicyVersion = state.PolicyVersion.ValueStringPointer() // use policy version from state since it can be recalculated on update out, err := conn.UpdateLifecyclePolicy(ctx, in) if err != nil {