Skip to content

Commit

Permalink
fix: tag regex is too strict #6
Browse files Browse the repository at this point in the history
  • Loading branch information
awlsring committed May 13, 2024
1 parent 74d2fa7 commit c4c13bc
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion headscale/tags/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func (d *deviceTagsResource) Schema(_ context.Context, _ resource.SchemaRequest,
Validators: []validator.List{
listvalidator.UniqueValues(),
listvalidator.ValueStringsAre(
stringvalidator.RegexMatches(regexp.MustCompile("^tag:[\\w\\d]+$"), "tag must follow scheme of `tag:<value>`"),
stringvalidator.RegexMatches(regexp.MustCompile("^tag:.*"), "tag must follow scheme of `tag:<value>`"),
),
},
},
Expand Down
9 changes: 9 additions & 0 deletions headscale/test/device_tagging_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@ func Test_DeviceTaggingResource(t *testing.T) {
resource.TestCheckResourceAttr("headscale_device_tags.test", "device_id", "1"),
),
},
{
Config: ProviderConfig + `resource "headscale_device_tags" "test" {
device_id = 1
tags = ["tag:terraform:tests"]
}`,
Check: resource.ComposeAggregateTestCheckFunc(
resource.TestCheckResourceAttr("headscale_device_tags.test", "device_id", "1"),
),
},
},
})
}
6 changes: 0 additions & 6 deletions tools/tools.go

This file was deleted.

0 comments on commit c4c13bc

Please sign in to comment.