From c32f73ff5a4ec7d933860f25bc4b15f2dc4bf5b2 Mon Sep 17 00:00:00 2001 From: Huy Nguyen <162080607+HuyPhanNguyen@users.noreply.github.com> Date: Tue, 13 Aug 2024 17:19:16 +1000 Subject: [PATCH] fix git credential null description issue (#735) --- octopusdeploy_framework/schemas/gitCredential.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/octopusdeploy_framework/schemas/gitCredential.go b/octopusdeploy_framework/schemas/gitCredential.go index c4b0b4d6f..b11c3fd5a 100644 --- a/octopusdeploy_framework/schemas/gitCredential.go +++ b/octopusdeploy_framework/schemas/gitCredential.go @@ -5,6 +5,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator" datasourceSchema "github.com/hashicorp/terraform-plugin-framework/datasource/schema" resourceSchema "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier" ) const ( @@ -16,21 +17,23 @@ func GetGitCredentialResourceSchema() resourceSchema.Schema { return resourceSchema.Schema{ Description: "Manages a Git credential in Octopus Deploy.", Attributes: map[string]resourceSchema.Attribute{ - "id": util.ResourceString().Optional().Computed().Description("The unique ID for this resource.").Build(), - "space_id": util.ResourceString().Optional().Computed().Description("The space ID associated with this Git Credential.").Build(), + "id": util.ResourceString().Optional().Computed().PlanModifiers(stringplanmodifier.UseStateForUnknown()).Description("The unique ID for this resource.").Build(), + "space_id": util.ResourceString().Optional().Computed().PlanModifiers(stringplanmodifier.UseStateForUnknown()).Description("The space ID associated with this Git Credential.").Build(), "name": util.ResourceString().Required().Description("The name of this Git Credential.").Build(), - "description": util.ResourceString().Optional().Description("The description of this Git Credential.").Build(), + "description": util.ResourceString().Optional().Computed().Default("").Description("The description of this Git Credential.").Build(), "type": util.ResourceString(). Optional(). Description("The Git credential authentication type."). Build(), "username": util.ResourceString(). Required(). + PlanModifiers(stringplanmodifier.UseStateForUnknown()). Description("The username for the Git credential."). Validators(stringvalidator.LengthAtLeast(1)). Build(), "password": util.ResourceString(). Required(). + PlanModifiers(stringplanmodifier.UseStateForUnknown()). Sensitive(). Description("The password for the Git credential."). Validators(stringvalidator.LengthAtLeast(1)).