Support both UUIDs and names in consul_acl_role.policies #363
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The
consul_acl_role
attributepolicies
only support UUIDs like:This differs from the Consul API payload where the
Policies
attribute is actually a list of objects, not a list of strings:This makes it possible to set the policies using either the ID, or the name:
This is not supported by the
consul_acl_role
resource.Not being able to add a policy using its name makes things harder for users and hanging its schema to make
policies
a list of objects would be best, but it would also break the backward compatibility of the provider which I always try not to.This patch makes it possible possible to use either and tries first to fetch the corresponding policy using the ID, then using the name.
resourceConsulACLRoleRead()
is also updated to set the correct value in Terraform so that we don't have a perpetual diff.Closes #344.