From 734f4de0403f9002a4a838f8c8215b5ccee34bb7 Mon Sep 17 00:00:00 2001 From: Ott Ramst Date: Mon, 25 Nov 2024 21:38:06 +0200 Subject: [PATCH] Fix issues with `vaultwarden_organization_user` resource attributes on update --- CHANGELOG.md | 4 ++++ docs/resources/organization_user.md | 1 + internal/provider/resource_organization_user.go | 12 +++++++++++- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6ae468a..d2f319f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ## [Unreleased] +## v0.4.4 + +* Fix issues with `vaultwarden_organization_user` resource attributes on update + ## v0.4.3 * Add `access_all` attribute to `vaultwarden_organization_user` resource diff --git a/docs/resources/organization_user.md b/docs/resources/organization_user.md index b605e2f..419c4c0 100644 --- a/docs/resources/organization_user.md +++ b/docs/resources/organization_user.md @@ -34,6 +34,7 @@ resource "vaultwarden_organization_user" "example" { ### Optional +- `access_all` (Boolean) Whether the user has access to all collections in the organization. Defaults to `false` - `type` (String) The role type of the user (Owner, Admin, User, Manager). Defaults to `User` ### Read-Only diff --git a/internal/provider/resource_organization_user.go b/internal/provider/resource_organization_user.go index f48f098..d2125b5 100644 --- a/internal/provider/resource_organization_user.go +++ b/internal/provider/resource_organization_user.go @@ -55,16 +55,23 @@ func (r *OrganizationUser) Schema(ctx context.Context, req resource.SchemaReques Computed: true, MarkdownDescription: "ID of the invited user", PlanModifiers: []planmodifier.String{ - stringplanmodifier.RequiresReplace(), + stringplanmodifier.UseStateForUnknown(), }, }, "organization_id": schema.StringAttribute{ MarkdownDescription: "ID of the organization to invite the user to", Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + stringplanmodifier.RequiresReplace(), + }, }, "email": schema.StringAttribute{ MarkdownDescription: "The email of the user to invite", Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, }, "type": schema.StringAttribute{ MarkdownDescription: "The role type of the user (Owner, Admin, User, Manager). Defaults to `User`", @@ -87,6 +94,9 @@ func (r *OrganizationUser) Schema(ctx context.Context, req resource.SchemaReques Validators: []validator.String{ stringvalidator.OneOf("Revoked", "Invited", "Accepted", "Confirmed"), }, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, }, }, }