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
- func InvocationValue(name string, option schema.ComponentProviderOption, ...) (any, bool, error)
- func Register(root *cobra.Command, providers []Provider) error
- func Resolve(cmd *cobra.Command, v *viper.Viper) (map[string]map[string]schema.ComponentProviderOption, error)
- type Option
- type Provider
- type Section
Constants ¶
const ( TypeString = "string" TypeBool = "bool" TypeInt = "int" TypeList = "list" TypeMap = "map" )
Option value types.
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 ¶
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 ¶
func Resolve(cmd *cobra.Command, v *viper.Viper) (map[string]map[string]schema.ComponentProviderOption, error)
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 ¶
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.
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.