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 ¶
const ( PlatformGitHub = "github" PlatformGitLab = "gitlab" )
Platforms whose OIDC tokens the generated configuration trusts.
Variables ¶
This section is empty.
Functions ¶
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 ¶
File is one generated file.
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.