diff --git a/.gitignore b/.gitignore index 27e151c..0bc118a 100644 --- a/.gitignore +++ b/.gitignore @@ -23,4 +23,5 @@ terraform.tfsta* crash.log .terraform -test_output \ No newline at end of file +test_output +schema-generator \ No newline at end of file diff --git a/Makefile b/Makefile index ed46b2a..3eea0b5 100644 --- a/Makefile +++ b/Makefile @@ -6,6 +6,10 @@ init: configure: build set-local go generate ./... +.PHONY: schema +schema: + go generate ./minikube/schema_cluster.go + .PHONY: clean clean: rm bin/* || true diff --git a/generate/main.go b/generate/main.go new file mode 100644 index 0000000..22834b0 --- /dev/null +++ b/generate/main.go @@ -0,0 +1,26 @@ +package main + +import ( + "flag" + "fmt" + + "terraform-provider-minikube/m/v2/minikube/generator" +) + +func main() { + targetFile := flag.String("target", "schema_cluster.go", "a string") + flag.Parse() + + fmt.Println(*targetFile) + schemaBuilder := generator.NewSchemaBuilder(*targetFile, &generator.MinikubeHostBinary{}) + schema, err := schemaBuilder.Build() + if err != nil { + panic(err) + } + + err = schemaBuilder.Write(schema) + if err != nil { + panic(err) + } + +} diff --git a/minikube/generator/mock_minikube_binary.go b/minikube/generator/mock_minikube_binary.go new file mode 100644 index 0000000..1942308 --- /dev/null +++ b/minikube/generator/mock_minikube_binary.go @@ -0,0 +1,65 @@ +// Code generated by MockGen. DO NOT EDIT. +// Source: schema_builder.go + +// Package generator is a generated GoMock package. +package generator + +import ( + context "context" + reflect "reflect" + + gomock "github.com/golang/mock/gomock" +) + +// MockMinikubeBinary is a mock of MinikubeBinary interface. +type MockMinikubeBinary struct { + ctrl *gomock.Controller + recorder *MockMinikubeBinaryMockRecorder +} + +// MockMinikubeBinaryMockRecorder is the mock recorder for MockMinikubeBinary. +type MockMinikubeBinaryMockRecorder struct { + mock *MockMinikubeBinary +} + +// NewMockMinikubeBinary creates a new mock instance. +func NewMockMinikubeBinary(ctrl *gomock.Controller) *MockMinikubeBinary { + mock := &MockMinikubeBinary{ctrl: ctrl} + mock.recorder = &MockMinikubeBinaryMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockMinikubeBinary) EXPECT() *MockMinikubeBinaryMockRecorder { + return m.recorder +} + +// GetStartHelpText mocks base method. +func (m *MockMinikubeBinary) GetStartHelpText(ctx context.Context) (string, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetStartHelpText", ctx) + ret0, _ := ret[0].(string) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetStartHelpText indicates an expected call of GetStartHelpText. +func (mr *MockMinikubeBinaryMockRecorder) GetStartHelpText(ctx interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetStartHelpText", reflect.TypeOf((*MockMinikubeBinary)(nil).GetStartHelpText), ctx) +} + +// GetVersion mocks base method. +func (m *MockMinikubeBinary) GetVersion(ctx context.Context) (string, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetVersion", ctx) + ret0, _ := ret[0].(string) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetVersion indicates an expected call of GetVersion. +func (mr *MockMinikubeBinaryMockRecorder) GetVersion(ctx interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetVersion", reflect.TypeOf((*MockMinikubeBinary)(nil).GetVersion), ctx) +} diff --git a/minikube/generator/schema_builder.go b/minikube/generator/schema_builder.go new file mode 100644 index 0000000..3444fc4 --- /dev/null +++ b/minikube/generator/schema_builder.go @@ -0,0 +1,338 @@ +//go:generate go run github.com/golang/mock/mockgen -source=$GOFILE -destination=mock_minikube_binary.go -package=$GOPACKAGE +package generator + +import ( + "bufio" + "context" + "errors" + "fmt" + "log" + "os" + "os/exec" + "strconv" + "strings" + "time" +) + +type MinikubeBinary interface { + GetVersion(ctx context.Context) (string, error) + GetStartHelpText(ctx context.Context) (string, error) +} + +type MinikubeHostBinary struct { +} + +func (m *MinikubeHostBinary) GetVersion(ctx context.Context) (string, error) { + return run(ctx, "version") +} + +func (m *MinikubeHostBinary) GetStartHelpText(ctx context.Context) (string, error) { + return run(ctx, "start", "--help") +} + +var computedFields []string = []string{ + "addons", + "apiserver_ips", + "apiserver_names", + "hyperkit_vsock_ports", + "insecure_registry", + "iso_url", + "nfs_share", + "ports", + "registry_mirror", + "client_key", + "client_certificate", + "cluster_ca_certificate", + "host", +} + +type SchemaOverride struct { + Description string + Default string + Type SchemaType +} + +var schemaOverrides map[string]SchemaOverride = map[string]SchemaOverride{ + "memory": { + Default: "4000mb", + Description: "Amount of RAM to allocate to Kubernetes (format: [], where unit = b, k, m or g)", + Type: String, + }, + "cpus": { + Default: "2", + Description: "Amount of CPUs to allocate to Kubernetes", + Type: Int, + }, +} + +func run(ctx context.Context, args ...string) (string, error) { + cmd := exec.CommandContext(ctx, "minikube", args...) + out, err := cmd.Output() + if err != nil { + return "", err + } + + return string(out), nil +} + +type SchemaEntry struct { + Parameter string + Default string + Description string + Type SchemaType + ArrayType SchemaType +} + +type SchemaBuilder struct { + targetFile string + minikube MinikubeBinary +} + +type SchemaType string + +const ( + String SchemaType = "String" + Int SchemaType = "Int" + Bool SchemaType = "Bool" + Array SchemaType = "List" +) + +func NewSchemaBuilder(targetFile string, minikube MinikubeBinary) *SchemaBuilder { + return &SchemaBuilder{targetFile: targetFile, minikube: minikube} +} + +func (s *SchemaBuilder) Build() (string, error) { + minikubeVersion, err := s.minikube.GetVersion(context.Background()) + if err != nil { + return "", errors.New("could not run minikube binary. please ensure that you have minikube installed and available") + } + + log.Printf("building schema for minikube version: %s", minikubeVersion) + + help, err := s.minikube.GetStartHelpText(context.Background()) + if err != nil { + return "", err + } + + scanner := bufio.NewScanner(strings.NewReader(help)) + + entries := make([]SchemaEntry, 0) + var currentParameter string + var currentType SchemaType + var currentDefault string + var currentDescription string + + for scanner.Scan() { + line := scanner.Text() + line = strings.TrimSpace(line) + + switch { + case strings.HasPrefix(line, "--"): + currentDescription = "" + seg := strings.Split(line, "=") + currentParameter = strings.TrimPrefix(seg[0], "--") + currentParameter = strings.Replace(currentParameter, "-", "_", -1) + currentDefault = strings.TrimSuffix(seg[1], ":") + currentType = getSchemaType(currentDefault) + + val, ok := schemaOverrides[currentParameter] + if ok { + currentDefault = val.Default + currentType = val.Type + } + + if currentType == String { + currentDefault = strings.Trim(currentDefault, "'") + } + + default: + if line != "" { + currentDescription += line + break + } + + if currentParameter == "" { + break + } + + currentDescription = strings.ReplaceAll(currentDescription, "\\", "\\\\") + currentDescription = strings.ReplaceAll(currentDescription, "\"", "\\\"") + + val, ok := schemaOverrides[currentParameter] + if ok { + currentDescription = val.Description + } + + switch currentType { + case String: + entries = append(entries, SchemaEntry{ + Parameter: currentParameter, + Default: fmt.Sprintf("\"%s\"", currentDefault), + Type: currentType, + Description: currentDescription, + }) + case Bool: + entries = append(entries, SchemaEntry{ + Parameter: currentParameter, + Default: currentDefault, + Type: currentType, + Description: currentDescription, + }) + case Int: + val, err := strconv.Atoi(currentDefault) + if err != nil { + // is it a timestamp? + time, err := time.ParseDuration(currentDefault) + if err != nil { + return "", err + } + val = int(time.Minutes()) + currentDescription = fmt.Sprintf("%s (Configured in minutes)", currentDescription) + } + entries = append(entries, SchemaEntry{ + Parameter: currentParameter, + Default: strconv.Itoa(val), + Type: currentType, + Description: currentDescription, + }) + case Array: + entries = append(entries, SchemaEntry{ + Parameter: currentParameter, + Type: Array, + ArrayType: String, + Description: currentDescription, + }) + } + + currentParameter = "" + } + } + + schema := constructSchema(entries) + + return schema, err +} + +func (s *SchemaBuilder) Write(schema string) error { + return os.WriteFile(s.targetFile, []byte(schema), 0644) +} + +func constructSchema(entries []SchemaEntry) string { + + header := `//go:generate go run ../generate/main.go -target $GOFILE +// THIS FILE IS GENERATED DO NOT EDIT +package minikube + +import "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + +var ( + clusterSchema = map[string]*schema.Schema{ + "cluster_name": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + Description: "The name of the minikube cluster", + Default: "terraform-provider-minikube", + }, + + "nodes": { + Type: schema.TypeInt, + Optional: true, + ForceNew: true, + Description: "Amount of nodes in the cluster", + Default: 1, + }, + + "client_key": { + Type: schema.TypeString, + Computed: true, + Description: "client key for cluster", + Sensitive: true, + }, + + "client_certificate": { + Type: schema.TypeString, + Computed: true, + Description: "client certificate used in cluster", + Sensitive: true, + }, + + "cluster_ca_certificate": { + Type: schema.TypeString, + Computed: true, + Description: "certificate authority for cluster", + Sensitive: true, + }, + + "host": { + Type: schema.TypeString, + Computed: true, + Description: "the host name for the cluster", + }, +` + + body := "" + for _, entry := range entries { + extraParams := "" + if !contains(computedFields, entry.Parameter) { + extraParams = ` + Optional: true, + ForceNew: true, + ` + } else { + extraParams = ` + Computed: true, + ` + } + + if entry.Type == Array { + extraParams += fmt.Sprintf(` + Elem: &schema.Schema{ + Type: %s, + }, + `, "schema.Type"+entry.ArrayType) + } else { + extraParams += fmt.Sprintf(` + Default: %s,`, entry.Default) + } + + body = body + fmt.Sprintf(` + "%s": { + Type: %s, + Description: "%s", + %s + }, + `, entry.Parameter, "schema.Type"+entry.Type, entry.Description, extraParams) + } + + footer := ` + } +) + +func GetClusterSchema() map[string]*schema.Schema { + return clusterSchema +} + ` + + return header + body + footer +} + +func getSchemaType(s string) SchemaType { + if strings.Count(s, "'") == 2 || s == "" { + return String + } else if s == "true" || s == "false" { + return Bool + } else if strings.HasPrefix(s, "[") && strings.HasSuffix(s, "]") { + return Array + } + return Int +} + +func contains(s []string, e string) bool { + for _, a := range s { + if a == e { + return true + } + } + return false +} diff --git a/minikube/generator/schema_builder_test.go b/minikube/generator/schema_builder_test.go new file mode 100644 index 0000000..cdca9cb --- /dev/null +++ b/minikube/generator/schema_builder_test.go @@ -0,0 +1,336 @@ +package generator + +import ( + "errors" + "testing" + + gomock "github.com/golang/mock/gomock" + "github.com/stretchr/testify/assert" +) + +const header = `//go:generate go run ../generate/main.go -target $GOFILE +// THIS FILE IS GENERATED DO NOT EDIT +package minikube + +import "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + +var ( + clusterSchema = map[string]*schema.Schema{ + "cluster_name": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + Description: "The name of the minikube cluster", + Default: "terraform-provider-minikube", + }, + + "nodes": { + Type: schema.TypeInt, + Optional: true, + ForceNew: true, + Description: "Amount of nodes in the cluster", + Default: 1, + }, + + "client_key": { + Type: schema.TypeString, + Computed: true, + Description: "client key for cluster", + Sensitive: true, + }, + + "client_certificate": { + Type: schema.TypeString, + Computed: true, + Description: "client certificate used in cluster", + Sensitive: true, + }, + + "cluster_ca_certificate": { + Type: schema.TypeString, + Computed: true, + Description: "certificate authority for cluster", + Sensitive: true, + }, + + "host": { + Type: schema.TypeString, + Computed: true, + Description: "the host name for the cluster", + }, +` + +func TestStringProperty(t *testing.T) { + ctrl := gomock.NewController(t) + mockMinikube := NewMockMinikubeBinary(ctrl) + mockMinikube.EXPECT().GetVersion(gomock.Any()).Return("Version 999", nil) + mockMinikube.EXPECT().GetStartHelpText(gomock.Any()).Return(` +--test='test-value': + I am a great test description + +--test2='test-value2': + I am a great test2 description + `, nil) + builder := NewSchemaBuilder("fake.go", mockMinikube) + schema, err := builder.Build() + assert.NoError(t, err) + assert.Equal(t, header+` + "test": { + Type: schema.TypeString, + Description: "I am a great test description", + + Optional: true, + ForceNew: true, + + Default: "test-value", + }, + + "test2": { + Type: schema.TypeString, + Description: "I am a great test2 description", + + Optional: true, + ForceNew: true, + + Default: "test-value2", + }, + + } +) + +func GetClusterSchema() map[string]*schema.Schema { + return clusterSchema +} + `, schema) +} + +func TestIntProperty(t *testing.T) { + ctrl := gomock.NewController(t) + mockMinikube := NewMockMinikubeBinary(ctrl) + mockMinikube.EXPECT().GetVersion(gomock.Any()).Return("Version 999", nil) + mockMinikube.EXPECT().GetStartHelpText(gomock.Any()).Return(` +--test=123: + I am a great test description + + `, nil) + builder := NewSchemaBuilder("fake.go", mockMinikube) + schema, err := builder.Build() + assert.NoError(t, err) + assert.Equal(t, header+` + "test": { + Type: schema.TypeInt, + Description: "I am a great test description", + + Optional: true, + ForceNew: true, + + Default: 123, + }, + + } +) + +func GetClusterSchema() map[string]*schema.Schema { + return clusterSchema +} + `, schema) +} + +func TestTimeProperty(t *testing.T) { + ctrl := gomock.NewController(t) + mockMinikube := NewMockMinikubeBinary(ctrl) + mockMinikube.EXPECT().GetVersion(gomock.Any()).Return("Version 999", nil) + mockMinikube.EXPECT().GetStartHelpText(gomock.Any()).Return(` +--test=6m0s: + I am a great test description + + `, nil) + builder := NewSchemaBuilder("fake.go", mockMinikube) + schema, err := builder.Build() + assert.NoError(t, err) + assert.Equal(t, header+` + "test": { + Type: schema.TypeInt, + Description: "I am a great test description (Configured in minutes)", + + Optional: true, + ForceNew: true, + + Default: 6, + }, + + } +) + +func GetClusterSchema() map[string]*schema.Schema { + return clusterSchema +} + `, schema) +} + +func TestBoolProperty(t *testing.T) { + ctrl := gomock.NewController(t) + mockMinikube := NewMockMinikubeBinary(ctrl) + mockMinikube.EXPECT().GetVersion(gomock.Any()).Return("Version 999", nil) + mockMinikube.EXPECT().GetStartHelpText(gomock.Any()).Return(` +--test=true: + I am a great test description + + `, nil) + builder := NewSchemaBuilder("fake.go", mockMinikube) + schema, err := builder.Build() + assert.NoError(t, err) + assert.Equal(t, header+` + "test": { + Type: schema.TypeBool, + Description: "I am a great test description", + + Optional: true, + ForceNew: true, + + Default: true, + }, + + } +) + +func GetClusterSchema() map[string]*schema.Schema { + return clusterSchema +} + `, schema) +} + +func TestArrayProperty(t *testing.T) { + ctrl := gomock.NewController(t) + mockMinikube := NewMockMinikubeBinary(ctrl) + mockMinikube.EXPECT().GetVersion(gomock.Any()).Return("Version 999", nil) + mockMinikube.EXPECT().GetStartHelpText(gomock.Any()).Return(` +--test=[]: + I am a great test description + + `, nil) + builder := NewSchemaBuilder("fake.go", mockMinikube) + schema, err := builder.Build() + assert.NoError(t, err) + assert.Equal(t, header+` + "test": { + Type: schema.TypeList, + Description: "I am a great test description", + + Optional: true, + ForceNew: true, + + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + + }, + + } +) + +func GetClusterSchema() map[string]*schema.Schema { + return clusterSchema +} + `, schema) +} + +func TestOutputProperty(t *testing.T) { + ctrl := gomock.NewController(t) + mockMinikube := NewMockMinikubeBinary(ctrl) + mockMinikube.EXPECT().GetVersion(gomock.Any()).Return("Version 999", nil) + mockMinikube.EXPECT().GetStartHelpText(gomock.Any()).Return(` +--host=123: + I am a great test description + + `, nil) + builder := NewSchemaBuilder("fake.go", mockMinikube) + schema, err := builder.Build() + assert.NoError(t, err) + assert.Equal(t, header+` + "host": { + Type: schema.TypeInt, + Description: "I am a great test description", + + Computed: true, + + Default: 123, + }, + + } +) + +func GetClusterSchema() map[string]*schema.Schema { + return clusterSchema +} + `, schema) +} + +func TestOverride(t *testing.T) { + ctrl := gomock.NewController(t) + mockMinikube := NewMockMinikubeBinary(ctrl) + mockMinikube.EXPECT().GetVersion(gomock.Any()).Return("Version 999", nil) + mockMinikube.EXPECT().GetStartHelpText(gomock.Any()).Return(` +--memory='': + I am a great test description + + `, nil) + builder := NewSchemaBuilder("fake.go", mockMinikube) + schema, err := builder.Build() + assert.NoError(t, err) + assert.Equal(t, header+` + "memory": { + Type: schema.TypeString, + Description: "Amount of RAM to allocate to Kubernetes (format: [], where unit = b, k, m or g)", + + Optional: true, + ForceNew: true, + + Default: "4000mb", + }, + + } +) + +func GetClusterSchema() map[string]*schema.Schema { + return clusterSchema +} + `, schema) +} + +func TestPropertyFailure(t *testing.T) { + ctrl := gomock.NewController(t) + mockMinikube := NewMockMinikubeBinary(ctrl) + mockMinikube.EXPECT().GetVersion(gomock.Any()).Return("Version 999", nil) + mockMinikube.EXPECT().GetStartHelpText(gomock.Any()).Return(` +--test=asdfasdf: + I am a great test description + + `, nil) + builder := NewSchemaBuilder("fake.go", mockMinikube) + _, err := builder.Build() + assert.Error(t, err) +} + +func TestNullDefault(t *testing.T) { + ctrl := gomock.NewController(t) + mockMinikube := NewMockMinikubeBinary(ctrl) + mockMinikube.EXPECT().GetVersion(gomock.Any()).Return("Version 999", nil) + mockMinikube.EXPECT().GetStartHelpText(gomock.Any()).Return(` +--test=: + I am a great test description + + `, nil) + builder := NewSchemaBuilder("fake.go", mockMinikube) + _, err := builder.Build() + assert.NoError(t, err) +} + +func TestMinikubeNotFound(t *testing.T) { + ctrl := gomock.NewController(t) + mockMinikube := NewMockMinikubeBinary(ctrl) + mockMinikube.EXPECT().GetVersion(gomock.Any()).Return("", errors.New("could not find minikube binary")) + builder := NewSchemaBuilder("fake.go", mockMinikube) + _, err := builder.Build() + assert.Error(t, err) +} diff --git a/minikube/resource_cluster.go b/minikube/resource_cluster.go index 6b0e902..a4d0ddf 100644 --- a/minikube/resource_cluster.go +++ b/minikube/resource_cluster.go @@ -13,6 +13,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "k8s.io/minikube/pkg/minikube/config" "k8s.io/minikube/pkg/minikube/kubeconfig" + pkgutil "k8s.io/minikube/pkg/util" ) var ( @@ -125,7 +126,7 @@ func setClusterState(d *schema.ResourceData, config *config.ClusterConfig, ports d.Set("cpus", config.CPUs) d.Set("cri_socket", config.KubernetesConfig.CRISocket) d.Set("disable_driver_mounts", config.DisableDriverMounts) - d.Set("disk_size", config.DiskSize) + d.Set("disk_size", strconv.Itoa(config.DiskSize)+"mb") d.Set("dns_domain", config.KubernetesConfig.DNSDomain) d.Set("dns_proxy", config.DNSProxy) d.Set("driver", config.Driver) @@ -150,7 +151,7 @@ func setClusterState(d *schema.ResourceData, config *config.ClusterConfig, ports d.Set("kvm_numa_count", config.KVMNUMACount) d.Set("kvm_qemu_uri", config.KVMQemuURI) d.Set("listen_address", config.ListenAddress) - d.Set("memory", config.Memory) + d.Set("memory", strconv.Itoa(config.Memory)+"mb") d.Set("mount", config.Mount) d.Set("mount_string", config.MountString) d.Set("namespace", config.KubernetesConfig.Namespace) @@ -226,6 +227,18 @@ func initialiseMinikubeClient(d *schema.ResourceData, m interface{}) (service.Cl ports = []string{} } + memoryStr := d.Get("memory").(string) + memoryMb, err := pkgutil.CalculateSizeInMB(memoryStr) + if err != nil { + return nil, err + } + + diskStr := d.Get("disk_size").(string) + diskMb, err := pkgutil.CalculateSizeInMB(diskStr) + if err != nil { + return nil, err + } + k8sVersion := clusterClient.GetK8sVersion() kubernetesConfig := config.KubernetesConfig{ KubernetesVersion: k8sVersion, @@ -262,9 +275,9 @@ func initialiseMinikubeClient(d *schema.ResourceData, m interface{}) (service.Cl MinikubeISO: state_utils.ReadSliceState(defaultIsos)[0], KicBaseImage: d.Get("base_image").(string), Network: d.Get("network").(string), - Memory: d.Get("memory").(int), + Memory: memoryMb, CPUs: d.Get("cpus").(int), - DiskSize: d.Get("disk_size").(int), + DiskSize: diskMb, Driver: d.Get("driver").(string), ListenAddress: d.Get("listen_address").(string), HyperkitVpnKitSock: d.Get("hyperkit_vpnkit_sock").(string), diff --git a/minikube/resource_cluster_test.go b/minikube/resource_cluster_test.go index bf61a71..edc05a6 100644 --- a/minikube/resource_cluster_test.go +++ b/minikube/resource_cluster_test.go @@ -124,7 +124,7 @@ func mockSuccess(t *testing.T, clusterName string) schema.ConfigureContextFunc { MinikubeISO: defaultIso, KicBaseImage: clusterSchema["base_image"].Default.(string), Network: clusterSchema["network"].Default.(string), - Memory: 6000, + Memory: 4000, CPUs: 2, DiskSize: 20000, Driver: "some_driver", diff --git a/minikube/schema_cluster.go b/minikube/schema_cluster.go index d4d0c6a..5fd5d34 100644 --- a/minikube/schema_cluster.go +++ b/minikube/schema_cluster.go @@ -1,3 +1,5 @@ +//go:generate go run ../generate/main.go -target $GOFILE +// THIS FILE IS GENERATED DO NOT EDIT package minikube import "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" @@ -5,582 +7,1012 @@ import "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" var ( clusterSchema = map[string]*schema.Schema{ "cluster_name": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + Description: "The name of the minikube cluster", + Default: "terraform-provider-minikube", + }, + + "nodes": { + Type: schema.TypeInt, + Optional: true, + ForceNew: true, + Description: "Amount of nodes in the cluster", + Default: 1, + }, + + "client_key": { Type: schema.TypeString, - Optional: true, - ForceNew: true, - Description: "The name of the minikube cluster", - Default: "terraform-provider-minikube", + Computed: true, + Description: "client key for cluster", + Sensitive: true, }, - "addons": { - Type: schema.TypeList, - Elem: &schema.Schema{ - Type: schema.TypeString, - }, - Optional: true, + "client_certificate": { + Type: schema.TypeString, Computed: true, - ForceNew: true, - Description: "Enable addons. see `minikube addons list` for a list of valid addon names.", + Description: "client certificate used in cluster", + Sensitive: true, }, - "apiserver_ips": { - Type: schema.TypeList, - Elem: &schema.Schema{ - Type: schema.TypeString, - }, + "cluster_ca_certificate": { + Type: schema.TypeString, Computed: true, - Optional: true, - ForceNew: true, - Description: "A set of apiserver IP Addresses which are used in the generated certificate for kubernetes. This can be used if you want to make the apiserver available from outside the machine", + Description: "certificate authority for cluster", + Sensitive: true, }, - "apiserver_name": { + "host": { Type: schema.TypeString, - Optional: true, - ForceNew: true, - Description: "The authoritative apiserver hostname for apiserver certificates and connectivity. This can be used if you want to make the apiserver available from outside the machine", - Default: "minikubeCA", + Computed: true, + Description: "the host name for the cluster", }, + "addons": { + Type: schema.TypeList, + Description: "Enable addons. see `minikube addons list` for a list of valid addon names.", + + Computed: true, + + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + + }, + + "apiserver_ips": { + Type: schema.TypeList, + Description: "A set of apiserver IP Addresses which are used in the generated certificate for kubernetes. This can be used if you want to make the apiserver available from outside the machine", + + Computed: true, + + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + + }, + + "apiserver_name": { + Type: schema.TypeString, + Description: "The authoritative apiserver hostname for apiserver certificates and connectivity. This can be used if you want to make the apiserver available from outside the machine", + + Optional: true, + ForceNew: true, + + Default: "minikubeCA", + }, + "apiserver_names": { - Type: schema.TypeList, + Type: schema.TypeList, + Description: "A set of apiserver names which are used in the generated certificate for kubernetes. This can be used if you want to make the apiserver available from outside the machine", + + Computed: true, + Elem: &schema.Schema{ - Type: schema.TypeString, - Default: "minikubeCA", + Type: schema.TypeString, }, - Optional: true, - Computed: true, - ForceNew: true, - Description: "A set of apiserver names which are used in the generated certificate for kubernetes. This can be used if you want to make the apiserver available from outside the machine", + }, - + "apiserver_port": { - Type: schema.TypeInt, - Optional: true, - ForceNew: true, - Description: "The apiserver listening port", - Default: 8443, - }, - + Type: schema.TypeInt, + Description: "The apiserver listening port", + + Optional: true, + ForceNew: true, + + Default: 8443, + }, + + "auto_update_drivers": { + Type: schema.TypeBool, + Description: "If set, automatically updates drivers to the latest version. Defaults to true.", + + Optional: true, + ForceNew: true, + + Default: true, + }, + "base_image": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, - Description: "The base image to use for docker/podman drivers. Intended for local development.", - Default: "gcr.io/k8s-minikube/kicbase:v0.0.33@sha256:73b259e144d926189cf169ae5b46bbec4e08e4e2f2bd87296054c3244f70feb8", - }, - + Type: schema.TypeString, + Description: "The base image to use for docker/podman drivers. Intended for local development.", + + Optional: true, + ForceNew: true, + + Default: "gcr.io/k8s-minikube/kicbase:v0.0.35@sha256:e6f9b2700841634f3b94907f9cfa6785ca4409ef8e428a0322c1781e809d311b", + }, + + "binary_mirror": { + Type: schema.TypeString, + Description: "Location to fetch kubectl, kubelet, & kubeadm binaries from.", + + Optional: true, + ForceNew: true, + + Default: "", + }, + "cache_images": { - Type: schema.TypeBool, - Optional: true, - ForceNew: true, - Description: "If true, cache docker images for the current bootstrapper and load them into the machine. Always false with --driver=none.", - Default: true, - }, - + Type: schema.TypeBool, + Description: "If true, cache docker images for the current bootstrapper and load them into the machine. Always false with --driver=none.", + + Optional: true, + ForceNew: true, + + Default: true, + }, + "cert_expiration": { - Type: schema.TypeInt, - Optional: true, - ForceNew: true, - Description: "Duration (in hours) until minikube certificate expiration, defaults to three years (26280h).", - Default: 26280, - }, - + Type: schema.TypeInt, + Description: "Duration until minikube certificate expiration, defaults to three years (26280h). (Configured in minutes)", + + Optional: true, + ForceNew: true, + + Default: 1576800, + }, + "cni": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, - Description: "CNI plug-in to use. Valid options auto, bridge, calico, cilium, flannel, kindnet, or path to a CNI manifest (default auto)", - Default: "", - }, - + Type: schema.TypeString, + Description: "CNI plug-in to use. Valid options: auto, bridge, calico, cilium, flannel, kindnet, or path to a CNI manifest (default: auto)", + + Optional: true, + ForceNew: true, + + Default: "", + }, + "container_runtime": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, - Description: "The container runtime to be used (docker, cri-o, containerd).", - Default: "docker", - }, - + Type: schema.TypeString, + Description: "The container runtime to be used. Valid options: docker, cri-o, containerd (default: auto)", + + Optional: true, + ForceNew: true, + + Default: "", + }, + "cpus": { - Type: schema.TypeInt, - Optional: true, - ForceNew: true, - Description: "Number of CPUs allocated to Kubernetes. Use \"max\"to use the maximum number of CPUs.", - Default: 2, - }, - + Type: schema.TypeInt, + Description: "Amount of CPUs to allocate to Kubernetes", + + Optional: true, + ForceNew: true, + + Default: 2, + }, + "cri_socket": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, - Description: "The cri socket path to be used.", - Default: "", - }, - + Type: schema.TypeString, + Description: "The cri socket path to be used.", + + Optional: true, + ForceNew: true, + + Default: "", + }, + "delete_on_failure": { - Type: schema.TypeBool, - Optional: true, - ForceNew: true, - Description: "If set, delete the current cluster if start fails and try again. Defaults to false.", - Default: false, - }, - + Type: schema.TypeBool, + Description: "If set, delete the current cluster if start fails and try again. Defaults to false.", + + Optional: true, + ForceNew: true, + + Default: false, + }, + "disable_driver_mounts": { - Type: schema.TypeBool, - Optional: true, - ForceNew: true, - Description: "Disables the filesystem mounts provided by the hypervisors", - Default: false, - }, - + Type: schema.TypeBool, + Description: "Disables the filesystem mounts provided by the hypervisors", + + Optional: true, + ForceNew: true, + + Default: false, + }, + + "disable_metrics": { + Type: schema.TypeBool, + Description: "If set, disables metrics reporting (CPU and memory usage), this can improve CPU usage. Defaults to false.", + + Optional: true, + ForceNew: true, + + Default: false, + }, + + "disable_optimizations": { + Type: schema.TypeBool, + Description: "If set, disables optimizations that are set for local Kubernetes. Including decreasing CoreDNS replicas from 2 to 1. Defaults to false.", + + Optional: true, + ForceNew: true, + + Default: false, + }, + "disk_size": { - Type: schema.TypeInt, - Optional: true, - ForceNew: true, - Description: "Disk size allocated to the minikube VM in mb", - Default: 20000, - }, - + Type: schema.TypeString, + Description: "Disk size allocated to the minikube VM (format: [], where unit = b, k, m or g).", + + Optional: true, + ForceNew: true, + + Default: "20000mb", + }, + "dns_domain": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, - Description: "The cluster dns domain name used in the Kubernetes cluster", - Default: "cluster.local", - }, - + Type: schema.TypeString, + Description: "The cluster dns domain name used in the Kubernetes cluster", + + Optional: true, + ForceNew: true, + + Default: "cluster.local", + }, + "dns_proxy": { - Type: schema.TypeBool, - Optional: true, - ForceNew: true, - Description: "Enable proxy for NAT DNS requests (virtualbox driver only)", - Default: false, - }, - + Type: schema.TypeBool, + Description: "Enable proxy for NAT DNS requests (virtualbox driver only)", + + Optional: true, + ForceNew: true, + + Default: false, + }, + + "docker_env": { + Type: schema.TypeList, + Description: "Environment variables to pass to the Docker daemon. (format: key=value)", + + Optional: true, + ForceNew: true, + + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + + }, + + "docker_opt": { + Type: schema.TypeList, + Description: "Specify arbitrary flags to pass to the Docker daemon. (format: key=value)", + + Optional: true, + ForceNew: true, + + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + + }, + + "download_only": { + Type: schema.TypeBool, + Description: "If true, only download and cache files for later use - don't install or start anything.", + + Optional: true, + ForceNew: true, + + Default: false, + }, + "driver": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, - Description: "Driver is one of virtualbox, parallels, vmwarefusion, hyperkit, vmware, docker, podman (experimental), ssh (defaults to auto-detect)", - Default: "docker", - }, - + Type: schema.TypeString, + Description: "Driver is one of: virtualbox, parallels, vmwarefusion, hyperkit, vmware, qemu2 (experimental), docker, podman (experimental), ssh (defaults to auto-detect)", + + Optional: true, + ForceNew: true, + + Default: "", + }, + + "dry_run": { + Type: schema.TypeBool, + Description: "dry-run mode. Validates configuration, but does not mutate system state", + + Optional: true, + ForceNew: true, + + Default: false, + }, + "embed_certs": { - Type: schema.TypeBool, - Optional: true, - ForceNew: true, - Description: "if true, will embed the certs in kubeconfig.", - Default: false, - }, - + Type: schema.TypeBool, + Description: "if true, will embed the certs in kubeconfig.", + + Optional: true, + ForceNew: true, + + Default: false, + }, + + "enable_default_cni": { + Type: schema.TypeBool, + Description: "DEPRECATED: Replaced by --cni=bridge", + + Optional: true, + ForceNew: true, + + Default: false, + }, + "extra_config": { - Type: schema.TypeMap, - Optional: true, - ForceNew: true, - Description: "A set of key=value pairs that describe configuration that may be passed to different components.", - Default: "", - }, - + Type: schema.TypeString, + Description: "A set of key=value pairs that describe configuration that may be passed to different components. The key should be '.' separated, and the first part before the dot is the component to apply the configuration to. Valid components are: kubelet, kubeadm, apiserver, controller-manager, etcd, proxy, scheduler Valid kubeadm parameters: ignore-preflight-errors, dry-run, kubeconfig, kubeconfig-dir, node-name, cri-socket, experimental-upload-certs, certificate-key, rootfs, skip-phases, pod-network-cidr", + + Optional: true, + ForceNew: true, + + Default: "", + }, + "extra_disks": { - Type: schema.TypeInt, - Optional: true, - ForceNew: true, - Description: "Number of extra disks created and attached to the minikube VM (currently only implemented for hyperkit and kvm2 drivers)", - Default: 0, - }, - + Type: schema.TypeInt, + Description: "Number of extra disks created and attached to the minikube VM (currently only implemented for hyperkit and kvm2 drivers)", + + Optional: true, + ForceNew: true, + + Default: 0, + }, + "feature_gates": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, - Description: "A set of key=value pairs that describe feature gates for alpha/experimental features.", - Default: "", - }, - + Type: schema.TypeString, + Description: "A set of key=value pairs that describe feature gates for alpha/experimental features.", + + Optional: true, + ForceNew: true, + + Default: "", + }, + "force": { - Type: schema.TypeBool, - Optional: true, - ForceNew: true, - Description: "Force minikube to perform possibly dangerous operations", - Default: false, - }, - + Type: schema.TypeBool, + Description: "Force minikube to perform possibly dangerous operations", + + Optional: true, + ForceNew: true, + + Default: false, + }, + + "force_systemd": { + Type: schema.TypeBool, + Description: "If set, force the container runtime to use systemd as cgroup manager. Defaults to false.", + + Optional: true, + ForceNew: true, + + Default: false, + }, + "host_dns_resolver": { - Type: schema.TypeBool, - Optional: true, - ForceNew: true, - Description: "Enable host resolver for NAT DNS requests (virtualbox driver only)", - Default: true, - }, - + Type: schema.TypeBool, + Description: "Enable host resolver for NAT DNS requests (virtualbox driver only)", + + Optional: true, + ForceNew: true, + + Default: true, + }, + "host_only_cidr": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, - Description: "The CIDR to be used for the minikube VM (virtualbox driver only)", - Default: "192.168.59.1/24", - }, - + Type: schema.TypeString, + Description: "The CIDR to be used for the minikube VM (virtualbox driver only)", + + Optional: true, + ForceNew: true, + + Default: "192.168.59.1/24", + }, + "host_only_nic_type": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, - Description: "NIC Type used for host only network. One of Am79C970A, Am79C973, 82540EM, 82543GC, 82545EM, or virtio (virtualbox driver only)", - Default: "virtio", - }, - + Type: schema.TypeString, + Description: "NIC Type used for host only network. One of Am79C970A, Am79C973, 82540EM, 82543GC, 82545EM, or virtio (virtualbox driver only)", + + Optional: true, + ForceNew: true, + + Default: "virtio", + }, + "hyperkit_vpnkit_sock": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, - Description: "Location of the VPNKit socket used for networking. If empty, disables Hyperkit VPNKitSock, if 'auto' uses Docker for Mac VPNKit connection, otherwise uses the specified VSock (hyperkit driver only)", - Default: "", - }, - + Type: schema.TypeString, + Description: "Location of the VPNKit socket used for networking. If empty, disables Hyperkit VPNKitSock, if 'auto' uses Docker for Mac VPNKit connection, otherwise uses the specified VSock (hyperkit driver only)", + + Optional: true, + ForceNew: true, + + Default: "", + }, + "hyperkit_vsock_ports": { - Type: schema.TypeList, + Type: schema.TypeList, + Description: "List of guest VSock ports that should be exposed as sockets on the host (hyperkit driver only)", + + Computed: true, + Elem: &schema.Schema{ - Type: schema.TypeInt, + Type: schema.TypeString, }, - Optional: true, - Computed: true, - ForceNew: true, - Description: "List of guest VSock ports that should be exposed as sockets on the host (hyperkit driver only)", + }, - + "hyperv_external_adapter": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, - Description: "External Adapter on which external switch will be created if no external switch is found. (hyperv driver only)", - Default: "", - }, - + Type: schema.TypeString, + Description: "External Adapter on which external switch will be created if no external switch is found. (hyperv driver only)", + + Optional: true, + ForceNew: true, + + Default: "", + }, + "hyperv_use_external_switch": { - Type: schema.TypeBool, - Optional: true, - ForceNew: true, - Description: "Whether to use external switch over Default Switch if virtual switch not explicitly specified. (hyperv driver only)", - Default: false, - }, - + Type: schema.TypeBool, + Description: "Whether to use external switch over Default Switch if virtual switch not explicitly specified. (hyperv driver only)", + + Optional: true, + ForceNew: true, + + Default: false, + }, + "hyperv_virtual_switch": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, - Description: "The hyperv virtual switch name. Defaults to first found. (hyperv driver only)", - Default: "", - }, - + Type: schema.TypeString, + Description: "The hyperv virtual switch name. Defaults to first found. (hyperv driver only)", + + Optional: true, + ForceNew: true, + + Default: "", + }, + "image_mirror_country": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, - Description: "Country code of the image mirror to be used. Leave empty to use the global one. For Chinese mainland users, set it to cn.", - Default: "", - }, - + Type: schema.TypeString, + Description: "Country code of the image mirror to be used. Leave empty to use the global one. For Chinese mainland users, set it to cn.", + + Optional: true, + ForceNew: true, + + Default: "", + }, + "image_repository": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, - Description: "Alternative image repository to pull docker images from. This can be used when you have limited access to gcr.io. Set it to \"auto\"to let minikube decide one for you. For Chinese mainland users, you may use local gcr.io mirrors such as registry.cn-hangzhou.aliyuncs.com/google_containers", - Default: "", - }, - + Type: schema.TypeString, + Description: "Alternative image repository to pull docker images from. This can be used when you have limited access to gcr.io. Set it to \"auto\" to let minikube decide one for you. For Chinese mainland users, you may use local gcr.io mirrors such as registry.cn-hangzhou.aliyuncs.com/google_containers", + + Optional: true, + ForceNew: true, + + Default: "", + }, + "insecure_registry": { - Type: schema.TypeList, + Type: schema.TypeList, + Description: "Insecure Docker registries to pass to the Docker daemon. The default service CIDR range will automatically be added.", + + Computed: true, + Elem: &schema.Schema{ - Type: schema.TypeString, + Type: schema.TypeString, }, - Computed: true, - Optional: true, - ForceNew: true, - Description: "Insecure Docker registries to pass to the Docker daemon. The default service CIDR range will automatically be added.", - }, - + + }, + + "install_addons": { + Type: schema.TypeBool, + Description: "If set, install addons. Defaults to true.", + + Optional: true, + ForceNew: true, + + Default: true, + }, + + "interactive": { + Type: schema.TypeBool, + Description: "Allow user prompts for more information", + + Optional: true, + ForceNew: true, + + Default: true, + }, + "iso_url": { - Type: schema.TypeList, + Type: schema.TypeList, + Description: "Locations to fetch the minikube ISO from.", + + Computed: true, + Elem: &schema.Schema{ - Type: schema.TypeString, + Type: schema.TypeString, }, - Computed: true, - Optional: true, - ForceNew: true, - Description: "Locations to fetch the minikube ISO from.", + }, - + "keep_context": { - Type: schema.TypeBool, - Optional: true, - ForceNew: true, - Description: "This will keep the existing kubectl context and will create a minikube context.", - Default: false, - }, - + Type: schema.TypeBool, + Description: "This will keep the existing kubectl context and will create a minikube context.", + + Optional: true, + ForceNew: true, + + Default: false, + }, + + "kubernetes_version": { + Type: schema.TypeString, + Description: "The Kubernetes version that the minikube VM will use (ex: v1.2.3, 'stable' for v1.25.2, 'latest' for v1.25.2). Defaults to 'stable'.", + + Optional: true, + ForceNew: true, + + Default: "", + }, + "kvm_gpu": { - Type: schema.TypeBool, - Optional: true, - ForceNew: true, - Description: "Enable experimental NVIDIA GPU support in minikube", - Default: false, - }, - + Type: schema.TypeBool, + Description: "Enable experimental NVIDIA GPU support in minikube", + + Optional: true, + ForceNew: true, + + Default: false, + }, + "kvm_hidden": { - Type: schema.TypeBool, - Optional: true, - ForceNew: true, - Description: "Hide the hypervisor signature from the guest in minikube (kvm2 driver only)", - Default: false, - }, - + Type: schema.TypeBool, + Description: "Hide the hypervisor signature from the guest in minikube (kvm2 driver only)", + + Optional: true, + ForceNew: true, + + Default: false, + }, + "kvm_network": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, - Description: "The KVM default network name. (kvm2 driver only)", - Default: "default", - }, - + Type: schema.TypeString, + Description: "The KVM default network name. (kvm2 driver only)", + + Optional: true, + ForceNew: true, + + Default: "default", + }, + "kvm_numa_count": { - Type: schema.TypeInt, - Optional: true, - ForceNew: true, - Description: "Simulate numa node count in minikube, supported numa node count range is 1-8 (kvm2 driver only)", - Default: 1, - }, - + Type: schema.TypeInt, + Description: "Simulate numa node count in minikube, supported numa node count range is 1-8 (kvm2 driver only)", + + Optional: true, + ForceNew: true, + + Default: 1, + }, + "kvm_qemu_uri": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, - Description: "The KVM QEMU connection URI. (kvm2 driver only)", - Default: "qemu:///system", - }, - + Type: schema.TypeString, + Description: "The KVM QEMU connection URI. (kvm2 driver only)", + + Optional: true, + ForceNew: true, + + Default: "qemu:///system", + }, + "listen_address": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, - Description: "IP Address to use to expose ports (docker and podman driver only)", - Default: "", - }, - + Type: schema.TypeString, + Description: "IP Address to use to expose ports (docker and podman driver only)", + + Optional: true, + ForceNew: true, + + Default: "", + }, + "memory": { - Type: schema.TypeInt, - Optional: true, - ForceNew: true, - Description: "Amount of RAM to allocate to Kubernetes in mb", - Default: 6000, - }, - + Type: schema.TypeString, + Description: "Amount of RAM to allocate to Kubernetes (format: [], where unit = b, k, m or g)", + + Optional: true, + ForceNew: true, + + Default: "4000mb", + }, + "mount": { - Type: schema.TypeBool, - Optional: true, - ForceNew: true, - Description: "This will start the mount daemon and automatically mount files into minikube.", - Default: false, - }, - + Type: schema.TypeBool, + Description: "This will start the mount daemon and automatically mount files into minikube.", + + Optional: true, + ForceNew: true, + + Default: false, + }, + + "mount_9p_version": { + Type: schema.TypeString, + Description: "Specify the 9p version that the mount should use", + + Optional: true, + ForceNew: true, + + Default: "9p2000.L", + }, + + "mount_gid": { + Type: schema.TypeString, + Description: "Default group id used for the mount", + + Optional: true, + ForceNew: true, + + Default: "docker", + }, + + "mount_ip": { + Type: schema.TypeString, + Description: "Specify the ip that the mount should be setup on", + + Optional: true, + ForceNew: true, + + Default: "", + }, + + "mount_msize": { + Type: schema.TypeInt, + Description: "The number of bytes to use for 9p packet payload", + + Optional: true, + ForceNew: true, + + Default: 262144, + }, + + "mount_options": { + Type: schema.TypeList, + Description: "Additional mount options, such as cache=fscache", + + Optional: true, + ForceNew: true, + + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + + }, + + "mount_port": { + Type: schema.TypeInt, + Description: "Specify the port that the mount should be setup on, where 0 means any free port.", + + Optional: true, + ForceNew: true, + + Default: 0, + }, + "mount_string": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, - Description: "/minikube-host' The argument to pass the minikube mount command on start.", - Default: "/Users", - }, - + Type: schema.TypeString, + Description: "The argument to pass the minikube mount command on start.", + + Optional: true, + ForceNew: true, + + Default: "/Users:/minikube-host", + }, + + "mount_type": { + Type: schema.TypeString, + Description: "Specify the mount filesystem type (supported types: 9p)", + + Optional: true, + ForceNew: true, + + Default: "9p", + }, + + "mount_uid": { + Type: schema.TypeString, + Description: "Default user id used for the mount", + + Optional: true, + ForceNew: true, + + Default: "docker", + }, + "namespace": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, - Description: "The named space to activate after start", - Default: "default", - }, - + Type: schema.TypeString, + Description: "The named space to activate after start", + + Optional: true, + ForceNew: true, + + Default: "default", + }, + "nat_nic_type": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, - Description: "NIC Type used for nat network. One of Am79C970A, Am79C973, 82540EM, 82543GC, 82545EM, or virtio (virtualbox driver only)", - Default: "virtio", - }, - + Type: schema.TypeString, + Description: "NIC Type used for nat network. One of Am79C970A, Am79C973, 82540EM, 82543GC, 82545EM, or virtio (virtualbox driver only)", + + Optional: true, + ForceNew: true, + + Default: "virtio", + }, + + "native_ssh": { + Type: schema.TypeBool, + Description: "Use native Golang SSH client (default true). Set to 'false' to use the command line 'ssh' command when accessing the docker machine. Useful for the machine drivers when they will not start with 'Waiting for SSH'.", + + Optional: true, + ForceNew: true, + + Default: true, + }, + "network": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, - Description: "network to run minikube with. Now it is used by docker/podman and KVM drivers. If left empty, minikube will create a new network.", - Default: "", - }, - + Type: schema.TypeString, + Description: "network to run minikube with. Now it is used by docker/podman and KVM drivers. If left empty, minikube will create a new network.", + + Optional: true, + ForceNew: true, + + Default: "", + }, + "network_plugin": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, - Description: "Kubelet network plug-in to use (default auto)", - Default: "", - }, - + Type: schema.TypeString, + Description: "DEPRECATED: Replaced by --cni", + + Optional: true, + ForceNew: true, + + Default: "", + }, + "nfs_share": { - Type: schema.TypeList, + Type: schema.TypeList, + Description: "Local folders to share with Guest via NFS mounts (hyperkit driver only)", + + Computed: true, + Elem: &schema.Schema{ - Type: schema.TypeString, + Type: schema.TypeString, }, - Optional: true, - Computed: true, - ForceNew: true, - Description: "Local folders to share with Guest via NFS mounts (hyperkit driver only)", + }, - + "nfs_shares_root": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, - Description: "Where to root the NFS Shares, defaults to /nfsshares (hyperkit driver only)", - Default: "/nfsshares", - }, - + Type: schema.TypeString, + Description: "Where to root the NFS Shares, defaults to /nfsshares (hyperkit driver only)", + + Optional: true, + ForceNew: true, + + Default: "/nfsshares", + }, + + "no_kubernetes": { + Type: schema.TypeBool, + Description: "If set, minikube VM/container will start without starting or configuring Kubernetes. (only works on new clusters)", + + Optional: true, + ForceNew: true, + + Default: false, + }, + "no_vtx_check": { - Type: schema.TypeBool, - Optional: true, - ForceNew: true, - Description: "Disable checking for the availability of hardware virtualization before the vm is started (virtualbox driver only)", - Default: false, - }, - - "nodes": { - Type: schema.TypeInt, - Optional: true, - ForceNew: true, - Description: "The number of nodes to spin up. Defaults to 1.", - Default: 1, - }, - + Type: schema.TypeBool, + Description: "Disable checking for the availability of hardware virtualization before the vm is started (virtualbox driver only)", + + Optional: true, + ForceNew: true, + + Default: false, + }, + "ports": { - Type: schema.TypeList, + Type: schema.TypeList, + Description: "List of ports that should be exposed (docker and podman driver only)", + + Computed: true, + Elem: &schema.Schema{ - Type: schema.TypeInt, + Type: schema.TypeString, }, - Optional: true, - Computed: true, - ForceNew: true, - Description: "List of ports that should be exposed (docker and podman driver only)", - }, - + + }, + + "preload": { + Type: schema.TypeBool, + Description: "If set, download tarball of preloaded images if available to improve start time. Defaults to true.", + + Optional: true, + ForceNew: true, + + Default: true, + }, + + "qemu_firmware_path": { + Type: schema.TypeString, + Description: "Path to the qemu firmware file. Defaults: For Linux, the default firmware location. For macOS, the brew installation location. For Windows, C:\\Program Files\\qemu\\share", + + Optional: true, + ForceNew: true, + + Default: "", + }, + "registry_mirror": { - Type: schema.TypeList, + Type: schema.TypeList, + Description: "Registry mirrors to pass to the Docker daemon", + + Computed: true, + Elem: &schema.Schema{ - Type: schema.TypeString, + Type: schema.TypeString, }, - Optional: true, - Computed: true, - ForceNew: true, - Description: "Registry mirrors to pass to the Docker daemon", + }, - + "service_cluster_ip_range": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, - Description: "The CIDR to be used for service cluster IPs.", - Default: "10.96.0.0/12", - }, - + Type: schema.TypeString, + Description: "The CIDR to be used for service cluster IPs.", + + Optional: true, + ForceNew: true, + + Default: "10.96.0.0/12", + }, + + "socket_vmnet_client_path": { + Type: schema.TypeString, + Description: "Path to the socket vmnet client binary", + + Optional: true, + ForceNew: true, + + Default: "/opt/socket_vmnet/bin/socket_vmnet_client", + }, + + "socket_vmnet_path": { + Type: schema.TypeString, + Description: "Path to socket vmnet binary", + + Optional: true, + ForceNew: true, + + Default: "/var/run/socket_vmnet", + }, + "ssh_ip_address": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, - Description: "IP address (ssh driver only)", - Default: "", - }, - + Type: schema.TypeString, + Description: "IP address (ssh driver only)", + + Optional: true, + ForceNew: true, + + Default: "", + }, + "ssh_key": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, - Description: "SSH key (ssh driver only)", - Default: "", - }, - + Type: schema.TypeString, + Description: "SSH key (ssh driver only)", + + Optional: true, + ForceNew: true, + + Default: "", + }, + "ssh_port": { - Type: schema.TypeInt, - Optional: true, - ForceNew: true, - Description: "SSH port (ssh driver only)", - Default: 22, - }, - + Type: schema.TypeInt, + Description: "SSH port (ssh driver only)", + + Optional: true, + ForceNew: true, + + Default: 22, + }, + "ssh_user": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, - Description: "SSH user (ssh driver only)", - Default: "root", - }, - + Type: schema.TypeString, + Description: "SSH user (ssh driver only)", + + Optional: true, + ForceNew: true, + + Default: "root", + }, + + "subnet": { + Type: schema.TypeString, + Description: "Subnet to be used on kic cluster. If left empty, minikube will choose subnet address, beginning from 192.168.49.0. (docker and podman driver only)", + + Optional: true, + ForceNew: true, + + Default: "", + }, + + "trace": { + Type: schema.TypeString, + Description: "Send trace events. Options include: [gcp]", + + Optional: true, + ForceNew: true, + + Default: "", + }, + "uuid": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, - Description: "Provide VM UUID to restore MAC address (hyperkit driver only)", - Default: "", - }, - - "wait_timeout": { - Type: schema.TypeInt, - Optional: true, - ForceNew: true, - Description: "max time (in seconds) to wait per Kubernetes or host to be healthy.", - Default: 600, - }, - + Type: schema.TypeString, + Description: "Provide VM UUID to restore MAC address (hyperkit driver only)", + + Optional: true, + ForceNew: true, + + Default: "", + }, + "vm": { - Type: schema.TypeBool, - Optional: true, - ForceNew: true, - Description: "Filter to use only VM Drivers", - Default: false, - }, - + Type: schema.TypeBool, + Description: "Filter to use only VM Drivers", + + Optional: true, + ForceNew: true, + + Default: false, + }, + "vm_driver": { - Type: schema.TypeString, - Optional: true, - ForceNew: true, - Description: "DEPRECATED, use `driver` instead.", - Default: "", - }, - - "client_key": { - Type: schema.TypeString, - Computed: true, - Description: "client key for cluster", - Sensitive: true, - }, - - "client_certificate": { - Type: schema.TypeString, - Computed: true, - Description: "client certificate used in cluster", - Sensitive: true, - }, - - "cluster_ca_certificate": { - Type: schema.TypeString, - Computed: true, - Description: "certificate authority for cluster", - Sensitive: true, - }, - - "host": { - Type: schema.TypeString, - Computed: true, - Description: "the host name for the cluster", + Type: schema.TypeString, + Description: "DEPRECATED, use `driver` instead.", + + Optional: true, + ForceNew: true, + + Default: "", + }, + + "wait": { + Type: schema.TypeList, + Description: "comma separated list of Kubernetes components to verify and wait for after starting a cluster. defaults to \"apiserver,system_pods\", available options: \"apiserver,system_pods,default_sa,apps_running,node_ready,kubelet\" . other acceptable values are 'all' or 'none', 'true' and 'false'", + + Optional: true, + ForceNew: true, + + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + + "wait_timeout": { + Type: schema.TypeInt, + Description: "max time to wait per Kubernetes or host to be healthy. (Configured in minutes)", + + Optional: true, + ForceNew: true, + + Default: 6, + }, + } ) func GetClusterSchema() map[string]*schema.Schema { return clusterSchema } + \ No newline at end of file