-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Add plan-time validation of name
on google_compute_instance
#11886
Add plan-time validation of name
on google_compute_instance
#11886
Conversation
Hello! I am a robot. Tests will require approval from a repository maintainer to run. @rileykarson, a repository maintainer, has been assigned to review your changes. If you have not received review feedback within 2 business days, please leave a comment on this PR asking them to take a look. You can help make sure that review is quick by doing a self-review and by running impacted tests locally. |
@rileykarson This PR has been waiting for review for 3 weekdays. Please take a look! Use the label |
@GoogleCloudPlatform/terraform-team @rileykarson This PR has been waiting for review for 1 week. Please take a look! Use the label |
fix unit test expecting hardcoded values fix ordering scratch disks in the state Remove hardcoded values that are handled by the API
@@ -22,7 +22,7 @@ const ( | |||
|
|||
SubnetworkLinkRegex = "projects/(" + ProjectRegex + ")/regions/(" + RegionRegex + ")/subnetworks/(" + SubnetworkRegex + ")$" | |||
|
|||
RFC1035NameTemplate = "[a-z](?:[-a-z0-9]{%d,%d}[a-z0-9])" | |||
RFC1035NameTemplate = "[a-z]([-a-z0-9]{%d,%d}[a-z0-9])?" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This allows the string "a" when any input is supplied. For example, 1,61
(source input to the fn of 2,63
). Added some extra test cases as constraints.
I suspect we need to rework the regex substantially to go below a minimum of 2 while properly validating the format. We may want to mix procedural code and regex or just write this as entirely procedural code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agreed. After checking this regex fails on one new test case that you've added. This is mainly due to length which should be procedural imo.
The only other think that this regex is affecting are Service Account names so will look out for errors there as well.
34f96b1
to
823b3e7
Compare
sorry. Pushed a rebased branch on accident. What was done.
This allows to input a Here are 2 unit tests affected
|
@rileykarson This PR has been waiting for review for 3 weekdays. Please take a look! Use the label |
Hi there, I'm the Modular magician. I've detected the following information about your changes: Diff reportYour PR generated some diffs in downstreams - here they are.
Errors
|
Tests analyticsTotal tests: 4196 Click here to see the affected service packages
Action takenFound 2 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
|
doesn't seem related |
@GoogleCloudPlatform/terraform-team @rileykarson This PR has been waiting for review for 1 week. Please take a look! Use the label |
@GoogleCloudPlatform/terraform-team @rileykarson This PR has been waiting for review for 2 weeks. Please take a look! Use the label |
…leCloudPlatform#11886) Co-authored-by: Cameron Thornton <[email protected]>
…leCloudPlatform#11886) Co-authored-by: Cameron Thornton <[email protected]>
…leCloudPlatform#11886) Co-authored-by: Cameron Thornton <[email protected]>
closes hashicorp/terraform-provider-google#18265
google_compute_instance
The regexes are wrong in the validation file. Our verification functions expected 2-63 characters when in reality it's 1-63. Basing on this documentation: https://cloud.google.com/compute/docs/naming-resources#resource-name-format and manual testing
Some other tests might fail due to these changes in the validate file so pls paste the test errors after the CICD run
Release Note Template for Downstream PRs (will be copied)