https://github.com/chainguard-dev/terraform-infra-common
A repository containing a collection of "glue" modules for encapsulating common Cloud Run patterns.
https://github.com/chainguard-dev/terraform-infra-common
Last synced: 5 months ago
JSON representation
A repository containing a collection of "glue" modules for encapsulating common Cloud Run patterns.
- Host: GitHub
- URL: https://github.com/chainguard-dev/terraform-infra-common
- Owner: chainguard-dev
- License: apache-2.0
- Created: 2023-12-09T16:47:26.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2026-02-10T14:26:00.000Z (5 months ago)
- Last Synced: 2026-02-10T18:55:33.417Z (5 months ago)
- Language: Go
- Homepage: https://registry.terraform.io/modules/chainguard-dev/common/infra/latest
- Size: 16.6 MB
- Stars: 28
- Watchers: 3
- Forks: 42
- Open Issues: 22
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- jimsghstars - chainguard-dev/terraform-infra-common - A repository containing a collection of "glue" modules for encapsulating common Cloud Run patterns. (HCL)
README
# terraform-infra-common
[
](https://registry.terraform.io/modules/chainguard-dev/common/infra/latest)
A repository containing a collection of common infrastructure modules for
encapsulating common Cloud Run and GCP patterns.
## Usage
To use components in this library, you must provide the `project` in a
`provider.google` resource in your top-level main.tf:
```hcl
provider "google" {
project = var.project
}
```
## Resource Labeling Convention
All modules in this repository follow a consistent labeling pattern for GCP cost allocation and resource organization:
```hcl
locals {
default_labels = {
basename(abspath(path.module)) = var.name
terraform-module = basename(abspath(path.module))
product = var.product
team = var.team
}
merged_labels = merge(local.default_labels, var.labels)
}
```
This pattern:
- **Enables cost tracking** to break down each module by use
- **Maintains consistency** across all infrastructure modules
- **Supports team attribution** through team labels (with backward compatibility for deprecated squad)
- **Allows custom labels** via the `labels` variable
- **Provides module identification** via the `terraform-module` label
- **Sets both squad and team labels** to the same value for resource tagging
The `basename(abspath(path.module))` automatically derives the module name (e.g., "gke", "redis", "workqueue") without requiring hardcoded values.
### Team vs Squad
All modules support both `team` and `squad` variables for backward compatibility:
- Use `team` for new code (preferred)
- `squad` is deprecated but still supported
- `team` takes precedence if both are provided
- If neither is specified, both labels default to "unknown"
## Submitting Changes
These modules are canonically located within a private Chainguard repository, and are continuously pushed from there to this repository.
If you would like to submit a PR, please do make one against this repository.
After the review process, someone at Chainguard will merge it into our internal repository,
and the change will then be pushed here.