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

Cannot assign ACL in terraform despite tag existing via online console #380

Closed
bpatwa-sanimax opened this issue Jun 14, 2024 · 5 comments
Closed
Labels
bug Something isn't working

Comments

@bpatwa-sanimax
Copy link

bpatwa-sanimax commented Jun 14, 2024

Describe the bug

I cannot assign a new ACL in terraform despite the tag existing via online console. Why does this happen? Why is it not able access the tag information?

  • Access Control file on console:
"tagOwners": {
		"tag:tag1":        ["autogroup:admin"],
		"tag:tag2":        ["autogroup:admin"],
		"tag:tag3":        ["autogroup:admin"],
	},
  • Tailscale terraform ACL (authenticated via API key):
resource "tailscale_acl" "as_json" {
  acl = jsonencode({
    acls : [
      {
        // Allow all users access to all ports.
        action = "accept",
        users  = ["tag:tag1", "tag:tag2"],
        ports  = ["tag:tag3:*", ],
      },
    ],
  })
}
  • The Error:
Error: ACL validation failed: src=tag not found: "tag:tag1"; []
│ 
│   with module.aws.tailscale_acl.as_json,
│   on modules/aws/ec2_tailscale.tf line 43, in resource "tailscale_acl" "as_hujson":
│   43: resource "tailscale_acl" "as_json" {

Desktop:

  • OS: [Linux]
  • Terraform Version [v1.3.1]
  • Provider Version [0.16.1]
@bpatwa-sanimax bpatwa-sanimax added the bug Something isn't working label Jun 14, 2024
@bpatwa-sanimax
Copy link
Author

Fixed. You need to send your full set of ACL and not just the part you want to update (as shown in docs, which are immensely lacking in detail). Tested it on Client API in Python and was reliably able to recreate the error and discover ways to fix it.

@bpatwa-sanimax
Copy link
Author

The issue persists. Even simply fetching existing acl from the tailnet and applying it back to the resource gives an error during terraform apply.

@mpminardi
Copy link
Member

Hello @bpatwa-sanimax! Is the error you are seeing now still the same validation error that you originally reported, or are you seeing a different error now when you fetch the existing ACL and attempt to apply that?

@bpatwa-sanimax
Copy link
Author

Hello @mpminardi thanks for your response. I was able to debug the error from the error messages. I didn't knew the error messages existed in the diagnostics tab.

@mpminardi
Copy link
Member

No worries, glad to hear you were able to resolve your issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants