tailscale / terraform-provider-tailscale

Terraform provider for Tailscale
https://registry.terraform.io/providers/tailscale/tailscale
MIT License
258 stars 47 forks source link

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

Open kamalmarhubi opened 7 months ago

kamalmarhubi commented 7 months ago

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:


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.