Install local dependencies:
brew install hashicorp/tap/terraform terraform-docs tflint
brew install --cask google-cloud-sdkLogin to GCP:
gcloud auth application-default loginConfigure default app:
gcloud config set project $FIREBASE_PROJECT_IDInitialize Terraform:
Also updates the providers which probably doesn't hurt.
terraform init -backend-config="bucket=terraform-state-${FIREBASE_PROJECT_ID}" -upgradeNote
Variables are not allowed in the backup config, so we need to add the config manually.
Note
This only needs to happen once per project and is not part of general developer setup
gcloud storage buckets create gs://terraform-state-$FIREBASE_PROJECT_ID \
--project=${FIREBASE_PROJECT_ID} --location=us-central1
gcloud storage buckets update gs://terraform-state-$FIREBASE_PROJECT_ID --versioning
gcloud storage buckets update gs://terraform-state-$FIREBASE_PROJECT_ID --soft-delete-duration=28d
gcloud storage buckets update gs://terraform-state-$FIREBASE_PROJECT_ID --lifecycle-file=.backup-lifecycle-config.jsonWarning
The bucket cannot be created until the Project has been assigned a billing account. So there is an order of operations conflict that was manually resolved while generating this documentation.