-
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 project import regex #2069
Add project import regex #2069
Conversation
Hi! I'm the modular magician, I work on Magic Modules. Pull request statusesNo diff detected in terraform-google-conversion. New Pull RequestsI built this PR into one or more new PRs on other repositories, and when those are closed, this PR will also be merged and closed. |
Hi! I'm the modular magician, I work on Magic Modules. Pull request statusesterraform-provider-google-beta already has an open PR. New Pull RequestsI didn't open any new pull requests because of this PR. |
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.
Hmm, so project IDs exist that are namespaced by an org. I think orgs are website URLs, and website URLs can start with numbers. I'm not sure how safe I feel this regex is, unless you can disprove that 123.com:my-project
can exist. Validation is hard 🙃
I'd feel better about failing in the specific case of users entering entirely numbers, even if URLs starting with a number are generally not used.
Is that a valid project id? I built the regex based on the assumption that the first character of a project id must be a letter, see description of projectId here https://cloud.google.com/resource-manager/reference/rest/v1/projects I'm fine with changing it to only disallow number-only ids, as that should work similarly |
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.
Yep! There are legacy project ids floating around namespaced with URLs.
wdyt of changing this to something like ^[0-9]+$
(and flipping the conditional, to fail on a match) so it's more clear what case we're guarding for? It's a little unintuitive reading this that we're filtering for number-only values, since our match is for each non-digit in the string.
Hi! I'm the modular magician, I work on Magic Modules. Pull request statusesterraform-provider-google-beta already has an open PR. New Pull RequestsI didn't open any new pull requests because of this PR. |
Hi! I'm the modular magician, I work on Magic Modules. Pull request statusesterraform-provider-google-beta already has an open PR. New Pull RequestsI didn't open any new pull requests because of this PR. |
Tracked submodules are build/terraform-beta build/terraform-mapper build/terraform build/ansible build/inspec.
7eb1501
to
a4c0a2c
Compare
Add project import regex to prevent users from importing by project number (which succeeds but then causes an immediate diff)
Release Note for Downstream PRs (will be copied)