Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validate BigQuery naming requirements before apply #12284

Comments

@gtirloni
Copy link

gtirloni commented Aug 9, 2022

Description

Plan shows resources will be created but then it fails during apply.

Error: Error creating Dataset: googleapi: Error 400: Invalid dataset ID "my-table". Dataset IDs must be alphanumeric (plus underscores) and must be at most 1024 characters long., invalid

It'd be more productive if Terraform would validate that the names satisfy the requirements before applying.

New or Affected Resource(s)

  • google_bigquery_*

b/308248587

@gtirloni
Copy link
Author

gtirloni commented Aug 9, 2022

Here is an example of a workflow that the lack of validation "enables":

  • Work on changes locally (write code, plan, plan, plan)
  • Submit PR
  • CI shows same plan that you had locally
  • Request reviews
  • Get approvals
  • CI tries to apply the change and fails
  • Troubleshoot issue
  • Update PR -> Approvals are invalidated
  • Request reviews
  • Get approvals
  • CI applies changes

@nickozilla
Copy link

This isn't something the google terraform provider has native support for, I'd recommend defining your validation rules on an input variable instead: https://www.terraform.io/language/values/variables#custom-validation-rules. Or if you want to go even further than that, there is a terraform provider for jsonschema validation - which also does a good job of creating custom enforced rules: https://registry.terraform.io/providers/JeffAshton/jsonschema/latest/docs

@c2thorn c2thorn added the size/s label Aug 15, 2022
@c2thorn c2thorn added this to the Goals milestone Aug 15, 2022
@gtirloni
Copy link
Author

I don't know about the validation rules. Is there a document detailing everything? Otherwise, I'd have to go the trial and error route which is what we already are doing with all the failures in CI.

I'd think the provider is a better chokepoint to implement this kind of validation.

Copy link

github-actions bot commented Apr 4, 2024

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 4, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.