hashicorp / terraform-provider-google

Terraform Provider for Google Cloud Platform
https://registry.terraform.io/providers/hashicorp/google/latest/docs
Mozilla Public License 2.0
2.29k stars 1.72k forks source link

Add validation to `default_labels` #18696

Open zachberger opened 2 months ago

zachberger commented 2 months ago

Community Note

Description

Label values must conform to the regexp [\p{Ll}\p{Lo}\p{N}_-]{0,63}. It would be good to add validation to default_labels argument so that plans fail if an invalid label value is passed instead of waiting for the API to reject it during apply.

New or Affected Resource(s)

The provider

Potential Terraform Configuration

References

https://cloud.google.com/compute/docs/labeling-resources#requirements

rileykarson commented 2 months ago

Note from triage: This is probably reasonable since we're applying the values directly. I'm not sure if there are labels fields with different validation rules anywhere- but we'd probably want to exclude them from default_labels if so.