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.
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 https://github.com/hashicorp/terraform-provider-consul/issues/344.