Help us shape the future of Go! Take the 2026 Go Developer Survey

provider

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2026 License: MPL-2.0 Imports: 30 Imported by: 0

Documentation

Overview

Package provider implements the Hyper-V Terraform provider.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloseActive added in v0.3.0

func CloseActive()

CloseActive closes every registered connection and resets the slice. Idempotent. main installs a signal handler that calls this on SIGINT/SIGTERM; the deferred call from main's normal-exit path is the belt-and-suspenders second invocation. The reset prevents a second drain from double-closing.

func New

func New(version string) func() provider.Provider

New returns a provider factory suitable for providerserver.Serve.

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 (*HypervProvider) DataSources

func (p *HypervProvider) DataSources(_ context.Context) []func() datasource.DataSource

func (*HypervProvider) Metadata

func (*HypervProvider) Resources

func (p *HypervProvider) Resources(_ context.Context) []func() resource.Resource

func (*HypervProvider) Schema

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"`

	// SkipAuthProbe disables the Configure-time `Get-VMHost` probe that
	// converts permission/transport failures from mid-apply mysteries into
	// plan-time diagnostics. Default false (probe runs). Set to true for
	// `terraform validate` in CI environments without a reachable host.
	SkipAuthProbe types.Bool `tfsdk:"skip_auth_probe"`

	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. Env-var precedence: provider attribute > env var > zero/error.

type LocalConfig

type LocalConfig struct {
	PwshPath types.String `tfsdk:"pwsh_path"`
}

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"`
	MaxShells types.Int64          `tfsdk:"max_shells"`
	Kerberos  *WinRMKerberosConfig `tfsdk:"kerberos"`
}

WinRMConfig configures the WinRM backend; the schema locks the attribute names ahead of the backend's own implementation.

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" (a config-level validator catches mismatches at plan time). Realm is required; Spn defaults to "HTTP/<host>"; ConfigPath falls back through KRB5_CONFIG, ~/.config/krb5.conf, then /etc/krb5.conf. Setting CCachePath opts into ccache mode (a `kinit`-populated TGT) and ignores the provider's top-level password; unset uses password mode with an inline AS-REQ.

Jump to

Keyboard shortcuts

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