Documentation
¶
Overview ¶
Package provider implements the Hyper-V Terraform provider.
At this point only the Provider type and its schema/Configure flow are defined. Resources and data sources land in subsequent commits per docs/PLAN.md §12 M1.
Index ¶
- func New(version string) func() provider.Provider
- type HypervProvider
- func (p *HypervProvider) ConfigValidators(_ context.Context) []provider.ConfigValidator
- func (p *HypervProvider) Configure(ctx context.Context, req provider.ConfigureRequest, ...)
- func (p *HypervProvider) DataSources(_ context.Context) []func() datasource.DataSource
- func (p *HypervProvider) Metadata(_ context.Context, _ provider.MetadataRequest, resp *provider.MetadataResponse)
- func (p *HypervProvider) Resources(_ context.Context) []func() resource.Resource
- func (p *HypervProvider) Schema(_ context.Context, _ provider.SchemaRequest, resp *provider.SchemaResponse)
- type HypervProviderModel
- type LocalConfig
- type SSHConfig
- type WinRMConfig
- type WinRMKerberosConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type HypervProvider ¶
type HypervProvider struct {
// contains filtered or unexported fields
}
HypervProvider is the root provider type. Each terraform plan/apply gets its own instance via the closure returned by New.
func (*HypervProvider) ConfigValidators ¶ added in v0.2.0
func (p *HypervProvider) ConfigValidators(_ context.Context) []provider.ConfigValidator
ConfigValidators surfaces cross-attribute validators at `terraform validate` time, one step earlier than the inline checks in Configure (which only fire at plan/apply). The schema layer can't express conditional requirements ("Required when auth=kerberos") -- this is the framework's escape hatch for that.
func (*HypervProvider) Configure ¶
func (p *HypervProvider) Configure(ctx context.Context, req provider.ConfigureRequest, resp *provider.ConfigureResponse)
func (*HypervProvider) DataSources ¶
func (p *HypervProvider) DataSources(_ context.Context) []func() datasource.DataSource
func (*HypervProvider) Metadata ¶
func (p *HypervProvider) Metadata(_ context.Context, _ provider.MetadataRequest, resp *provider.MetadataResponse)
func (*HypervProvider) Resources ¶
func (p *HypervProvider) Resources(_ context.Context) []func() resource.Resource
func (*HypervProvider) Schema ¶
func (p *HypervProvider) Schema(_ context.Context, _ provider.SchemaRequest, resp *provider.SchemaResponse)
type HypervProviderModel ¶
type HypervProviderModel struct {
Backend types.String `tfsdk:"backend"`
Host types.String `tfsdk:"host"`
Port types.Int64 `tfsdk:"port"`
Username types.String `tfsdk:"username"`
Password types.String `tfsdk:"password"`
Timeout types.String `tfsdk:"timeout"`
Local *LocalConfig `tfsdk:"local"`
SSH *SSHConfig `tfsdk:"ssh"`
WinRM *WinRMConfig `tfsdk:"winrm"`
}
HypervProviderModel mirrors the provider schema. All fields are typed framework values so we can distinguish unset, explicitly-null, and configured. See docs/PLAN.md §6 for the env-var precedence rules (provider attribute > env var > zero/error).
type LocalConfig ¶
LocalConfig configures the local backend (provider runs on the Hyper-V host itself). All fields optional; env-var fallbacks apply.
type SSHConfig ¶
type SSHConfig struct {
PrivateKey types.String `tfsdk:"private_key"`
PrivateKeyPath types.String `tfsdk:"private_key_path"`
Passphrase types.String `tfsdk:"passphrase"`
KnownHostsPath types.String `tfsdk:"known_hosts_path"`
}
SSHConfig configures the SSH backend. Attribute names locked per S13; resolved into connection.SSHOptions by newSSHConnection.
type WinRMConfig ¶
type WinRMConfig struct {
UseHTTPS types.Bool `tfsdk:"use_https"`
Insecure types.Bool `tfsdk:"insecure"`
Auth types.String `tfsdk:"auth"`
CACert types.String `tfsdk:"cacert"`
Kerberos *WinRMKerberosConfig `tfsdk:"kerberos"`
}
WinRMConfig configures the WinRM backend. Schema is defined now to lock the attribute names per §13; the backend itself ships in M3.
type WinRMKerberosConfig ¶ added in v0.2.0
type WinRMKerberosConfig struct {
Realm types.String `tfsdk:"realm"`
Spn types.String `tfsdk:"spn"`
ConfigPath types.String `tfsdk:"krb5_conf_path"`
CCachePath types.String `tfsdk:"ccache_path"`
}
WinRMKerberosConfig configures the WinRM Kerberos auth path. Only meaningful when WinRMConfig.Auth == "kerberos"; ignored otherwise (a config-level validator catches mismatches at plan time, not here).
Realm is required; the others optional with sensible defaults:
- Spn defaults to "HTTP/<host>" (the standard WinRM SPN convention).
- ConfigPath defaults to KRB5_CONFIG env var, then ~/.config/krb5.conf, then /etc/krb5.conf, in that order.
- CCachePath enables ccache mode (pre-populated TGT from `kinit`). When set, the provider's top-level password is ignored. When unset, password mode is used and the provider performs an inline AS-REQ.