The reference agent's subject, cloud solution architecture, as an agent in the operating model agent's pattern: the Execution engine (from orchestration_engine) and one Workflow in app/solution_architecture, built for the settings and provider bundle by assembly.workflow_for. Copied from gcp_solution_architecture_agent at 8b397cd without its own engine: its role files, Skills, provider bundle, ADRs, vocabulary, scripts and evaluation datasets. The image takes the engine from a named build context and installs Terraform. It is called through the Orchestration engine, and its files are what the operating model agent digests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
68 lines
2.0 KiB
Markdown
68 lines
2.0 KiB
Markdown
# Cloud Storage
|
|
|
|
A private bucket with a retention period and a lifecycle.
|
|
|
|
- Bucket names are global. Build the name from the project id.
|
|
- `uniform_bucket_level_access = true` and `public_access_prevention = "enforced"` keep the bucket private.
|
|
- `retention_policy.retention_period` is in seconds and stops objects being deleted before then. A lifecycle `Delete` rule with `age` in days removes them after. Retaining for 30 days and then deleting needs both.
|
|
- Versioning and a retention policy cannot be used on the same bucket.
|
|
- Customer-managed encryption is `encryption.default_kms_key_name`; the Cloud Storage service agent needs `roles/cloudkms.cryptoKeyEncrypterDecrypter` on the key first.
|
|
- `force_destroy = false` stops Terraform deleting a bucket that holds objects.
|
|
|
|
```hcl
|
|
variable "project_id" {
|
|
type = string
|
|
description = "Project to deploy into."
|
|
}
|
|
|
|
variable "region" {
|
|
type = string
|
|
description = "Region for regional resources."
|
|
}
|
|
|
|
resource "google_service_account" "writer" {
|
|
project = var.project_id
|
|
account_id = "raw-events-writer"
|
|
display_name = "Writes raw events"
|
|
}
|
|
|
|
resource "google_storage_bucket" "raw_events" {
|
|
project = var.project_id
|
|
name = "${var.project_id}-raw-events"
|
|
location = var.region
|
|
storage_class = "STANDARD"
|
|
uniform_bucket_level_access = true
|
|
public_access_prevention = "enforced"
|
|
force_destroy = false
|
|
|
|
retention_policy {
|
|
retention_period = 2592000
|
|
}
|
|
|
|
lifecycle_rule {
|
|
condition {
|
|
age = 31
|
|
}
|
|
action {
|
|
type = "Delete"
|
|
}
|
|
}
|
|
|
|
lifecycle_rule {
|
|
condition {
|
|
age = 7
|
|
}
|
|
action {
|
|
type = "SetStorageClass"
|
|
storage_class = "NEARLINE"
|
|
}
|
|
}
|
|
}
|
|
|
|
resource "google_storage_bucket_iam_member" "writer_creates_objects" {
|
|
bucket = google_storage_bucket.raw_events.name
|
|
role = "roles/storage.objectCreator"
|
|
member = google_service_account.writer.member
|
|
}
|
|
```
|