This commit is contained in:
49
skills/google-cloud-iac-patterns/SKILL.md
Normal file
49
skills/google-cloud-iac-patterns/SKILL.md
Normal file
@@ -0,0 +1,49 @@
|
||||
---
|
||||
name: google-cloud-iac-patterns
|
||||
description: >-
|
||||
Terraform patterns for Google Cloud products that validate against one pinned
|
||||
version of the hashicorp/google provider: Cloud Run services and jobs,
|
||||
Pub/Sub, Cloud Storage, IAM, Secret Manager, Cloud KMS, Cloud SQL,
|
||||
networking, Cloud Scheduler, Artifact Registry, Monitoring and API
|
||||
enablement. Use when writing Terraform for a Google Cloud product, before
|
||||
writing the resource, to start from a pattern whose arguments are known to be
|
||||
in the right place.
|
||||
metadata:
|
||||
scope: deployment guidance
|
||||
provider: hashicorp/google 8.6.0
|
||||
---
|
||||
|
||||
# Google Cloud IaC patterns
|
||||
|
||||
Every pattern here passes `terraform validate` against `hashicorp/google` 8.6.0. A test runs that on each of them, so an argument you copy from a pattern is in the right block.
|
||||
|
||||
## How to use them
|
||||
|
||||
1. Write `assets/versions.tf` to your working copy as `terraform/versions.tf`, unchanged. It pins the provider version these patterns and the `terraform_schema` tool describe. Declare the `project_id` and `region` variables it uses in `terraform/variables.tf`.
|
||||
2. For each Element in the Target architecture, read the reference for its product with `load_skill_resource` and start from its pattern. Read only the references for products the Target architecture uses.
|
||||
3. Change the pattern to meet the Element's Checks. For a setting the pattern does not show, call `terraform_schema` with `find` set to its name before you write it.
|
||||
|
||||
| Product | Reference |
|
||||
| --- | --- |
|
||||
| Enabling APIs | `references/project-services.md` |
|
||||
| Service accounts and IAM grants | `references/iam.md` |
|
||||
| Cloud Run service | `references/cloud-run-service.md` |
|
||||
| Cloud Run job | `references/cloud-run-job.md` |
|
||||
| Pub/Sub | `references/pubsub.md` |
|
||||
| Cloud Storage | `references/cloud-storage.md` |
|
||||
| Secret Manager | `references/secret-manager.md` |
|
||||
| Cloud KMS | `references/kms.md` |
|
||||
| Cloud SQL | `references/cloud-sql.md` |
|
||||
| VPC networking | `references/networking.md` |
|
||||
| Cloud Scheduler | `references/cloud-scheduler.md` |
|
||||
| Artifact Registry | `references/artifact-registry.md` |
|
||||
| Cloud Monitoring and Logging | `references/monitoring.md` |
|
||||
|
||||
A product with no reference has no pattern yet: write it from `terraform_schema` and the product documentation.
|
||||
|
||||
## Rules that hold for every product
|
||||
|
||||
- A Cloud Run service and a Cloud Run job are different resource types with different arguments. A setting of one is not a setting of the other. `references/cloud-run-job.md` lists what a job lacks.
|
||||
- Grant a role with an `_iam_member` resource. An `_iam_binding` or `_iam_policy` resource removes grants made elsewhere.
|
||||
- Give a Google-managed service agent its role before the resource that needs it, with `depends_on`. A key, a dead-letter topic and a push subscription all need one.
|
||||
- Set `deletion_protection` from a variable on the resources that have it, so a test deployment can be removed.
|
||||
Reference in New Issue
Block a user