diff --git a/docs/resources/virtual_cluster.md b/docs/resources/virtual_cluster.md index b92db402..3cc9091c 100644 --- a/docs/resources/virtual_cluster.md +++ b/docs/resources/virtual_cluster.md @@ -46,6 +46,29 @@ resource "spectrocloud_virtual_cluster" "cluster" { ``` +## Import + +In Terraform v1.5.0 and later, use an [`import` block](https://developer.hashicorp.com/terraform/language/import) +to import the resource spectrocloud_virtual_cluster by using its `id` with the Palette `context` separated by a colon. For example: + +```terraform +import { + to = spectrocloud_virtual_cluster.example + id = "example_id:context" +} +``` + +Using `terraform import`, import the cluster using the `cluster_name` or `id` colon separated with `context`. For example: + +```console +terraform import spectrocloud_virtual_cluster.example example_id +``` + +```console +terraform import spectrocloud_virtual_cluster.example cluster_name +``` + +Refer to the [Import section](/docs#import) to learn more. ## Schema diff --git a/spectrocloud/resource_cluster_aws.go b/spectrocloud/resource_cluster_aws.go index d33705ba..4dd1d8eb 100644 --- a/spectrocloud/resource_cluster_aws.go +++ b/spectrocloud/resource_cluster_aws.go @@ -529,9 +529,11 @@ func flattenMachinePoolConfigsAws(machinePools []*models.V1AwsMachinePoolConfig) oi["max_price"] = machinePool.SpotMarketOptions.MaxPrice } // Flatten skip_k8s_upgrade (worker pools only); default "disabled" for backward compat when API omits field + skipK8sUpgrade := "disabled" if machinePool.SkipK8sUpgrade != nil && *machinePool.SkipK8sUpgrade != "" { - oi["skip_k8s_upgrade"] = *machinePool.SkipK8sUpgrade + skipK8sUpgrade = *machinePool.SkipK8sUpgrade } + oi["skip_k8s_upgrade"] = skipK8sUpgrade oi["disk_size_gb"] = int(machinePool.RootDeviceSize) if machinePool.SubnetIds != nil { oi["az_subnets"] = machinePool.SubnetIds diff --git a/spectrocloud/resource_cluster_aws_flatten_test.go b/spectrocloud/resource_cluster_aws_flatten_test.go index 042e9d87..a6483ef6 100644 --- a/spectrocloud/resource_cluster_aws_flatten_test.go +++ b/spectrocloud/resource_cluster_aws_flatten_test.go @@ -58,6 +58,7 @@ func TestFlattenMachinePoolConfigsAws(t *testing.T) { "max": 5, "instance_type": "t2.micro", "disk_size_gb": 8, + "skip_k8s_upgrade": "disabled", "az_subnets": map[string]string{"us-west-2d": "subnet-87654321"}, "update_strategy": "RollingUpdateScaleOut", "additional_security_groups": []string{"sg-1234567890"}, diff --git a/templates/resources/virtual_cluster.md.tmpl b/templates/resources/virtual_cluster.md.tmpl index 851a03f8..72dde67d 100644 --- a/templates/resources/virtual_cluster.md.tmpl +++ b/templates/resources/virtual_cluster.md.tmpl @@ -46,5 +46,28 @@ resource "spectrocloud_virtual_cluster" "cluster" { ``` +## Import + +In Terraform v1.5.0 and later, use an [`import` block](https://developer.hashicorp.com/terraform/language/import) +to import the resource {{ .Name }} by using its `id` with the Palette `context` separated by a colon. For example: + +```terraform +import { + to = {{ .Name }}.example + id = "example_id:context" +} +``` + +Using `terraform import`, import the cluster using the `cluster_name` or `id` colon separated with `context`. For example: + +```console +terraform import {{ .Name }}.example example_id +``` + +```console +terraform import {{ .Name }}.example cluster_name +``` + +Refer to the [Import section](/docs#import) to learn more. {{ .SchemaMarkdown | trimspace }} \ No newline at end of file