provideroptions

package
v1.235.0 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2026 License: Apache-2.0 Imports: 16 Imported by: 1 module, 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 provideroptions declares, registers, and resolves the typed options a configuration provider adds to `atmos terraform` commands.

A provider declares its options as static package metadata, so the host can register flags and render help without starting the plugin. Values follow the repo's flag precedence (command line, then environment); the provider's own configuration layer sits below both and is read by the provider. Only options the user set explicitly are reported, so a provider can tell an absent option from an explicit false, zero, or empty value.

Index

Constants

View Source
const (
	TypeString = "string"
	TypeBool   = "bool"
	TypeInt    = "int"
	TypeList   = "list"
	TypeMap    = "map"
)

Option value types.

View Source
const (
	ModeNative     = "native"
	ModeExecutable = "executable"
)

Modes a configuration provider section can run in.

Variables

This section is empty.

Functions

func InvocationValue

func InvocationValue(name string, option schema.ComponentProviderOption, environment map[string]string) (any, bool, error)

InvocationValue resolves environment-derived options against the invocation before RPC encoding.

func Register

func Register(root *cobra.Command, providers []Provider) error

Register adds the flags of every option to the subcommands that accept it. Registration needs no running plugin: it uses only the static declarations. A flag name that an Atmos flag or another provider already uses is rejected, so a provider can never shadow selection, scheduling, or UI flags.

func Resolve

Resolve reads the options the user set for the command, from the command line or the environment, and validates them against their declared types. Options the user did not set are absent from the result. Values of sensitive options are registered with the output masker and never appear in an error.

Types

type Option

type Option struct {
	// Name is the key under which the value reaches the provider, in snake_case.
	Name string
	// Flag is the long flag name without dashes. It defaults to `<provider>-<name with dashes>`.
	Flag string
	// Aliases are additional hidden flag names for the same option.
	Aliases []string
	Type    string
	// Default is documented in help. The provider applies it when the option is absent; the host never sends it.
	Default any
	// Config is the key under the provider's configuration section that supplies the lowest-precedence value.
	Config string
	// Env lists environment variables in addition to ATMOS_<PROVIDER>_<NAME>.
	Env []string
	// Modes lists the section modes the option applies to. Empty means every mode.
	Modes []string
	// Commands lists the `atmos terraform` subcommands that accept the option.
	Commands []string
	// Sensitive values are masked, hashed into saved-plan identities, and never logged or written to configuration.
	Sensitive bool
	// Deprecated is the message shown when the option is used. Empty means the option is current.
	Deprecated  string
	Description string
}

Option is one statically declared provider option.

func Parse

func Parse(provider string, raw any) ([]Option, error)

Parse validates the `options` metadata of a provider export. The value comes from the package manifest, so every problem names the offending option and how to repair it.

func (*Option) AppliesTo

func (o *Option) AppliesTo(mode string) bool

AppliesTo reports whether the option is valid in a section mode.

func (*Option) EnvNames

func (o *Option) EnvNames(provider string) []string

EnvNames returns the environment variables that supply the option, Atmos-prefixed name first.

func (*Option) FlagName

func (o *Option) FlagName(provider string) string

FlagName returns the primary flag name of an option for the provider.

type Provider

type Provider struct {
	// Section is the key under `components.terraform` that enabled the provider.
	Section string
	// Name is the provider name; it prefixes flag and environment variable names.
	Name string
	Mode string
	// Options are the declared options. Registration filters them by mode.
	Options []Option
}

Provider groups the options of one enabled configuration section.

type Section

type Section struct {
	Title string
	Flags *pflag.FlagSet
}

Section is a titled group of provider flags, for help output.

func SplitFlags

func SplitFlags(set *pflag.FlagSet) (*pflag.FlagSet, []Section)

SplitFlags separates provider flags from the rest, so help can show them under a provider heading.

Jump to

Keyboard shortcuts

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