From 5f4f2a4eb8f60708c942929d241389bf984aff7b Mon Sep 17 00:00:00 2001 From: Jason Ashby Date: Thu, 7 Aug 2025 10:38:22 -0400 Subject: [PATCH] Fix: Only set description field when not empty to avoid Terraform validation errors The description field was being set unconditionally in resourceRoleRead, which caused Terraform to reject the plan when the description was empty because it was trying to set a non-computed attribute to an empty string. This fix ensures that the description field is only set when it contains actual content, preventing the 'Provider produced invalid plan' error for elasticstack_kibana_security_role resources without descriptions. Fixes: #1186 --- internal/kibana/role.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/internal/kibana/role.go b/internal/kibana/role.go index 0138545b1..b7cc3b86d 100644 --- a/internal/kibana/role.go +++ b/internal/kibana/role.go @@ -350,8 +350,11 @@ func resourceRoleRead(ctx context.Context, d *schema.ResourceData, meta interfac if err := d.Set("kibana", flattenKibanaRoleKibanaData(&role.Kibana)); err != nil { return diag.FromErr(err) } - if err := d.Set("description", role.Description); err != nil { - return diag.FromErr(err) + // Only set description if it's not empty to avoid Terraform validation errors + if strings.TrimSpace(role.Description) != "" { + if err := d.Set("description", role.Description); err != nil { + return diag.FromErr(err) + } } if role.Metadata != nil { metadata, err := json.Marshal(role.Metadata)