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 to google_project data source #75

Merged

Conversation

afiune
Copy link
Contributor

@afiune afiune commented Nov 14, 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_config.data.google_project.selected,
│   on .terraform/modules/gcp_project_config/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.

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

@afiune afiune force-pushed the afiune/RAIN-37109/RAIN-39458/fix-empty-google-project-data-source branch from 2ffbe44 to af4e0ff Compare November 14, 2022 16:59
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_config.data.google_project.selected,
│   on .terraform/modules/gcp_project_config/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 force-pushed the afiune/RAIN-37109/RAIN-39458/fix-empty-google-project-data-source branch from af4e0ff to f1a584d Compare November 14, 2022 17:02
@afiune afiune merged commit 976ac9d into main Nov 15, 2022
@afiune afiune deleted the afiune/RAIN-37109/RAIN-39458/fix-empty-google-project-data-source branch November 15, 2022 16:00
@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