tailscale: support ACL contents as HuJSON #332
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The
acl
argument of thetailscale_acl
resource can now be a HuJSON string. Instead of unmarshallingacl
into anACL
struct of the API client just to have the client serialize it into JSON again, policy content gets passed to the Tailscale API verbatim.This allows users to define their policy as HuJSON strings, with comments being preserved. Since JSON is a subset of HuJSON, this is backwards compatible, so I am not adding a separate field for this as has been previously suggested in #227.
Validation is now performed by calling the Validate and test policy file API, which will help catch any semantic errors in the policy at
terraform plan
stage (for example, when a syntactically correct policy contains configuration that is not supported by the Tailnet's current pricing plan).Finally, this will also allow users to use new fields in the policy without requiring a new release of the Terraform provider.
I've also added a new
hujson
field to thetailscale_acl
data resource that shows current policy as a HuJSON string.Fixes #331
Fixes #227