34 lines
751 B
Markdown
34 lines
751 B
Markdown
# Enabling APIs
|
|
|
|
Enable each API the Elements need, once, and make the first resource of each product depend on it.
|
|
|
|
- `disable_on_destroy = false` keeps the API on when the configuration is destroyed; other workloads in the project may use it.
|
|
|
|
```hcl
|
|
variable "project_id" {
|
|
type = string
|
|
description = "Project to deploy into."
|
|
}
|
|
|
|
variable "region" {
|
|
type = string
|
|
description = "Region for regional resources."
|
|
}
|
|
|
|
locals {
|
|
services = [
|
|
"run.googleapis.com",
|
|
"pubsub.googleapis.com",
|
|
"secretmanager.googleapis.com",
|
|
]
|
|
}
|
|
|
|
resource "google_project_service" "enabled" {
|
|
for_each = toset(local.services)
|
|
|
|
project = var.project_id
|
|
service = each.value
|
|
disable_on_destroy = false
|
|
}
|
|
```
|