terraform-infra-common

module
v1.33.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 22, 2026 License: Apache-2.0

README

terraform-infra-common

Static Badge

A collection of common infrastructure modules that encapsulate Cloud Run and GCP patterns.

Modules

See MODULES.md for a summary of all available modules.

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))
    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.

Directories

Path Synopsis
cmd
replayer command
modules
github-bots/sdk
Package sdk provides a framework for building GitHub bots that receive and handle GitHub webhook events delivered as CloudEvents.
Package sdk provides a framework for building GitHub bots that receive and handle GitHub webhook events delivered as CloudEvents.
github-bots/sdk/check
Package check provides utilities for creating and updating GitHub Check Runs.
Package check provides utilities for creating and updating GitHub Check Runs.
github-bots/sdk/octosts
Package octosts provides utilities for working with OctoSTS bot users.
Package octosts provides utilities for working with OctoSTS bot users.
github-events/internal/schemagen
Package schemagen provides utilities for generating BigQuery JSON schema files from Go types.
Package schemagen provides utilities for generating BigQuery JSON schema files from Go types.
github-events/internal/secrets
Package secrets provides utilities for loading webhook secrets from the environment.
Package secrets provides utilities for loading webhook secrets from the environment.
github-events/internal/trampoline
Package trampoline implements an HTTP server that receives GitHub webhook events, validates their signatures, and forwards them as CloudEvents to a broker ingress.
Package trampoline implements an HTTP server that receives GitHub webhook events, validates their signatures, and forwards them as CloudEvents to a broker ingress.
github-events/schemas
Package schemas defines Go types for GitHub webhook event payloads as stored in BigQuery.
Package schemas defines Go types for GitHub webhook event payloads as stored in BigQuery.
linear-events/internal/secrets
Package secrets provides utilities for loading webhook secrets from the environment.
Package secrets provides utilities for loading webhook secrets from the environment.
linear-events/internal/trampoline
Package trampoline implements an HTTP server that receives Linear webhook events, validates their signatures, and forwards them as CloudEvents to a broker ingress.
Package trampoline implements an HTTP server that receives Linear webhook events, validates their signatures, and forwards them as CloudEvents to a broker ingress.
zendesk-events/internal/redact
Package redact scrubs customer-identifying information from a Zendesk webhook body before the trampoline forwards it as a CloudEvent — so nothing identifying lands in the broker, GCS, or BigQuery.
Package redact scrubs customer-identifying information from a Zendesk webhook body before the trampoline forwards it as a CloudEvent — so nothing identifying lands in the broker, GCS, or BigQuery.
zendesk-events/internal/secrets
Package secrets provides utilities for loading webhook secrets from the environment.
Package secrets provides utilities for loading webhook secrets from the environment.
zendesk-events/internal/trampoline
Package trampoline implements an HTTP server that receives Zendesk webhook events (from Zendesk event subscriptions), validates their signatures, and forwards them as CloudEvents to a broker ingress.
Package trampoline implements an HTTP server that receives Zendesk webhook events (from Zendesk event subscriptions), validates their signatures, and forwards them as CloudEvents to a broker ingress.
cron/example module
pkg
gitexec
Package gitexec wraps local git invocations so every operation emits one structured clog line and updates a small set of Prometheus metrics.
Package gitexec wraps local git invocations so every operation emits one structured clog line and updates a small set of Prometheus metrics.
gitexec/gogit
Package gogit is a thin observability shim over go-git: a drop-in for the subset of github.com/go-git/go-git/v5 that performs network I/O, so callers keep writing ordinary go-git and every clone, fetch, and push is recorded through gitexec without per-call instrumentation.
Package gogit is a thin observability shim over go-git: a drop-in for the subset of github.com/go-git/go-git/v5 that performs network I/O, so callers keep writing ordinary go-git and every clone, fetch, and push is recorded through gitexec without per-call instrumentation.
httpmetrics
Package httpmetrics provides HTTP middleware and transport wrappers that instrument requests with Prometheus metrics, OpenTelemetry tracing, and structured logging for Cloud Run services.
Package httpmetrics provides HTTP middleware and transport wrappers that instrument requests with Prometheus metrics, OpenTelemetry tracing, and structured logging for Cloud Run services.
httpmetrics/cloudevents
Package cloudevents provides helpers for creating CloudEvents HTTP clients and targets that are instrumented with httpmetrics middleware.
Package cloudevents provides helpers for creating CloudEvents HTTP clients and targets that are instrumented with httpmetrics middleware.
prober
Package prober provides a framework for implementing Chainguard probers that expose an HTTP endpoint for health checking.
Package prober provides a framework for implementing Chainguard probers that expose an HTTP endpoint for health checking.
profiler
Package profiler provides helpers for enabling Google Cloud Profiler in Cloud Run services.
Package profiler provides helpers for enabling Google Cloud Profiler in Cloud Run services.
pubsub
Package pubsub provides helpers for converting CloudEvents to and from Google Cloud Pub/Sub messages.
Package pubsub provides helpers for converting CloudEvents to and from Google Cloud Pub/Sub messages.
rotate
Package rotate provides utilities for uploading and rotating log files to cloud blob storage.
Package rotate provides utilities for uploading and rotating log files to cloud blob storage.
valkey
Package valkey connects to Memorystore for Valkey instances created by the terraform valkey module.
Package valkey connects to Memorystore for Valkey instances created by the terraform valkey module.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL