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

project_id validator is too restrictive: rejects domain-scoped or long project IDs. #1986

Closed
diekmann opened this issue Sep 4, 2018 · 2 comments
Assignees
Labels

Comments

@diekmann
Copy link

diekmann commented Sep 4, 2018

Terraform Version

  • Independent of Terraform version, I'm using v0.11.6 right now.
  • terraform-provider-google >= 1.13.0

Affected Resource(s)

  • google_project

Terraform Configuration Files

resource "google_project" "my_test_project" {
  project_id      = "example.com:foobar-terraform-test-foo"
  name            = "foobar-terraform-test-foo"
}

Expected Behavior

Terraform accepts the project_id without any trouble.

Actual Behavior

Terraform refuses to load the config with my project_id:

Error: google_project.my_test_project: "example.com:foobar-terraform-test-foo" project_id must be 6 to 30 with lowercase letters, digits, hyphens and start with a letter. Trailing hyphens are prohibited.

This breaks existing configurations which use a domain-scoped project IDs or very long project IDs.

Steps to Reproduce

  1. terraform plan

Important Factoids

terraform-provider-google introduces in 1.13.0 "project: Added name and project_id plan-time validations".

The regex is
ProjectIDRegex = "^[a-z][a-z0-9-]{4,28}[a-z0-9]$".
This regex did not change since 1.13.0 and is still the same in the current github HEAD.

References

Related change which fixes a similar issue: Allow other forms of project names to be matched..

Probably we should get rid of var ProjectIDRegex completely and only use const ProjectRegex (defined in the same file) everywhere? In the code we have, ProjectRegex is the project ID and not the project name.

@danawillow danawillow self-assigned this Sep 4, 2018
@danawillow danawillow added the bug label Sep 4, 2018
@danawillow
Copy link
Contributor

This will be fixed by #1878

@ghost
Copy link

ghost commented Nov 16, 2018

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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 hashibot-feedback@hashicorp.com. Thanks!

@ghost ghost locked and limited conversation to collaborators Nov 16, 2018
@github-actions github-actions bot added forward/review In review; remove label to forward service/cloudresourcemanager-crm labels Jan 15, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants