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

fix: empty project_id in google_project data source #20

Merged

Conversation

afiune
Copy link
Contributor

@afiune afiune commented Nov 16, 2022

Summary

A validation change hashicorp/terraform-provider-google#12846 was introduced in version 4.42.0 of the google provider. This validation makes all our GCP modules to fail with:

│ Error: "" project_id must be 6 to 30 with lowercase letters, digits, hyphens and start with a letter. Trailing hyphens are prohibited.
│
│   with module.gcp_project_gar.data.google_project.selected,
│   on .terraform/modules/gcp_project_gar/main.tf line 96, in data "google_project" "selected":
│   96:   project_id = var.project_id

To solve this issue we are avoiding using the google_project data source when we know the project_id that was provided by the user.

If the user does not provide a project_id, then we use the data source to discover the project from the google provider.

Signed-off-by: Salim Afiune Maya afiune@lacework.net

How did you test this change?

Test should pass, plus we will test this in our private Terraform project https://github.com/lacework/terraform-customerdemo

Issue

A validation change hashicorp/terraform-provider-google#12846
was introduced in version `4.42.0` of the google provider. This
validation makes all our GCP modules to fail with:
```
│ Error: "" project_id must be 6 to 30 with lowercase letters, digits, hyphens and start with a letter. Trailing hyphens are prohibited.
│
│   with module.gcp_project_gar.data.google_project.selected,
│   on .terraform/modules/gcp_project_gar/main.tf line 96, in data "google_project" "selected":
│   96:   project_id = var.project_id
```

To solve this issue we are avoiding using the `google_project` data
source when we know the `project_id` that was provided by the user.

If the user does not provide a `project_id`, then we use the data
source to discover the project from the google provider.

Signed-off-by: Salim Afiune Maya <afiune@lacework.net>
@afiune afiune merged commit 387e1fe into main Nov 16, 2022
@afiune afiune deleted the afiune/RAIN-37109/RAIN-39458/fix-empty-google-project-data-source branch November 16, 2022 17:13
@lacework-releng lacework-releng mentioned this pull request Nov 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants