fixed multile issues
Some checks failed
validation / verify (push) Failing after 8s

This commit is contained in:
2026-10-07 17:33:36 +01:00
parent 4c4d44ef87
commit 5bb22d984e
76 changed files with 5799 additions and 179 deletions

View File

@@ -0,0 +1,45 @@
# Secret Manager
Terraform creates the secret and who may read it. The value is added outside Terraform, so it never enters the state or the repository.
- `replication` is required: `auto {}` for Google-managed locations, or `user_managed` with one `replicas` block per location.
- Grant `roles/secretmanager.secretAccessor` on the secret, to the one identity that reads it.
- Never write a `google_secret_manager_secret_version` with the value in the configuration.
```hcl
variable "project_id" {
type = string
description = "Project to deploy into."
}
variable "region" {
type = string
description = "Region for regional resources."
}
resource "google_service_account" "reader" {
project = var.project_id
account_id = "api-key-reader"
display_name = "Reads the API key"
}
resource "google_secret_manager_secret" "api_key" {
project = var.project_id
secret_id = "partner-api-key"
replication {
user_managed {
replicas {
location = var.region
}
}
}
}
resource "google_secret_manager_secret_iam_member" "reader_reads_api_key" {
project = var.project_id
secret_id = google_secret_manager_secret.api_key.secret_id
role = "roles/secretmanager.secretAccessor"
member = google_service_account.reader.member
}
```