-
Notifications
You must be signed in to change notification settings - Fork 46
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
Prefer using jsonencode for ACLs instead of heredocs #36
Comments
Hey @pokgak, thanks for raising this. I think what you've proposed for the documentation change is sensible. So I can raise a PR to update that. Per your comment on #17, I currently have a branch I'm working on that gets the hujson work done without any significant changes. Originally, the tailscale API required callers to specify the What this means is, the ACL stored locally with the terraform files can have all the fancy features like comments, but what gets pushed to Tailscale itself won't have them (as they are lost when we encode/decode the ACL into an actual type). I'm not sure how big an issue that is, as the ACL stored locally can still have all the comments. It would depend if users want the Tailscale dashboard to be the source of truth for the ACL or what they have locally with their terraform files. I think the latter is more likely what people would want. But am open to input. For the use of |
Also, I did a quick test, and this is how you should do it: resource "tailscale_acl" "homelab_acl" {
acl = jsonencode({
acls : [
{
action = "accept",
users = ["*"],
ports = ["*:*"],
}],
})
} |
This commit modifies the example/documentation for ACLs to use the `jsonencode` function instead of heredocs. Closes #36 Signed-off-by: David Bond <[email protected]>
This commit modifies the example/documentation for ACLs to use the `jsonencode` function instead of heredocs. Closes #36 Signed-off-by: David Bond <[email protected]>
Works for me. I prefer just referring to the Terraform files as the source of truth so HCL comments should be enough. Thank you! |
Is your feature request related to a problem? Please describe.
Currently, the documentation for this provider uses heredocs (
acl = <<EOF
) for defining the ACLs. The official Terraform documentation said to prefer using thejsonencode
function instead of heredoc for generating JSON.Describe the solution you'd like
Change documentation to use
jsonencode
instead of heredoc.Example (not tested):
Additional context
Not sure how this will work when support for hujson is added later though, it might make it more complicated than the proposed way in #17.
The text was updated successfully, but these errors were encountered: