AI Platform Bootstrap
The bootstrap foundation component initializes the core landing zone infrastructure for uk-dvt-gcloud-core-projects, establishing remote state storage, Workload Identity Federation (WIF), and central IAM permissions.
Pre-requisites
Required tooling:
- Google Cloud SDK
- Git
- OpenTofu (>= 1.12.0)
Required credentials:
- GitHub account / organization permissions.
- Google Cloud Organization and Billing Account administration access.
- GitHub App credentials for repository automation.
Local Environment Preparation
Authenticate using Application Default Credentials (ADC):
PROJECT_ID="DEFAULT_PROJECT_ID"
gcloud auth login
gcloud config set project "${PROJECT_ID}"
gcloud auth application-default login --billing-project "${PROJECT_ID}"
Export GitHub App environment variables:
export GITHUB_APP_ID="YOUR_GITHUB_APP_ID"
export GITHUB_APP_INSTALLATION_ID="YOUR_GITHUB_APP_INSTALLATION_ID"
export GITHUB_APP_PEM_FILE="$(cat path/to/private-key.pem)"
Bootstrap Execution
1. Common Environment
Initialize and apply the common environment to create folders, KMS, state buckets, and WIF pools:
cd components/foundations/bootstrap/envs/common
tofu init
tofu plan -out .terraform.tfplan
tofu apply .terraform.tfplan
Migrate state to the provisioned remote GCS bucket:
cat <<EOF > backend.tf
terraform {
backend "gcs" {
bucket = "GCS_BUCKET_NAME_FROM_OUTPUT"
prefix = "terraform/components/bootstrap"
}
}
EOF
tofu init -migrate-state
2. Deployment Environments
Repeat for each target environment (development, staging, production):
cd components/foundations/bootstrap/envs/<environment>
tofu init
tofu plan -out .terraform.tfplan
tofu apply .terraform.tfplan
Configure backend.tf and migrate local state to the provisioned GCS bucket.
All subsequent component provisioning and updates are executed automatically via GitHub Actions pipelines.