canada-ca / accelerators_accelerateurs-gcp

[GCP] Tools and templates to accelerate GC service delivery. Outils et modèles pour accélérer la prestation de services du GC.
MIT License
10 stars 8 forks source link

Validate dept-seed-project does not have a GCP existing project conflict - either add random suffix or add increment on gcloud projects create command #43

Open fmichaelobrien opened 2 years ago

fmichaelobrien commented 2 years ago

Handle both reentrant behaviour - where the user reran the bootstrap sh script - and the fact that the project may already exist in the GCP project namespace

fix would be to add a random suffix - like we do for the guardrails project - but this would complicate reentrant behaviour - better to just move terraform init/apply into the sh script

https://github.com/canada-ca/accelerators_accelerateurs-gcp/blob/main/deployment-templates/Terraform/guardrails/0-bootstrap/bootstrap.sh#L101

PROJ_EXISTS=$(gcloud projects list --filter ${seed_project_id})
if [ -z "$PROJ_EXISTS" ]
then
  gcloud projects create "${seed_project_id}" --organization=${org_id}  --quiet
  # handle project id already exists collision
else
  echo "${seed_project_id} project already exists and will be reused to provision resources"
fi
fmichaelobrien commented 2 years ago

assigned to fmichaelobrien