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>
69 lines
2.1 KiB
Markdown
69 lines
2.1 KiB
Markdown
# Cloud Storage bucket
|
|
|
|
One bucket with its retention, lifecycle rules, encryption and grants. Use the module when the bucket has several of those; a plain bucket is one resource and is written directly.
|
|
|
|
- The module turns on uniform bucket-level access (`bucket_policy_only`) and `public_access_prevention = "enforced"` unless told otherwise.
|
|
- `retention_policy.retention_period` is in seconds. `is_locked = true` cannot be undone, and the bucket cannot then be deleted until every object has aged out: take it from a variable.
|
|
- `lifecycle_rules` takes `action` and `condition` as maps; condition values that are lists are given as comma-separated strings.
|
|
- `encryption.default_kms_key_name` needs the Cloud Storage service agent to hold the encrypter/decrypter role on the key first.
|
|
- `iam_members` grants on the bucket only, with `_iam_member`, so grants made elsewhere are kept.
|
|
|
|
```hcl
|
|
variable "project_id" {
|
|
type = string
|
|
description = "Project to deploy into."
|
|
}
|
|
|
|
variable "region" {
|
|
type = string
|
|
description = "Region for regional resources."
|
|
}
|
|
|
|
variable "lock_retention" {
|
|
type = bool
|
|
description = "Whether the retention policy is locked. Locking cannot be undone."
|
|
default = false
|
|
}
|
|
|
|
variable "reader_service_account_email" {
|
|
type = string
|
|
description = "Service account that reads the archive."
|
|
}
|
|
|
|
module "archive" {
|
|
source = "terraform-google-modules/cloud-storage/google//modules/simple_bucket"
|
|
version = "12.4.1"
|
|
|
|
project_id = var.project_id
|
|
name = "${var.project_id}-archive"
|
|
location = var.region
|
|
storage_class = "STANDARD"
|
|
versioning = true
|
|
force_destroy = false
|
|
|
|
retention_policy = {
|
|
is_locked = var.lock_retention
|
|
retention_period = 220752000
|
|
}
|
|
|
|
lifecycle_rules = [
|
|
{
|
|
action = {
|
|
type = "SetStorageClass"
|
|
storage_class = "ARCHIVE"
|
|
}
|
|
condition = {
|
|
age = 365
|
|
}
|
|
}
|
|
]
|
|
|
|
iam_members = [
|
|
{
|
|
role = "roles/storage.objectViewer"
|
|
member = "serviceAccount:${var.reader_service_account_email}"
|
|
}
|
|
]
|
|
}
|
|
```
|