consul-terraform-sync
consul-terraform-sync copied to clipboard
TFC workspace tags have outdated validation
Describe the bug
CTS does not support creating Terraform Cloud workspace tags with hyphens or underscores. This is because when the tag feature was implemented, only letters, numbers, or colons were allowed. This restriction has since been changed in v202202-1.
CTS checks the tag syntax as part of validating the configuration so that it fails faster and provides feedback to the users sooner than at workspace creation. Since it has an outdated regex for checking the tag syntax, it won't allow tags that are now considered valid by TFC.
Versions
Consul-Terraform-Sync CTS v0.4.2+ent and later.
Terraform Version Terraform Cloud; Terraform Enterprise running TFE v202202-1 or later.
Configuration File(s)
driver "terraform-cloud" {
workspaces {
tags = ["cts-test", "cts_test"]
}
}
Expected Behavior
CTS allows tags with hyphens and underscores to be created and added to the workspace.
Actual Behavior
CTS errors if tags with hyphens or underscores are configured.
2022-06-06T10:59:36.108-0500 [ERROR] cli: error validating configuration: error="workspace tag in 'tags' can only have letters, numbers, or colon: cts-test"
Additional Context
We need to at least update the tag validation to accept hyphens and underscores, but we should also consider removing this check altogether, as we may run into this same issue in the future if TFC tag restrictions change again.