Created
September 10, 2025 13:22
-
-
Save JulienBreux/d643172bb4982c7b9696ea8208ea61dc to your computer and use it in GitHub Desktop.
GCP - Enable Gemini for some projects using Terraform.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| variable "projects" { | |
| description = "A map of project IDs to create, all linked to the same billing account." | |
| type = map(string) | |
| default = { | |
| "project-alpha" = "Alpha Project", | |
| "project-beta" = "Beta Project", | |
| "project-gamma" = "Gamma Project" | |
| } | |
| } | |
| variable "billing_account_id" { | |
| description = "The billing account ID to associate with all projects." | |
| type = string | |
| } | |
| resource "google_project" "multiple_projects" { | |
| for_each = var.projects | |
| project_id = each.key | |
| name = each.value | |
| # This is the shared billing account ID | |
| billing_account = var.billing_account_id | |
| labels = { | |
| managed-by = "terraform" | |
| } | |
| } | |
| resource "google_project_service" "gemini_api" { | |
| for_each = google_project.multiple_projects | |
| project = each.value.project_id | |
| service = "aiplatform.googleapis.com" | |
| disable_on_destroy = false | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment