bootstrap

package
v1.15.0 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2026 License: MPL-2.0 Imports: 12 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package bootstrap writes the configuration that gives repository pipelines access to a cloud account: an OIDC trust, and for each repository a read-only identity for plans and an identity for applies that only the default branch can use.

Index

Constants

View Source
const (
	PlatformGitHub = "github"
	PlatformGitLab = "gitlab"
)

Platforms whose OIDC tokens the generated configuration trusts.

Variables

This section is empty.

Functions

func Write

func Write(dir string, files []File, force bool) error

Write saves files into dir. It refuses to replace existing files unless force is set.

Types

type AWSOptions

type AWSOptions struct {
	Platform  string
	GitLabURL string // For GitLab: the instance's URL. Defaults to https://gitlab.com.
	Region    string
	Branch    string // The branch that applies run from.
	// Repositories get plan and apply roles that can only do what their apply policies say.
	Repositories []Repository
	// Admin is the repository that holds this configuration. Its apply role can manage the OIDC
	// provider and the other repositories' roles. Nil leaves that to a workstation.
	Admin *Repository
	// PassphraseParameter is where the state passphrase's backup is kept in SSM Parameter Store.
	PassphraseParameter string
}

AWSOptions configures the AWS configuration.

type AzureOptions

type AzureOptions struct {
	Branch       string
	Location     string
	Repositories []Repository
	// IdentityResourceGroup is created to hold the identities.
	IdentityResourceGroup string
	// ResourceGroup limits what the identities can see and change. Empty means the whole subscription.
	ResourceGroup string
	// PassphraseVaultSecret is a Key Vault secret URL holding a backup of the state passphrase.
	PassphraseVaultSecret string
}

AzureOptions configures the Azure configuration.

type File

type File struct {
	Name    string
	Content []byte
}

File is one generated file.

func AWS

func AWS(opts AWSOptions) ([]File, error)

AWS returns the files for an AWS account.

func Azure

func Azure(opts AzureOptions) ([]File, error)

Azure returns the files for an Azure subscription.

type Repository

type Repository struct {
	// Key names the identities, as <Key>-ci-plan and <Key>-ci-apply.
	Key string
	// Name is the repository's path, like owner/name.
	Name string
	// SubjectPrefix is the start of the "sub" claim in the repository's OIDC tokens.
	SubjectPrefix string
}

Repository is one repository whose pipeline gets a plan and an apply identity.

func ParseRepository

func ParseRepository(value, platform string) (Repository, error)

ParseRepository reads a repository given as owner/name, or owner/name=subject-prefix.

func (Repository) HCLKey

func (r Repository) HCLKey() string

HCLKey is the repository's key as an HCL identifier, for naming blocks.

Jump to

Keyboard shortcuts

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