Skip to content

Commit

Permalink
fix: Fix policy_version inconsistent result after apply error for aws…
Browse files Browse the repository at this point in the history
…_opensearchserverless_security_policy
  • Loading branch information
acwwat committed Sep 28, 2024
1 parent 465d069 commit 165d248
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .changelog/39528.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```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
```
4 changes: 1 addition & 3 deletions internal/service/opensearchserverless/security_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,6 @@ func (r *resourceSecurityPolicy) Schema(ctx context.Context, req resource.Schema
},
"policy_version": schema.StringAttribute{
Computed: true,
PlanModifiers: []planmodifier.String{
stringplanmodifier.UseStateForUnknown(),
},
},
names.AttrType: schema.StringAttribute{
CustomType: fwtypes.StringEnumType[awstypes.SecurityPolicyType](),
Expand Down Expand Up @@ -195,6 +192,7 @@ func (r *resourceSecurityPolicy) Update(ctx context.Context, req resource.Update
}

input.ClientToken = aws.String(id.UniqueId())
input.PolicyVersion = state.PolicyVersion.ValueStringPointer() // use policy version from state since it can be recalculated on update

out, err := conn.UpdateSecurityPolicy(ctx, input)

Expand Down

0 comments on commit 165d248

Please sign in to comment.