Documentation
¶
Index ¶
- Constants
- func ApplyDefaults(cfg *Config, root string)
- func ComposeIdentifier(prefix, base, suffix string) string
- func ConfigCandidates(root string) []string
- func DefaultCredentialsMount(customer, credentialSet string) string
- func DockerComposeCandidates(root string) []string
- func DockerfileCandidates(root string) []string
- func ExpandHome(path string) string
- func Validate(cfg Config) error
- type AWSConfig
- type AppleContainerConfig
- type Config
- type DockerConfig
- type EditorConfig
- type SSHConfig
- type TerraformConfig
- type ToolsConfig
Constants ¶
const ( DistributionTerraform = "terraform" DistributionOpenTofu = "opentofu" )
The two CLI flavours terraform.distribution accepts. OpenTofu ships its own release line, so it also gets its own version field.
const ( PresetMinimal = "minimal" PresetStandard = "standard" PresetFull = "full" )
Tool presets bundle the container tooling into a few honest choices.
const ( DirName = ".devvault" ConfigFileName = "config.yaml" LegacyConfig = ".devvault.yaml" )
Variables ¶
This section is empty.
Functions ¶
func ApplyDefaults ¶
func ComposeIdentifier ¶ added in v0.2.0
ComposeIdentifier joins prefix, base and suffix and shortens base so the result always satisfies identifierPattern. base is expected to be sanitized already; if it is not, Validate rejects it on its own field first.
func ConfigCandidates ¶
func DefaultCredentialsMount ¶ added in v0.2.0
DefaultCredentialsMount is the host directory a project mounts as its AWS config when nothing else is configured: one directory per customer and credential set. The generated compose file mounts this path and projectcontext.LoadTrustedConfig derives the trusted mount from the same layout, so both sides have to use this function.
func DockerComposeCandidates ¶
func DockerfileCandidates ¶
func ExpandHome ¶
Types ¶
type AppleContainerConfig ¶
type AppleContainerConfig struct {
ImageName string `yaml:"image_name"`
ContainerName string `yaml:"container_name"`
// PluginCacheName names the same shared Terraform provider cache for the
// Apple container backend — but as a directory below the user's devvault
// home, not as a `container` volume: a named volume there is created empty
// and owned by root, so the container's non-root user cannot write into it.
// The backend creates the directory and bind-mounts it.
PluginCacheName string `yaml:"plugin_cache_name"`
}
type Config ¶
type Config struct {
Backend string `yaml:"backend"`
Project string `yaml:"project"`
Customer string `yaml:"customer"`
Terraform TerraformConfig `yaml:"terraform"`
Tools ToolsConfig `yaml:"tools"`
AWS AWSConfig `yaml:"aws"`
Docker DockerConfig `yaml:"docker"`
AppleContainer AppleContainerConfig `yaml:"apple_container"`
Editor EditorConfig `yaml:"editor"`
SSH SSHConfig `yaml:"ssh"`
}
func DefaultWithPreset ¶ added in v0.2.0
DefaultWithPreset builds the default config for root with the tool switches of the given preset. An empty preset means PresetStandard; an unknown preset keeps the standard tool set but is preserved in Tools.Preset so Validate can still report the offending value.
func (Config) TerraformBinary ¶ added in v0.2.0
TerraformBinary returns the CLI name of the configured Terraform distribution: "terraform" or "tofu".
func (Config) TerraformVersionForDistribution ¶ added in v0.2.0
TerraformVersionForDistribution returns the version that belongs to the configured distribution. Everything that pins the CLI for a container build has to go through this, otherwise an OpenTofu project would be built with a Terraform version number that does not exist upstream.
type DockerConfig ¶
type DockerConfig struct {
ImageName string `yaml:"image_name"`
ContainerName string `yaml:"container_name"`
Platform string `yaml:"platform"`
// PluginCacheVolume names the docker volume holding the shared Terraform
// provider cache. The generated compose file declares it and mounts it at
// /home/vscode/.terraform.d/plugin-cache.
PluginCacheVolume string `yaml:"plugin_cache_volume"`
}
type EditorConfig ¶
type SSHConfig ¶ added in v0.2.0
type SSHConfig struct {
// ForwardAgent controls whether the host SSH agent socket is offered to
// the container.
ForwardAgent bool `yaml:"forward_agent"`
}
type TerraformConfig ¶
type TerraformConfig struct {
Version string `yaml:"version"`
// OpenTofuVersion pins the OpenTofu release. It is only used when
// Distribution is "opentofu"; OpenTofu's version numbers are unrelated to
// Terraform's, so the two must never share a field.
OpenTofuVersion string `yaml:"opentofu_version"`
// Distribution selects the CLI flavour: "terraform" or "opentofu".
Distribution string `yaml:"distribution"`
}
type ToolsConfig ¶
type ToolsConfig struct {
TFLint string `yaml:"tflint"`
TerraformDocs string `yaml:"terraform_docs"`
// The remaining version fields pin the tools the generated Dockerfile
// downloads. Every download is verified against the checksum file of the
// pinned release, so a version bump and a checksum re-verification are the
// same change.
TrivyVersion string `yaml:"trivy_version"`
OPAVersion string `yaml:"opa_version"`
CheckovVersion string `yaml:"checkov_version"`
PrecommitVersion string `yaml:"precommit_version"`
GitleaksVersion string `yaml:"gitleaks_version"`
ConftestVersion string `yaml:"conftest_version"`
InfracostVersion string `yaml:"infracost_version"`
Preset string `yaml:"preset"`
// The switches below decide what a project actually gets. They fall into
// two groups, and the group decides where a tool lives:
//
// Container tools are installed into the generated image, and only when
// their switch is true: Trivy, Checkov, Gitleaks, Conftest, OPA,
// Precommit, Graphviz, Age, Infracost. A false switch means the binary is
// not in the image, so the commands that call it say so instead of
// failing with "not found".
//
// Host tools are never installed by devvault — they authenticate the user
// or talk to the user's own keyring, so what lands on the host is the
// user's decision. Their switch turns them into an optional
// `devvault doctor` check: AWSCLI, SOPS, GPG, SessionManagerPlugin.
//
// The Terraform distribution, tflint and terraform-docs have no switch on
// purpose: they are what the container exists for and are always installed.
AWSCLI bool `yaml:"awscli"`
Trivy bool `yaml:"trivy"`
Checkov bool `yaml:"checkov"`
Infracost bool `yaml:"infracost"`
Gitleaks bool `yaml:"gitleaks"`
Precommit bool `yaml:"precommit"`
Graphviz bool `yaml:"graphviz"`
OPA bool `yaml:"opa"`
Conftest bool `yaml:"conftest"`
Age bool `yaml:"age"`
SessionManagerPlugin bool `yaml:"session_manager_plugin"`
SOPS bool `yaml:"sops"`
GPG bool `yaml:"gpg"`
}
func (ToolsConfig) NeedsPip ¶ added in v0.2.0
func (t ToolsConfig) NeedsPip() bool
NeedsPip reports whether the generated image has to install pip at all. Both Python tools are optional, so a project that enables neither gets no pip and no Python packages in its image.