infra

package
v0.0.0-...-f3ea40d Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2024 License: Apache-2.0 Imports: 29 Imported by: 0

README

Website Deployment

Website infra is built on Cloud Run with a global load balancer in-front and Cloud CDN enabled. This directory contains all the Lingon/OpenTofu code to configure the production, pre-production and PR preview environment infrastructure.

The actual deployment of the site is decoupled from the infra for convenience, it does not matter for the infrastructure which container is running inside the Cloud Run service(s). Changes to the image of the deployed Cloud Run services are ignored, could add more fields in future if needed.

Usage

# Login to GCP (fetches Application Default Credentials for use by Tofu).
gcloud auth application-default login

# Bootstrap infra, creating OIDC trust for GitHub Actions to assume a
# Google Cloud IAM service account.
go run ./cmd/bootstrap/main.go

# Deploy LB and prod and staging environments.
go run ./cmd/base/main.go

# Deploy Preview environments.
go run ./cmd/preview/main.go

THen run:


Documentation

Index

Constants

View Source
const URLMapActionType sylt.ActionType = "urlmap"

Variables

Functions

This section is empty.

Types

type BackendService

type BackendService struct {
	ID      string
	Domains []string
}

type GCSBackend

type GCSBackend struct {
	Bucket string `hcl:"bucket"`
	Prefix string `hcl:"prefix"`
}

func (*GCSBackend) BackendType

func (g *GCSBackend) BackendType() string

type GitHubOIDCOpts

type GitHubOIDCOpts struct {
	Project string
}

type HTTPSRedirect

func NewHTTPSRedirect

func NewHTTPSRedirect(
	opts LoadBalancerOpts,
	ipAddress terra.StringValue,
) *HTTPSRedirect

type LoadBalancerOpts

type LoadBalancerOpts struct {
	DefaultService string
}

type ProjectIAMMember

type ProjectIAMMember struct {
	CloudRunAdmin           *google_project_iam_member.Resource
	LBAdmin                 *google_project_iam_member.Resource
	StorageObjectUser       *google_project_iam_member.Resource
	IAMWorkloadIdentityUser *google_project_iam_member.Resource
	IAMServiceAccountUser   *google_project_iam_member.Resource
	ArtifactRegistryWriter  *google_project_iam_member.Resource
}

func NewProjectIAMMember

func NewProjectIAMMember(
	project string,
	serviceAccountEmail terra.StringValue,
) ProjectIAMMember

type Service

func NewService

func NewService(opts ServiceOpts) Service

type ServiceOpts

type ServiceOpts struct {
	Name     string
	MinScale int
	MaxScale int
}

type URLMapAction

type URLMapAction struct {
	// Unique ID of this URLMap.
	ID string
	// Google cloud project.
	Project string
	// URLMap to update.
	URLMap string
	// Backend service to map to.
	Service string
	// Host (domain) to map to the service.
	Host string
}

func (*URLMapAction) ActionName

func (a *URLMapAction) ActionName() string

func (*URLMapAction) ActionType

func (a *URLMapAction) ActionType() sylt.ActionType

func (*URLMapAction) Cleanup

func (a *URLMapAction) Cleanup(
	ctx context.Context,
	opts sylt.RunOpts,
) error

func (*URLMapAction) Run

func (a *URLMapAction) Run(ctx context.Context, opts sylt.RunOpts) error

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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