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

Out-of-order dependencies issues with A-VALID-PROJECT-ID in bootstrap #935

Open
eeaton opened this issue Mar 1, 2023 · 2 comments
Open
Labels
backlog documentation Improvements or additions to documentation triaged Scoped and ready for work v5.0

Comments

@eeaton
Copy link
Collaborator

eeaton commented Mar 1, 2023

TL;DR

https://github.com/terraform-google-modules/terraform-example-foundation/blob/44d51df886e165098ebbd13a02ac1b26ac9c2b6e/0-bootstrap/README.md

Written employment instructions in the bootstrap stage recommend use of A-VALID-PROJECT-ID as a billing and quota project for the terraform validator. This is poor usability and out-of-order dependencies, because the blueprint is intended for new environments that don't have existing projects, and does not have any prior instructions to manually create A-VALID-PROJECT-ID .

Expected behavior

If I follow the deployment instructions in a new environment, there should not be assumptions or dependencies about pre-existing resources in my environment. Where those dependencies are necessary, they should be enumerated as mandatory steps in the Prerequisites section.

Specifically, commands for terraform validator with A-VALID-PROJECT-ID should reference project IDs that have already been created somewhere in the instructions.

Observed behavior

Following the flow as a greenfield customer, no projects have been created yet. I have to manually create a project and associate billing in a way that is not addressed in the deployment instructions.

Terraform Configuration

n/a

Terraform Version

n/a

Additional information

No response

@eeaton eeaton added the bug Something isn't working label Mar 1, 2023
@github-actions
Copy link

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days

@github-actions github-actions bot added the Stale label Apr 30, 2023
@bharathkkb bharathkkb added triaged Scoped and ready for work and removed Stale labels May 3, 2023
@fmichaelobrien
Copy link
Contributor

Hi, some triage to help out with initial project creation.
I will update the docs shortly
Yes, it helps if you have a bootstrap project to use when initially running the onboarding. All GCP organizations come with at least 1 project. Usually you delete this example project, increase project quota above 15 and billing/project quota above 5, then create a boot project like boot-"first letters of your org domain" for example lz-boot-clz for an org under cloud.landing.zone

A bootstrap project (before usage of this terraform landing zone) is useful to derive the billing and organizations id's as well.

create project example

export CC_PROJECT_ID=bootstrap-plz
root_@cloudshell:~/lz-tef-plz/CloudLandingZone/terraform-example-foundation/0-bootstrap (lz-tef-plz)$  gcloud projects create $CC_PROJECT_ID --name="${CC_PROJECT_ID}" --set-as-default
Create in progress for [https://cloudresourcemanager.googleapis.com/v1/projects/bootstrap-plz].
Waiting for [operations/cp.5122135151997130492] to finish...done.                                                                                                                                                                    
Enabling service [[cloudapis.googleapis.com](http://cloudapis.googleapis.com/)] on project [bootstrap-plz]...
Operation "operations/acat.p2-208036100419-ba66496b-4a17-45fe-806c-c7f154c9bca2" finished successfully.
Updated property [core/project] to [bootstrap-plz].
root_@cloudshell:~/lz-tef-plz/CloudLandingZone/terraform-example-foundation/0-bootstrap (bootstrap-plz)$ export BILLING_ID=$(gcloud alpha billing projects describe $CC_PROJECT_ID '--format=value(billingAccountName)' | sed 's/.*\///')
root_@cloudshell:~/lz-tef-plz/CloudLandingZone/terraform-example-foundation/0-bootstrap (bootstrap-plz)$ echo $BILLING_ID
- notice billing is not set - even though we are either a "Billing Account Administrator" or "Billing Account User" - we get the billing ID from another project with billing set - or we set the BILLING_ID variable manually
root_@cloudshell:~/lz-tef-plz/CloudLandingZone/terraform-example-foundation/0-bootstrap (bootstrap-plz)$ export BILLING_ID=$(gcloud alpha billing projects describe lz-tef-plz '--format=value(billingAccountName)' | sed 's/.*\///')
root_@cloudshell:~/lz-tef-plz/CloudLandingZone/terraform-example-foundation/0-bootstrap (bootstrap-plz)$ echo $BILLING_ID
01906F-.....-859F42
root_@cloudshell:~/lz-tef-plz/CloudLandingZone/terraform-example-foundation/0-bootstrap (bootstrap-plz)$ export ORGANIZATION_ID=$(gcloud projects get-ancestors $CC_PROJECT_ID --format='get(id)' | tail -1)
root_@cloudshell:~/lz-tef-plz/CloudLandingZone/terraform-example-foundation/0-bootstrap (bootstrap-plz)$ echo $ORGANIZATION_ID
93...09
root_@cloudshell:~/lz-tef-plz/CloudLandingZone/terraform-example-foundation/0-bootstrap (bootstrap-plz)$ gcloud beta billing projects link ${CC_PROJECT_ID} --billing-account ${BILLING_ID}
billingAccountName: billingAccounts/01906F-...-859F42
billingEnabled: true
name: projects/bootstrap-plz/billingInfo
projectId: bootstrap-plz

- now recheck the billing id on the new project and we are good to use it
root_@cloudshell:~/lz-tef-plz/CloudLandingZone/terraform-example-foundation/0-bootstrap (bootstrap-plz)$ export BILLING_ID=$(gcloud alpha billing projects describe $CC_PROJECT_ID '--format=value(billingAccountName)' | sed 's/.*\///')
root_@cloudshell:~/lz-tef-plz/CloudLandingZone/terraform-example-foundation/0-bootstrap (bootstrap-plz)$ echo $BILLING_ID
01906F-...-859F42

an evolving day0 example is in #940

@eeaton eeaton added documentation Improvements or additions to documentation backlog v5.0 and removed bug Something isn't working labels May 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backlog documentation Improvements or additions to documentation triaged Scoped and ready for work v5.0
Projects
None yet
Development

No branches or pull requests

3 participants