✅ Terraform
✅ Google Cloud SDK (gcloud)
✅ A Google Cloud Project with billing enabled
Run the following command to authenticate with a dedicated service account:
cloud auth activate-service-account [ACCOUNT] --key-file=KEY_FILERun this once to download provider plugins and set up the working directory:
terraform initEdit the terraform.tfvars file (do not commit this file) and set your GCP project details:
project_id = "your-gcp-project-id"
region = "europe-west1"Preview the changes Terraform will make:
terraform planDeploy the configuration to GCP:
terraform applyAfter deployment, Terraform will output the service account email:
terraform outputThe service-account module can be reused in other projects by calling it like this:
module "new_service_account" {
source = "./modules/service-account"
project_id = var.project_id
service_account_name = "custom-sa"
display_name = "Custom Service Account"
roles = ["roles/editor", "roles/bigquery.admin"]
}To destroy the resources and remove everything:
terraform destroy