Skip to content
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

No way to set attributes on default namespace #247

Closed
chrisjohnson opened this issue Mar 25, 2021 · 4 comments · Fixed by #263
Closed

No way to set attributes on default namespace #247

chrisjohnson opened this issue Mar 25, 2021 · 4 comments · Fixed by #263

Comments

@chrisjohnson
Copy link

Currently there's no way to set attributes on an existing namespace. The pattern for setting ACL policies on the built-in tokens is to use consul_acl_token_policy_attachment which allows you to specify a token that wasn't created by terraform.

A consul_namespace_policy_attachment resource seems appropriate here. You could specify namespace=default and attach policies and roles to it that way. The UI currently lets you do this but right now I'm having to use terraform to set default token policy/role on every other namespace and then manually manage it for default.

@chrisjohnson
Copy link
Author

FWIW it does seem like consul lets you create a namespace with the name default and it merges into the default, however this can be problematic when attempting to destroy the resource later on as terraform errors out. You end up having to manually clean up state. So there is a hacky workaround, but ideally an _attachment type resource would be introduced

@remilapeyre
Copy link
Contributor

Hi @chrisjohnson, thanks for raising this issue. This should indeed be fixed, I'm not sure a new resource would be the best way to go here though, perhaps we should just make the destroy a no-op for the default namespace?

@chrisjohnson
Copy link
Author

I was just thinking for API consistency with the policy attachment type, but honestly I'm fine with either way

remilapeyre added a commit to remilapeyre/terraform-provider-consul that referenced this issue May 24, 2021
@remilapeyre
Copy link
Contributor

Thinking about it it makes sense to both have a consul_namespace_policy_attachment resource and make consul_namespace importable so that is possible to import the default namespace in the configuration to manage it like the rest of the other ones, this is already what we do for the anonymous token for example.

#263 adds import support to consul_namespace. I will post anoother PR for consul_namespace_policy_attachment shortly.

remilapeyre added a commit to remilapeyre/terraform-provider-consul that referenced this issue May 26, 2021
remilapeyre added a commit to remilapeyre/terraform-provider-consul that referenced this issue May 26, 2021
remilapeyre added a commit that referenced this issue Jul 29, 2021
remilapeyre added a commit that referenced this issue Jul 29, 2021
remilapeyre added a commit that referenced this issue Jul 29, 2021
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 a pull request may close this issue.

2 participants