Skip to content

chainguard-dev/terraform-infra-common

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

terraform-infra-common

Static Badge

A repository containing a collection of common infrastructure modules for encapsulating common Cloud Run patterns.

Usage

To use components in this library, you must provide the project in a provider.google resource in your top-level main.tf:

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:

locals {
  default_labels = {
    basename(abspath(path.module)) = var.name
    terraform-module               = basename(abspath(path.module))
  }

  squad_label = var.squad != "" ? {
    squad = var.squad
    team  = var.squad
  } : {}

  merged_labels = merge(local.default_labels, local.squad_label, var.labels)
}

This pattern:

  • Enables cost tracking to break down each module by use
  • Maintains consistency across all infrastructure modules
  • Supports team attribution through squad/team labels
  • Allows custom labels via the labels variable
  • Provides module identification via the terraform-module label

The basename(abspath(path.module)) automatically derives the module name (e.g., "gke", "redis", "workqueue") without requiring hardcoded values.

About

A repository containing a collection of "glue" modules for encapsulating common Cloud Run patterns.

Resources

License

Security policy

Stars

Watchers

Forks

Contributors 28