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

allowing validating the ACL tests before terraform apply #158

Closed
codekitchen opened this issue Sep 23, 2022 · 1 comment · Fixed by #325
Closed

allowing validating the ACL tests before terraform apply #158

codekitchen opened this issue Sep 23, 2022 · 1 comment · Fixed by #325
Labels
enhancement New feature or request

Comments

@codekitchen
Copy link

We prefer to manage our infrastructure with Terraform whenever possible. But one nice feature that Tailscale's GitOps Pusher supports is to validate your ACL logic pre-merge in a PR by asking Tailscale to run the ACL tests. It'd be great if the Terraform provider could support this somehow as well.

I'm not entirely sure how to best fit this into a Terraform workflow -- my first thought would be to have terraform plan run the validation step. But that would perhaps be surprising to some?

@codekitchen codekitchen added the enhancement New feature or request label Sep 23, 2022
@davidsbond
Copy link
Contributor

davidsbond commented Sep 25, 2022

One approach for this could be to modify the existing ACL validation to send it off to the Tailscale API for the test endpoint.

func validateACL(i interface{}, p cty.Path) diag.Diagnostics {

The client package would also need a method added to call the testing endpoint.

davidsbond added a commit to davidsbond/tailscale-client-go that referenced this issue Sep 26, 2022
This commit adds a `ValidateACL` method to the `Client` type that will be used to check the
ACL is well formatted and the specified tests pass. It uses the JSON object method described
in the API documentation.

This will be required for implementing additional validation as requested on the terraform
provider:

tailscale/terraform-provider-tailscale#158

Signed-off-by: David Bond <[email protected]>
davidsbond added a commit to davidsbond/tailscale-client-go that referenced this issue Oct 10, 2022
This commit adds a `ValidateACL` method to the `Client` type that will be used to check the
ACL is well formatted and the specified tests pass. It uses the JSON object method described
in the API documentation.

This will be required for implementing additional validation as requested on the terraform
provider:

tailscale/terraform-provider-tailscale#158

Signed-off-by: David Bond <[email protected]>
DentonGentry pushed a commit to tailscale/tailscale-client-go that referenced this issue Oct 10, 2022
This commit adds a `ValidateACL` method to the `Client` type that will be used to check the
ACL is well formatted and the specified tests pass. It uses the JSON object method described
in the API documentation.

This will be required for implementing additional validation as requested on the terraform
provider:

tailscale/terraform-provider-tailscale#158

Signed-off-by: David Bond <[email protected]>

Signed-off-by: David Bond <[email protected]>
davidsbond added a commit to davidsbond/terraform-provider-tailscale that referenced this issue Oct 10, 2022
Closes tailscale#158

This commit modifies the provider to validate ACLs against the Tailscale API on create
or update. Validation will only be performed if the ACL definition has at least one
test in it.

Signed-off-by: David Bond <[email protected]>
dsymonds added a commit to dsymonds/terraform-provider-tailscale that referenced this issue Jan 28, 2024
dsymonds added a commit to dsymonds/terraform-provider-tailscale that referenced this issue Jan 30, 2024
dsymonds added a commit to dsymonds/terraform-provider-tailscale that referenced this issue Jan 30, 2024
dsymonds added a commit to dsymonds/terraform-provider-tailscale that referenced this issue Feb 2, 2024
@knyar knyar closed this as completed in #325 Feb 2, 2024
knyar pushed a commit that referenced this issue Feb 2, 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
2 participants