Skip to content

fix: ensure description field for elasticstack_kibana_security_role behaves as optional #1235

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

snobear
Copy link

@snobear snobear commented Aug 7, 2025

The description field added in #1186 was intended to be optional, but I found that when it is not set it causes:

│ Error: Provider produced invalid plan
│ 
│ Provider "registry.terraform.io/elastic/elasticstack" planned an invalid value for
│ elasticstack_kibana_security_role.kibana_guest_user_role.description: planned value cty.StringVal("") for a
│ non-computed attribute.
│ 
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.

It 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 ensures that the description field is only set when it contains actual content, so it can be optional.

…idation 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: elastic#1186
@snobear snobear changed the title fix: only set elasticstack_kibana_security_role description field when not empty fix: ensure description field for elasticstack_kibana_security_role behaves as optional Aug 7, 2025
@snobear
Copy link
Author

snobear commented Aug 7, 2025

cc @tobio

Copy link
Member

@tobio tobio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for getting involved @snobear.

Two things:

  • The current acceptance tests are passing, but don't set the description attribute. It seems like the actual bug here is slightly more subtle (or maybe specific to some Terraform version). It would be great to understand what that is though. Are you able to add an acceptance test which fails without this change, but is fixed by this PR?
  • Are you able to add an entry to CHANGELOG.md for this PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants