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

terraform_acl: Allow specifying a repo URL that automatically adds the comment #345

Open
kamalmarhubi opened this issue Mar 8, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@kamalmarhubi
Copy link

kamalmarhubi commented Mar 8, 2024

Is your feature request related to a problem? Please describe.
We're managing our ACLs in terraform and generate an object which we pass to jsonencode. We attempted to add the comment that prevents modifications from the admin console. The provider helpfully avoids showing diffs when only formatting has changed, but it causes us to get horrible diffs since jsonencode produced compact single-line JSON.

Describe the solution you'd like
I see two possibilities:

  • provide a resource argument for the URL that injects the comment at apply time and strips it before diffing; this way the acl argument will remain easily diffed by terraform
  • add a CustomizeDiff to the resource that shows a diff of the formatted HuJSON for the acl argument

edit: Small update: we were using 0.13 which didn't have #37. Having upgraded, we can now add the comment with something like

locals {
  prevent_changes_comment = "// This tailnet's ACLs are maintained in <url>"
}

resource "tailscale_acl" "acl" {
  acl = join("\n", [local.prevent_changes_comment, jsonencode({
    # actual acl object here
  })])
}

and get nice diffs of the ACLs in plan output.

I still think it would be an improvement to have a separate argument to avoid the ugly concatenation, but feel free to close this.

@kamalmarhubi kamalmarhubi added the enhancement New feature or request label Mar 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant