You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Labels blocks for most / all services will allow you to define a label like:
resource"google_pubsub_topic""foo" {
name="foo"labels={
Team ="Foobar"
}
}
This will plan fine, but then bail on apply with an error like:
Error: Error creating Topic: googleapi: Error 400: You have passed an invalid argument to the service (argument=Invalid labels: Invalid field "labels"; key "Team" does not conform to regular expression "[\p{Ll}\p{Lo}][\p{Ll}\p{Lo}\p{N}_-]{0,62}"; first character "T" is not a non-uppercased letter (Unicode character class Ll or Lo)).
I spot-checked another resource type, and saw the same behavior.
While TPG could also probably do better validation, might be good to have a tflint error for it?
The text was updated successfully, but these errors were encountered:
This is a good suggestion, but as discussed in hashicorp/terraform-provider-google#22246, it is important to note that the label format is not uniform across all services.
That said, this does seem like a common problem in many cases, so it might be worth introducing your own no-upper-case rule.
The comments here seem to imply that there are at least some rules that are supposed to be observed, at least within the two major categories.
Even if the rules have to be limited to subsets of resources that follow the same conventions, seems to me like it could be useful if a) the restrictions don't change often and b) if it's not too burdensome to find the rules for some / most labels.
Either way, tflint could choose to be more opinionated (i.e., having a rule to flag upper case labels, or labels over a certain length, or whatever), even if there were a corner case where Google's APIs would technically allow them)
Labels blocks for most / all services will allow you to define a label like:
This will plan fine, but then bail on apply with an error like:
I spot-checked another resource type, and saw the same behavior.
While TPG could also probably do better validation, might be good to have a tflint error for it?
The text was updated successfully, but these errors were encountered: