GoogleCloudPlatform / terraform-validator

Terraform Validator is not an officially supported Google product; it is a library for conversion of Terraform plan data to CAI Assets. If you have been using terraform-validator directly in the past, we recommend migrating to `gcloud beta terraform vet`.
https://cloud.google.com/docs/terraform/policy-validation
Apache License 2.0
437 stars 93 forks source link

Update BootstrapProject to support use across multiple projects/environments #1457

Closed modular-magician closed 1 year ago

modular-magician commented 1 year ago

Only affects tests

With the project split work coming soon to support isolating our test environments, one of the issues we run into is that the projects for all 3 environments are occupying the same space. This is problematic for bootstrapped projects, because each environment will attempt to use the same project for these tests (and potentially do other things like change billing account or permissions).

The fix proposed here is to simply append the "environment test project" id to the end of the bootstrapped project id. This way, each environment will end up creating a unique project that is owned by that environment.

I'm not sure if this will fix https://github.com/hashicorp/terraform-provider-google/issues/13711, but it's possible, because I think we started seeing issues that as soon as the new GA project started running. If not, then I can follow up after this gets merged to double check that there is not some other issue related to the multiple environments.

If this PR is for Terraform, I acknowledge that I have:

Release Note Template for Downstream PRs (will be copied)

Derived from https://github.com/GoogleCloudPlatform/magic-modules/pull/7369