From 8ad86d72b28f01c8edc8f7b54d4ff3e47b07ae4e Mon Sep 17 00:00:00 2001 From: Zoltan Illes Date: Wed, 18 Jan 2023 11:56:41 +0100 Subject: [PATCH 1/5] add user defined secondary storage support to vpc cluster and workerpool --- go.mod | 2 +- go.sum | 4 +- ibm/acctest/acctest.go | 6 +++ ibm/flex/structures.go | 16 ++++++++ .../data_source_ibm_container_vpc_cluster.go | 38 ++++++++++++++++++ ...a_source_ibm_container_vpc_cluster_test.go | 32 +++++++++++++++ ...ta_source_ibm_container_vpc_worker_pool.go | 39 +++++++++++++++++++ ...urce_ibm_container_vpc_worker_pool_test.go | 19 ++++++--- .../resource_ibm_container_vpc_cluster.go | 15 +++++++ ...resource_ibm_container_vpc_cluster_test.go | 31 ++++++++++----- .../resource_ibm_container_vpc_worker_pool.go | 15 +++++++ ...urce_ibm_container_vpc_worker_pool_test.go | 17 ++++---- 12 files changed, 210 insertions(+), 24 deletions(-) diff --git a/go.mod b/go.mod index ff9eca85f3b..1588538eb84 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/IBM-Cloud/terraform-provider-ibm go 1.18 require ( - github.com/IBM-Cloud/bluemix-go v0.0.0-20221026143540-4d6050d2dbc5 + github.com/IBM-Cloud/bluemix-go v0.0.0-20230118080803-9a11ac0420f9 github.com/IBM-Cloud/container-services-go-sdk v0.0.0-20220922071204-21813161c36f github.com/IBM-Cloud/power-go-client v1.2.2 github.com/IBM/apigateway-go-sdk v0.0.0-20210714141226-a5d5d49caaca diff --git a/go.sum b/go.sum index 2cf4bd0668c..b018f860406 100644 --- a/go.sum +++ b/go.sum @@ -34,8 +34,8 @@ dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7 github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= -github.com/IBM-Cloud/bluemix-go v0.0.0-20221026143540-4d6050d2dbc5 h1:pIPDTYytM117G4BZBpxPLF40rqvSYDnhLkFDz0/1/MM= -github.com/IBM-Cloud/bluemix-go v0.0.0-20221026143540-4d6050d2dbc5/go.mod h1:cO5KCpiop9eP/pM/5W07TprYUkv/kHtajW1FiZgE59k= +github.com/IBM-Cloud/bluemix-go v0.0.0-20230118080803-9a11ac0420f9 h1:J6pDNFS7er3AqjYANBI1OjTyUh3p6dt8pPBi+aXzhBA= +github.com/IBM-Cloud/bluemix-go v0.0.0-20230118080803-9a11ac0420f9/go.mod h1:cO5KCpiop9eP/pM/5W07TprYUkv/kHtajW1FiZgE59k= github.com/IBM-Cloud/container-services-go-sdk v0.0.0-20220922071204-21813161c36f h1:VMMqaAUXrNQH84ba/EDbfe8lvQJF9FBUnaQbIa1iKZ0= github.com/IBM-Cloud/container-services-go-sdk v0.0.0-20220922071204-21813161c36f/go.mod h1:xUQL9SGAjoZFd4GNjrjjtEpjpkgU7RFXRyHesbKTjiY= github.com/IBM-Cloud/ibm-cloud-cli-sdk v0.5.3/go.mod h1:RiUvKuHKTBmBApDMUQzBL14pQUGKcx/IioKQPIcRQjs= diff --git a/ibm/acctest/acctest.go b/ibm/acctest/acctest.go index 37f0e8685a9..c3eabb089c0 100644 --- a/ibm/acctest/acctest.go +++ b/ibm/acctest/acctest.go @@ -52,6 +52,7 @@ var ZonePrivateVlan string var ZonePublicVlan string var ZoneUpdatePrivateVlan string var ZoneUpdatePublicVlan string +var WorkerPoolSecondaryStorage string var CsRegion string var ExtendedHardwareTesting bool var err error @@ -458,6 +459,11 @@ func init() { fmt.Println("[WARN] Set the environment variable IBM_WORKER_POOL_ZONE_UPDATE_PUBLIC_VLAN for testing ibm_container_worker_pool_zone_attachment resource else it is set to default value '2388375'") } + WorkerPoolSecondaryStorage = os.Getenv("IBM_WORKER_POOL_SECONDARY_STORAGE") + if WorkerPoolSecondaryStorage == "" { + fmt.Println("[WARN] Set the environment variable IBM_WORKER_POOL_SECONDARY_STORAGE for testing user-defined secondary_storage attachment to IKS workerpools") + } + placementGroupName = os.Getenv("IBM_PLACEMENT_GROUP_NAME") if placementGroupName == "" { placementGroupName = "terraform_group" diff --git a/ibm/flex/structures.go b/ibm/flex/structures.go index 83a6cc8a11b..ed4d23d2914 100644 --- a/ibm/flex/structures.go +++ b/ibm/flex/structures.go @@ -308,6 +308,19 @@ func FlattenProtocols(list []datatypes.Network_LBaaS_Listener) []map[string]inte return result } +func FlattenVpcUserDefinedSecondaryDisk(userDefinedSecondaryDisk containerv2.DiskConfigResp) []map[string]interface{} { + storageList := make([]map[string]interface{}, 1) + secondary_storage := map[string]interface{}{ + "name": userDefinedSecondaryDisk.Name, + "count": strconv.Itoa(userDefinedSecondaryDisk.Count), + "size": strconv.Itoa(userDefinedSecondaryDisk.Size), + "device_type": userDefinedSecondaryDisk.DeviceType, + "raid_configuration": userDefinedSecondaryDisk.RAIDConfiguration, + "profile": userDefinedSecondaryDisk.Profile, + } + storageList[0] = secondary_storage + return storageList +} func FlattenVpcWorkerPools(list []containerv2.GetWorkerPoolResponse) []map[string]interface{} { workerPools := make([]map[string]interface{}, len(list)) for i, workerPool := range list { @@ -342,6 +355,9 @@ func FlattenVpcWorkerPools(list []containerv2.GetWorkerPoolResponse) []map[strin zonesConfig[j] = z } l["zones"] = zonesConfig + if workerPool.UserDefinedSecondaryDisk != nil { + l["secondary_storage"] = FlattenVpcUserDefinedSecondaryDisk(*workerPool.UserDefinedSecondaryDisk) + } workerPools[i] = l } diff --git a/ibm/service/kubernetes/data_source_ibm_container_vpc_cluster.go b/ibm/service/kubernetes/data_source_ibm_container_vpc_cluster.go index 332a06ee599..ffa3701ef14 100644 --- a/ibm/service/kubernetes/data_source_ibm_container_vpc_cluster.go +++ b/ibm/service/kubernetes/data_source_ibm_container_vpc_cluster.go @@ -82,6 +82,44 @@ func DataSourceIBMContainerVPCCluster() *schema.Resource { Type: schema.TypeMap, Computed: true, }, + "operating_system": { + Type: schema.TypeString, + Computed: true, + Description: "The operating system of the workers in the worker pool", + }, + "secondary_storage": { + Type: schema.TypeList, + Computed: true, + Description: "The User-defined Secondary Storage Configuration of the workers in the worker pool.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Computed: true, + }, + "count": { + Type: schema.TypeString, + Computed: true, + }, + "size": { + Type: schema.TypeString, + Computed: true, + }, + "device_type": { + Type: schema.TypeString, + Computed: true, + }, + "raid_configuration": { + Type: schema.TypeString, + Computed: true, + }, + "profile": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, "state": { Type: schema.TypeString, Computed: true, diff --git a/ibm/service/kubernetes/data_source_ibm_container_vpc_cluster_test.go b/ibm/service/kubernetes/data_source_ibm_container_vpc_cluster_test.go index 09273aaa292..b45bca4f9a6 100644 --- a/ibm/service/kubernetes/data_source_ibm_container_vpc_cluster_test.go +++ b/ibm/service/kubernetes/data_source_ibm_container_vpc_cluster_test.go @@ -72,3 +72,35 @@ data "ibm_container_vpc_cluster" "testacc_cluster_dedicatedhost" { } ` } + +func testAccCheckIBMContainerVPCClusterDatasourceEnvvar(name string) string { + return testAccCheckIBMContainerVpcClusterEnvvar(name) + ` +data "ibm_container_vpc_cluster" "testacc_ds_cluster" { + cluster_name_id = ibm_container_vpc_cluster.cluster.id +} +` +} + +func TestAccIBMContainerVPCClusterDataSourceEnvvar(t *testing.T) { + name := fmt.Sprintf("tf-vpc-cluster-%d", acctest.RandIntRange(10, 100)) + testChecks := []resource.TestCheckFunc{ + resource.TestCheckResourceAttrSet( + "data.ibm_container_vpc_cluster.testacc_ds_cluster", "id"), + resource.TestCheckResourceAttr( + "data.ibm_container_vpc_cluster.testacc_ds_cluster", "worker_pools.#", "1"), + } + if acc.WorkerPoolSecondaryStorage != "" { + testChecks = append(testChecks, resource.TestCheckResourceAttr( + "data.ibm_container_vpc_cluster.testacc_ds_cluster", "worker_pools.0.secondary_storage.0.name", acc.WorkerPoolSecondaryStorage)) + } + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheck(t) }, + Providers: acc.TestAccProviders, + Steps: []resource.TestStep{ + { + Config: testAccCheckIBMContainerVPCClusterDatasourceEnvvar(name), + Check: resource.ComposeTestCheckFunc(testChecks...), + }, + }, + }) +} diff --git a/ibm/service/kubernetes/data_source_ibm_container_vpc_worker_pool.go b/ibm/service/kubernetes/data_source_ibm_container_vpc_worker_pool.go index e3d1e2fe675..1386bf6f2d8 100644 --- a/ibm/service/kubernetes/data_source_ibm_container_vpc_worker_pool.go +++ b/ibm/service/kubernetes/data_source_ibm_container_vpc_worker_pool.go @@ -5,6 +5,7 @@ package kubernetes import ( "github.com/IBM-Cloud/terraform-provider-ibm/ibm/conns" + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/flex" "github.com/IBM-Cloud/terraform-provider-ibm/ibm/validate" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) @@ -57,6 +58,39 @@ func DataSourceIBMContainerVpcClusterWorkerPool() *schema.Resource { Computed: true, Description: "The operating system of the workers in the worker pool", }, + "secondary_storage": { + Type: schema.TypeList, + Computed: true, + Description: "The User-defined Secondary Storage Configuration of the workers in the worker pool.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Computed: true, + }, + "count": { + Type: schema.TypeString, + Computed: true, + }, + "size": { + Type: schema.TypeString, + Computed: true, + }, + "device_type": { + Type: schema.TypeString, + Computed: true, + }, + "raid_configuration": { + Type: schema.TypeString, + Computed: true, + }, + "profile": { + Type: schema.TypeString, + Computed: true, + }, + }, + }, + }, "resource_group_id": { Type: schema.TypeString, Computed: true, @@ -152,6 +186,11 @@ func dataSourceIBMContainerVpcClusterWorkerPoolRead(d *schema.ResourceData, meta d.Set("kms_account_id", workerPool.WorkerVolumeEncryption.KMSAccountID) } } + + if workerPool.UserDefinedSecondaryDisk != nil { + d.Set("secondary_storage", flex.FlattenVpcUserDefinedSecondaryDisk(*workerPool.UserDefinedSecondaryDisk)) + } + d.SetId(workerPool.ID) return nil } diff --git a/ibm/service/kubernetes/data_source_ibm_container_vpc_worker_pool_test.go b/ibm/service/kubernetes/data_source_ibm_container_vpc_worker_pool_test.go index a761c21b0c4..ee305f40a69 100644 --- a/ibm/service/kubernetes/data_source_ibm_container_vpc_worker_pool_test.go +++ b/ibm/service/kubernetes/data_source_ibm_container_vpc_worker_pool_test.go @@ -57,17 +57,26 @@ func testAccCheckIBMContainerVPCClusterWorkerPoolDataSourceConfig(name string) s func TestAccIBMContainerVPCClusterWorkerPoolDataSourceEnvvar(t *testing.T) { name := fmt.Sprintf("tf-vpc-wp-%d", acctest.RandIntRange(10, 100)) + testChecks := []resource.TestCheckFunc{ + resource.TestCheckResourceAttrSet("data.ibm_container_vpc_cluster_worker_pool.testacc_ds_worker_pool", "id"), + } + if acc.CrkID != "" { + testChecks = append(testChecks, + resource.TestCheckResourceAttr("data.ibm_container_vpc_cluster_worker_pool.testacc_ds_worker_pool", "crk", acc.CrkID), + resource.TestCheckResourceAttr("data.ibm_container_vpc_cluster_worker_pool.testacc_ds_worker_pool", "kms_instance_id", acc.KmsInstanceID), + ) + } + if acc.WorkerPoolSecondaryStorage != "" { + testChecks = append(testChecks, resource.TestCheckResourceAttr( + "data.ibm_container_vpc_cluster_worker_pool.testacc_ds_worker_pool", "secondary_storage.0.name", acc.WorkerPoolSecondaryStorage)) + } resource.Test(t, resource.TestCase{ PreCheck: func() { acc.TestAccPreCheck(t) }, Providers: acc.TestAccProviders, Steps: []resource.TestStep{ { Config: testAccCheckIBMContainerVPCClusterWorkerPoolDataSourceEnvvar(name), - Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttrSet("data.ibm_container_vpc_cluster_worker_pool.testacc_ds_worker_pool", "id"), - resource.TestCheckResourceAttr("data.ibm_container_vpc_cluster_worker_pool.testacc_ds_worker_pool", "crk", acc.CrkID), - resource.TestCheckResourceAttr("data.ibm_container_vpc_cluster_worker_pool.testacc_ds_worker_pool", "kms_instance_id", acc.KmsInstanceID), - ), + Check: resource.ComposeTestCheckFunc(testChecks...), }, }, }) diff --git a/ibm/service/kubernetes/resource_ibm_container_vpc_cluster.go b/ibm/service/kubernetes/resource_ibm_container_vpc_cluster.go index aecbba16f35..865e5ab91bb 100644 --- a/ibm/service/kubernetes/resource_ibm_container_vpc_cluster.go +++ b/ibm/service/kubernetes/resource_ibm_container_vpc_cluster.go @@ -206,6 +206,14 @@ func ResourceIBMContainerVpcCluster() *schema.Resource { Description: "The operating system of the workers in the default worker pool.", }, + "secondary_storage": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ForceNew: true, + Description: "The name of the User-defined Secondary Storage Configuration for the default worker pool.", + }, + "taints": { Type: schema.TypeSet, Optional: true, @@ -530,6 +538,10 @@ func resourceIBMContainerVpcClusterCreate(d *schema.ResourceData, meta interface workerpool.OperatingSystem = os.(string) } + if secondarystorage, ok := d.GetOk("secondary_storage"); ok { + workerpool.SecondaryStorageOption = secondarystorage.(string) + } + if kmsid, ok := d.GetOk("kms_instance_id"); ok { crk := d.Get("crk").(string) wve := v2.WorkerVolumeEncryption{ @@ -1043,6 +1055,9 @@ func resourceIBMContainerVpcClusterRead(d *schema.ResourceData, meta interface{} d.Set("image_security_enforcement", cls.ImageSecurityEnabled) d.Set("host_pool_id", workerPool.HostPoolID) d.Set("operating_system", workerPool.OperatingSystem) + if workerPool.UserDefinedSecondaryDisk != nil { + d.Set("secondary_storage", workerPool.UserDefinedSecondaryDisk.Name) + } tags, err := flex.GetTagsUsingCRN(meta, cls.CRN) if err != nil { diff --git a/ibm/service/kubernetes/resource_ibm_container_vpc_cluster_test.go b/ibm/service/kubernetes/resource_ibm_container_vpc_cluster_test.go index cbdcedcd195..4649bb5876e 100644 --- a/ibm/service/kubernetes/resource_ibm_container_vpc_cluster_test.go +++ b/ibm/service/kubernetes/resource_ibm_container_vpc_cluster_test.go @@ -176,6 +176,7 @@ func testAccCheckIBMContainerVpcClusterDestroy(s *terraform.State) error { return nil } + func testAccCheckIBMContainerVpcExists(n string, conf *v2.ClusterInfo) resource.TestCheckFunc { return func(s *terraform.State) error { @@ -204,6 +205,7 @@ func testAccCheckIBMContainerVpcExists(n string, conf *v2.ClusterInfo) resource. return nil } } + func getVpcClusterTargetHeaderTestACC() v2.ClusterTargetHeader { c := new(bluemix.Config) sess, err := session.New(c) @@ -216,6 +218,7 @@ func getVpcClusterTargetHeaderTestACC() v2.ClusterTargetHeader { } return targetEnv } + func testAccCheckIBMContainerVpcClusterBasic(name string) string { return fmt.Sprintf(` provider "ibm" { @@ -271,6 +274,7 @@ resource "ibm_container_vpc_cluster" "cluster" { }`, name) } + func testAccCheckIBMContainerVpcClusterUpdate(name string) string { return fmt.Sprintf(` provider "ibm" { @@ -334,6 +338,7 @@ resource "ibm_container_vpc_cluster" "cluster" { }`, name) } + func testAccCheckIBMContainerOcpClusterBasic(name, openshiftFlavour, openShiftworkerCount, operatingSystem string) string { return fmt.Sprintf(` data "ibm_resource_instance" "cos_instance" { @@ -399,6 +404,17 @@ func TestAccIBMContainerVpcClusterEnvvar(t *testing.T) { name := fmt.Sprintf("tf-vpc-cluster-%d", acctest.RandIntRange(10, 100)) var conf *v2.ClusterInfo + testChecks := []resource.TestCheckFunc{ + testAccCheckIBMContainerVpcExists("ibm_container_vpc_cluster.cluster", conf), + resource.TestCheckResourceAttr( + "ibm_container_vpc_cluster.cluster", "name", name), + resource.TestCheckResourceAttr( + "ibm_container_vpc_cluster.cluster", "worker_count", "1"), + } + if acc.WorkerPoolSecondaryStorage != "" { + testChecks = append(testChecks, resource.TestCheckResourceAttr( + "ibm_container_vpc_cluster.cluster", "secondary_storage", acc.WorkerPoolSecondaryStorage)) + } resource.Test(t, resource.TestCase{ PreCheck: func() { acc.TestAccPreCheck(t) }, Providers: acc.TestAccProviders, @@ -406,20 +422,16 @@ func TestAccIBMContainerVpcClusterEnvvar(t *testing.T) { Steps: []resource.TestStep{ { Config: testAccCheckIBMContainerVpcClusterEnvvar(name), - Check: resource.ComposeTestCheckFunc( - testAccCheckIBMContainerVpcExists("ibm_container_vpc_cluster.cluster", conf), - resource.TestCheckResourceAttr( - "ibm_container_vpc_cluster.cluster", "name", name), - resource.TestCheckResourceAttr( - "ibm_container_vpc_cluster.cluster", "worker_count", "1"), - ), + Check: resource.ComposeTestCheckFunc(testChecks...), }, { ResourceName: "ibm_container_vpc_cluster.cluster", ImportState: true, ImportStateVerify: true, ImportStateVerifyIgnore: []string{ - "wait_till", "update_all_workers", "kms_config", "force_delete_storage", "wait_for_worker_update"}, + "wait_till", "update_all_workers", "kms_config", "force_delete_storage", "wait_for_worker_update", + "crk", "kms_account_id", "kms_instance_id", + }, }, }, }) @@ -451,8 +463,9 @@ func testAccCheckIBMContainerVpcClusterEnvvar(name string) string { kms_instance_id = "%[5]s" crk = "%[6]s" kms_account_id = "%[7]s" + secondary_storage = "%[8]s" } - `, name, acc.IksClusterVpcID, acc.IksClusterResourceGroupID, acc.IksClusterSubnetID, acc.KmsInstanceID, acc.CrkID, acc.KmsAccountID) + `, name, acc.IksClusterVpcID, acc.IksClusterResourceGroupID, acc.IksClusterSubnetID, acc.KmsInstanceID, acc.CrkID, acc.KmsAccountID, acc.WorkerPoolSecondaryStorage) fmt.Println(config) return config } diff --git a/ibm/service/kubernetes/resource_ibm_container_vpc_worker_pool.go b/ibm/service/kubernetes/resource_ibm_container_vpc_worker_pool.go index 88c87228c61..7f8ba3bde0f 100644 --- a/ibm/service/kubernetes/resource_ibm_container_vpc_worker_pool.go +++ b/ibm/service/kubernetes/resource_ibm_container_vpc_worker_pool.go @@ -161,6 +161,14 @@ func ResourceIBMContainerVpcWorkerPool() *schema.Resource { Description: "The operating system of the workers in the worker pool.", }, + "secondary_storage": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ForceNew: true, + Description: "The name of the User-defined Secondary Storage Configuration for the workers in the worker pool.", + }, + "host_pool_id": { Type: schema.TypeString, Optional: true, @@ -287,6 +295,10 @@ func resourceIBMContainerVpcWorkerPoolCreate(d *schema.ResourceData, meta interf params.OperatingSystem = os.(string) } + if secondarystorage, ok := d.GetOk("secondary_storage"); ok { + params.SecondaryStorageOption = secondarystorage.(string) + } + if hpid, ok := d.GetOk("host_pool_id"); ok { params.HostPoolID = hpid.(string) } @@ -525,6 +537,9 @@ func resourceIBMContainerVpcWorkerPoolRead(d *schema.ResourceData, meta interfac d.Set("cluster", cluster) d.Set("vpc_id", workerPool.VpcID) d.Set("operating_system", workerPool.OperatingSystem) + if workerPool.UserDefinedSecondaryDisk != nil { + d.Set("secondary_storage", workerPool.UserDefinedSecondaryDisk.Name) + } d.Set("host_pool_id", workerPool.HostPoolID) if workerPool.Taints != nil { d.Set("taints", flattenWorkerPoolTaints(workerPool)) diff --git a/ibm/service/kubernetes/resource_ibm_container_vpc_worker_pool_test.go b/ibm/service/kubernetes/resource_ibm_container_vpc_worker_pool_test.go index 00392c6c377..1fd0b435765 100644 --- a/ibm/service/kubernetes/resource_ibm_container_vpc_worker_pool_test.go +++ b/ibm/service/kubernetes/resource_ibm_container_vpc_worker_pool_test.go @@ -251,6 +251,8 @@ func TestAccIBMContainerVpcClusterWorkerPoolEnvvar(t *testing.T) { "ibm_container_vpc_worker_pool.test_pool", "kms_instance_id", acc.KmsInstanceID), resource.TestCheckResourceAttr( "ibm_container_vpc_worker_pool.test_pool", "crk", acc.CrkID), + resource.TestCheckResourceAttr( + "ibm_container_vpc_worker_pool.test_pool", "secondary_storage", acc.WorkerPoolSecondaryStorage), ), }, { @@ -315,21 +317,22 @@ func testAccCheckIBMVpcContainerWorkerPoolDedicatedHostCreate(clusterName, name, } func testAccCheckIBMVpcContainerWorkerPoolEnvvar(name string) string { - return fmt.Sprintf(` + return fmt.Sprintf(testAccCheckIBMContainerVpcClusterEnvvar(name)+` resource "ibm_container_vpc_worker_pool" "test_pool" { - cluster = "%[2]s" + cluster = ibm_container_vpc_cluster.cluster.id worker_pool_name = "%[1]s" flavor = "bx2.4x16" - vpc_id = "%[3]s" + vpc_id = "%[2]s" worker_count = 1 zones { - subnet_id = "%[4]s" + subnet_id = "%[3]s" name = "us-south-1" } - kms_instance_id = "%[5]s" - crk = "%[6]s" + kms_instance_id = "%[4]s" + crk = "%[5]s" + secondary_storage = "%[6]s" } - `, name, acc.IksClusterID, acc.IksClusterVpcID, acc.IksClusterSubnetID, acc.KmsInstanceID, acc.CrkID) + `, name, acc.IksClusterVpcID, acc.IksClusterSubnetID, acc.KmsInstanceID, acc.CrkID, acc.WorkerPoolSecondaryStorage) } func testAccCheckIBMVpcContainerWorkerPoolKmsAccountEnvvar(name string) string { From 39cdc9231a321555b2ff7961daca470d3938ce6e Mon Sep 17 00:00:00 2001 From: Zoltan Illes Date: Wed, 18 Jan 2023 19:44:18 +0100 Subject: [PATCH 2/5] tc fix for non secondarystorage case --- ...urce_ibm_container_vpc_worker_pool_test.go | 32 ++++++++++++------- 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/ibm/service/kubernetes/resource_ibm_container_vpc_worker_pool_test.go b/ibm/service/kubernetes/resource_ibm_container_vpc_worker_pool_test.go index 1fd0b435765..a20359b5418 100644 --- a/ibm/service/kubernetes/resource_ibm_container_vpc_worker_pool_test.go +++ b/ibm/service/kubernetes/resource_ibm_container_vpc_worker_pool_test.go @@ -235,6 +235,25 @@ func testAccCheckIBMVpcContainerWorkerPoolUpdate(name string) string { func TestAccIBMContainerVpcClusterWorkerPoolEnvvar(t *testing.T) { name := fmt.Sprintf("tf-vpc-worker-%d", acctest.RandIntRange(10, 100)) + testChecks := []resource.TestCheckFunc{ + resource.TestCheckResourceAttr( + "ibm_container_vpc_worker_pool.test_pool", "flavor", "bx2.4x16"), + resource.TestCheckResourceAttr( + "ibm_container_vpc_worker_pool.test_pool", "zones.#", "1"), + } + if acc.CrkID != "" { + testChecks = append(testChecks, + resource.TestCheckResourceAttr( + "ibm_container_vpc_worker_pool.test_pool", "kms_instance_id", acc.KmsInstanceID), + resource.TestCheckResourceAttr( + "ibm_container_vpc_worker_pool.test_pool", "crk", acc.CrkID), + ) + } + if acc.WorkerPoolSecondaryStorage != "" { + testChecks = append(testChecks, resource.TestCheckResourceAttr( + "ibm_container_vpc_worker_pool.test_pool", "secondary_storage", acc.WorkerPoolSecondaryStorage), + ) + } resource.Test(t, resource.TestCase{ PreCheck: func() { acc.TestAccPreCheck(t) }, Providers: acc.TestAccProviders, @@ -242,18 +261,7 @@ func TestAccIBMContainerVpcClusterWorkerPoolEnvvar(t *testing.T) { Steps: []resource.TestStep{ { Config: testAccCheckIBMVpcContainerWorkerPoolEnvvar(name), - Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttr( - "ibm_container_vpc_worker_pool.test_pool", "flavor", "bx2.4x16"), - resource.TestCheckResourceAttr( - "ibm_container_vpc_worker_pool.test_pool", "zones.#", "1"), - resource.TestCheckResourceAttr( - "ibm_container_vpc_worker_pool.test_pool", "kms_instance_id", acc.KmsInstanceID), - resource.TestCheckResourceAttr( - "ibm_container_vpc_worker_pool.test_pool", "crk", acc.CrkID), - resource.TestCheckResourceAttr( - "ibm_container_vpc_worker_pool.test_pool", "secondary_storage", acc.WorkerPoolSecondaryStorage), - ), + Check: resource.ComposeTestCheckFunc(testChecks...), }, { ResourceName: "ibm_container_vpc_worker_pool.test_pool", From 658bc6e41f6d9da999b611c60dc5e1b01c094540 Mon Sep 17 00:00:00 2001 From: Zoltan Illes Date: Thu, 19 Jan 2023 11:11:30 +0100 Subject: [PATCH 3/5] update docs and descriptions --- .../data_source_ibm_container_vpc_cluster.go | 2 +- .../data_source_ibm_container_vpc_worker_pool.go | 2 +- .../kubernetes/resource_ibm_container_vpc_cluster.go | 2 +- .../resource_ibm_container_vpc_worker_pool.go | 2 +- website/docs/d/container_vpc_cluster.html.markdown | 11 +++++++++++ .../d/container_vpc_cluster_worker_pool.html.markdown | 9 +++++++++ website/docs/r/container_vpc_cluster.html.markdown | 1 + .../docs/r/container_vpc_worker_pool.html.markdown | 1 + 8 files changed, 26 insertions(+), 4 deletions(-) diff --git a/ibm/service/kubernetes/data_source_ibm_container_vpc_cluster.go b/ibm/service/kubernetes/data_source_ibm_container_vpc_cluster.go index ffa3701ef14..7fe8fa263fa 100644 --- a/ibm/service/kubernetes/data_source_ibm_container_vpc_cluster.go +++ b/ibm/service/kubernetes/data_source_ibm_container_vpc_cluster.go @@ -90,7 +90,7 @@ func DataSourceIBMContainerVPCCluster() *schema.Resource { "secondary_storage": { Type: schema.TypeList, Computed: true, - Description: "The User-defined Secondary Storage Configuration of the workers in the worker pool.", + Description: "The optional secondary storage configuration of the workers in the worker pool.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "name": { diff --git a/ibm/service/kubernetes/data_source_ibm_container_vpc_worker_pool.go b/ibm/service/kubernetes/data_source_ibm_container_vpc_worker_pool.go index 1386bf6f2d8..9918d72830a 100644 --- a/ibm/service/kubernetes/data_source_ibm_container_vpc_worker_pool.go +++ b/ibm/service/kubernetes/data_source_ibm_container_vpc_worker_pool.go @@ -61,7 +61,7 @@ func DataSourceIBMContainerVpcClusterWorkerPool() *schema.Resource { "secondary_storage": { Type: schema.TypeList, Computed: true, - Description: "The User-defined Secondary Storage Configuration of the workers in the worker pool.", + Description: "The optional secondary storage configuration of the workers in the worker pool.", Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "name": { diff --git a/ibm/service/kubernetes/resource_ibm_container_vpc_cluster.go b/ibm/service/kubernetes/resource_ibm_container_vpc_cluster.go index 865e5ab91bb..3c48c909fe6 100644 --- a/ibm/service/kubernetes/resource_ibm_container_vpc_cluster.go +++ b/ibm/service/kubernetes/resource_ibm_container_vpc_cluster.go @@ -211,7 +211,7 @@ func ResourceIBMContainerVpcCluster() *schema.Resource { Optional: true, Computed: true, ForceNew: true, - Description: "The name of the User-defined Secondary Storage Configuration for the default worker pool.", + Description: "The ID of the secondary storage option for the default worker pool.", }, "taints": { diff --git a/ibm/service/kubernetes/resource_ibm_container_vpc_worker_pool.go b/ibm/service/kubernetes/resource_ibm_container_vpc_worker_pool.go index 7f8ba3bde0f..6fab6fbcb30 100644 --- a/ibm/service/kubernetes/resource_ibm_container_vpc_worker_pool.go +++ b/ibm/service/kubernetes/resource_ibm_container_vpc_worker_pool.go @@ -166,7 +166,7 @@ func ResourceIBMContainerVpcWorkerPool() *schema.Resource { Optional: true, Computed: true, ForceNew: true, - Description: "The name of the User-defined Secondary Storage Configuration for the workers in the worker pool.", + Description: "The ID of the secondary storage option for the workers in the worker pool.", }, "host_pool_id": { diff --git a/website/docs/d/container_vpc_cluster.html.markdown b/website/docs/d/container_vpc_cluster.html.markdown index b8a5ae5a18c..588e2d81660 100644 --- a/website/docs/d/container_vpc_cluster.html.markdown +++ b/website/docs/d/container_vpc_cluster.html.markdown @@ -69,6 +69,17 @@ In addition to all argument reference list, you can access the following attribu - `id` - (String) The ID of the worker pool. - `host_pool_id` - (String) The ID of the dedicated host pool. - `labels` - List of strings - A list of labels that are added to the worker pool. + - `operating_system` (String) The operating system of the workers in the worker pool. + - `secondary_storage` - List of objects - The optional secondary storage configuration of the workers in the worker pool. + + Nested scheme for `secondary_storage`: + - `name` - (String) The name of the secondary storage. + - `count` - (String) The device count of the secondary storage. + - `size` - (String) The size of the secondary storage. + - `device_type` - (String) The device type of the secondary storage. + - `raid_configuration` - (String) The raid configuration of the secondary storage. + - `profile` - (String) The profile of the secondary storage. + - `zones` - List of objects - A list of zones that are attached to the worker pool. Nested scheme for `zones`: diff --git a/website/docs/d/container_vpc_cluster_worker_pool.html.markdown b/website/docs/d/container_vpc_cluster_worker_pool.html.markdown index c123e8243e2..820b71bbc1d 100644 --- a/website/docs/d/container_vpc_cluster_worker_pool.html.markdown +++ b/website/docs/d/container_vpc_cluster_worker_pool.html.markdown @@ -35,6 +35,15 @@ In addition to all argument reference list, you can access the following attribu - `isolation` - (String) Isolation for the worker node. - `labels` - (String) Labels on all the workers in the worker pool. - `operating_system` (String) The operating system of the workers in the worker pool. +- `secondary_storage` - List of objects - The optional secondary storage configuration of the workers in the worker pool. + + Nested scheme for `secondary_storage`: + - `name` - (String) The name of the secondary storage. + - `count` - (String) The device count of the secondary storage. + - `size` - (String) The size of the secondary storage. + - `device_type` - (String) The device type of the secondary storage. + - `raid_configuration` - (String) The raid configuration of the secondary storage. + - `profile` - (String) The profile of the secondary storage. - `provider` - (String) Provider Details of the worker Pool. - `resource_group_id` - (String) The ID of the resource group. - `vpc_id` - (String) The ID of the VPC. diff --git a/website/docs/r/container_vpc_cluster.html.markdown b/website/docs/r/container_vpc_cluster.html.markdown index adec2d49e3f..0017f7674e8 100644 --- a/website/docs/r/container_vpc_cluster.html.markdown +++ b/website/docs/r/container_vpc_cluster.html.markdown @@ -187,6 +187,7 @@ Review the argument references that you can specify for your resource. - `private_endpoint` - (Optional, Bool) Set **true** to configure the KMS private service endpoint. Default value is **false**. - `kube_version` - (Optional, String) Specify the Kubernetes version, including the major.minor version. If you do not include this flag, the default version is used. To see available versions, run `ibmcloud ks versions`. - `operating_system` - (Optional, Forces new resource, String) The operating system of the workers in the default worker pool. For supported options, see [Red Hat OpenShift on IBM Cloud version information](https://cloud.ibm.com/docs/openshift?topic=openshift-openshift_versions) or [IBM Cloud Kubernetes Service version information](https://cloud.ibm.com/docs/containers?topic=containers-cs_versions). +- `secondary_storage` - (Optional, Forces new resource, String) The ID of the secondary storage option for the default worker pool. - `patch_version` - (Optional, String) Updates the worker nodes with the required patch version. The patch_version should be in the format: `patch_version_fixpack_version`. For more information, about Kubernetes version information and update, see [Kubernetes version update](https://cloud.ibm.com/docs/containers?topic=containers-cs_versions). **Note** To update the patch or fix pack versions of the worker nodes, run the command `ibmcloud ks workers -c output json`. Fetch the required patch & fix pack versions from `kubeVersion.target` and set the `patch_version` parameter. - `pod_subnet` - (Optional, Forces new resource, String) Specify a custom subnet CIDR to provide private IP addresses for pods. The subnet must have a CIDR of at least `/23` or larger. For more information, see the [documentation](https://cloud.ibm.com/docs/containers?topic=containers-cli-plugin-kubernetes-service-cli#cs_subnets). Default value is `172.30.0.0/16`. - `retry_patch_version` - (Optional, Integer) This argument retries the update of `patch_version` if the previous update fails. Increment the value to retry the update of `patch_version` on worker nodes. diff --git a/website/docs/r/container_vpc_worker_pool.html.markdown b/website/docs/r/container_vpc_worker_pool.html.markdown index 4d6a3aa340c..0d71239d61b 100644 --- a/website/docs/r/container_vpc_worker_pool.html.markdown +++ b/website/docs/r/container_vpc_worker_pool.html.markdown @@ -83,6 +83,7 @@ Review the argument references that you can specify for your resource. - `host_pool_id` - (Optional, String) The ID of the dedicated host pool the worker pool is associated with. - `labels` (Optional, Map) A list of labels that you want to add to all the worker nodes in the worker pool. - `operating_system` - (Optional, Forces new resource, String) The operating system of the workers in the worker pool. For supported options, see [Red Hat OpenShift on IBM Cloud version information](https://cloud.ibm.com/docs/openshift?topic=openshift-openshift_versions) or [IBM Cloud Kubernetes Service version information](https://cloud.ibm.com/docs/containers?topic=containers-cs_versions). +- `secondary_storage` - (Optional, Forces new resource, String) The ID of the secondary storage option for the workers in the worker pool. - `resource_group_id` - (Optional, Forces new resource, String) The ID of the resource group. To retrieve the ID, run `ibmcloud resource groups` or use the `ibm_resource_group` data source. If no value is provided, the `default` resource group is used. - `taints` - (Optional, Set) A nested block that sets or removes Kubernetes taints for all worker nodes in a worker pool From 5d241ba2d2d0d108c2a343ab25728819675a0f14 Mon Sep 17 00:00:00 2001 From: Zoltan Illes Date: Fri, 20 Jan 2023 13:29:53 +0100 Subject: [PATCH 4/5] remove userdefined string, count and size is now integer in secondarystorage schema --- go.mod | 4 ++-- go.sum | 7 ++----- ibm/acctest/acctest.go | 2 +- ibm/flex/structures.go | 18 +++++++++--------- .../data_source_ibm_container_vpc_cluster.go | 4 ++-- ...ata_source_ibm_container_vpc_worker_pool.go | 8 ++++---- .../resource_ibm_container_vpc_cluster.go | 4 ++-- .../resource_ibm_container_vpc_worker_pool.go | 4 ++-- .../docs/d/container_vpc_cluster.html.markdown | 4 ++-- ...ainer_vpc_cluster_worker_pool.html.markdown | 4 ++-- 10 files changed, 28 insertions(+), 31 deletions(-) diff --git a/go.mod b/go.mod index 1588538eb84..39f36d0ec84 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/IBM-Cloud/terraform-provider-ibm go 1.18 require ( - github.com/IBM-Cloud/bluemix-go v0.0.0-20230118080803-9a11ac0420f9 + github.com/IBM-Cloud/bluemix-go v0.0.0-20230120122421-afb48116b8f1 github.com/IBM-Cloud/container-services-go-sdk v0.0.0-20220922071204-21813161c36f github.com/IBM-Cloud/power-go-client v1.2.2 github.com/IBM/apigateway-go-sdk v0.0.0-20210714141226-a5d5d49caaca @@ -171,4 +171,4 @@ require ( replace github.com/softlayer/softlayer-go v1.0.3 => github.com/IBM-Cloud/softlayer-go v1.0.5-tf -replace github.com/dgrijalva/jwt-go v3.2.0+incompatible => github.com/golang-jwt/jwt v3.2.1+incompatible \ No newline at end of file +replace github.com/dgrijalva/jwt-go v3.2.0+incompatible => github.com/golang-jwt/jwt v3.2.1+incompatible diff --git a/go.sum b/go.sum index b018f860406..5f877e896a2 100644 --- a/go.sum +++ b/go.sum @@ -34,8 +34,8 @@ dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7 github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= -github.com/IBM-Cloud/bluemix-go v0.0.0-20230118080803-9a11ac0420f9 h1:J6pDNFS7er3AqjYANBI1OjTyUh3p6dt8pPBi+aXzhBA= -github.com/IBM-Cloud/bluemix-go v0.0.0-20230118080803-9a11ac0420f9/go.mod h1:cO5KCpiop9eP/pM/5W07TprYUkv/kHtajW1FiZgE59k= +github.com/IBM-Cloud/bluemix-go v0.0.0-20230120122421-afb48116b8f1 h1:5cVMU5MglJjwzoBsDOk3yuH6T/1EeDZyYbQDowL4nW8= +github.com/IBM-Cloud/bluemix-go v0.0.0-20230120122421-afb48116b8f1/go.mod h1:cO5KCpiop9eP/pM/5W07TprYUkv/kHtajW1FiZgE59k= github.com/IBM-Cloud/container-services-go-sdk v0.0.0-20220922071204-21813161c36f h1:VMMqaAUXrNQH84ba/EDbfe8lvQJF9FBUnaQbIa1iKZ0= github.com/IBM-Cloud/container-services-go-sdk v0.0.0-20220922071204-21813161c36f/go.mod h1:xUQL9SGAjoZFd4GNjrjjtEpjpkgU7RFXRyHesbKTjiY= github.com/IBM-Cloud/ibm-cloud-cli-sdk v0.5.3/go.mod h1:RiUvKuHKTBmBApDMUQzBL14pQUGKcx/IioKQPIcRQjs= @@ -70,7 +70,6 @@ github.com/IBM/go-sdk-core/v5 v5.5.1/go.mod h1:Sn+z+qTDREQvCr+UFa22TqqfXNxx3o723 github.com/IBM/go-sdk-core/v5 v5.6.3/go.mod h1:tt/B9rxLkRtglE7pvqLuYikgCXaZFL3btdruJaoUeek= github.com/IBM/go-sdk-core/v5 v5.6.5/go.mod h1:tt/B9rxLkRtglE7pvqLuYikgCXaZFL3btdruJaoUeek= github.com/IBM/go-sdk-core/v5 v5.7.0/go.mod h1:+YbdhrjCHC84ls4MeBp+Hj4NZCni+tDAc0XQUqRO9Jc= -github.com/IBM/go-sdk-core/v5 v5.7.2/go.mod h1:+YbdhrjCHC84ls4MeBp+Hj4NZCni+tDAc0XQUqRO9Jc= github.com/IBM/go-sdk-core/v5 v5.8.0/go.mod h1:+YbdhrjCHC84ls4MeBp+Hj4NZCni+tDAc0XQUqRO9Jc= github.com/IBM/go-sdk-core/v5 v5.9.2/go.mod h1:YlOwV9LeuclmT/qi/LAK2AsobbAP42veV0j68/rlZsE= github.com/IBM/go-sdk-core/v5 v5.9.5/go.mod h1:YlOwV9LeuclmT/qi/LAK2AsobbAP42veV0j68/rlZsE= @@ -101,8 +100,6 @@ github.com/IBM/schematics-go-sdk v0.2.1 h1:byATysGD+Z1k/wdtNqQmKALcAPjgSLuSyzcab github.com/IBM/schematics-go-sdk v0.2.1/go.mod h1:Tw2OSAPdpC69AxcwoyqcYYaGTTW6YpERF9uNEU+BFRQ= github.com/IBM/secrets-manager-go-sdk v0.1.19 h1:0GPs5EoTaWNsjo4QPj64GNxlWfN8VHJy4RDFLqddSe8= github.com/IBM/secrets-manager-go-sdk v0.1.19/go.mod h1:eO3dBhzPrHkkt+yPex/jB2xD6qHZxBko+Aw+0tfqHeA= -github.com/IBM/vpc-go-sdk v0.28.0 h1:cOxzyxqjSZZqdSY0EiQEAzAGAVtYh2JBcvbve6OZguc= -github.com/IBM/vpc-go-sdk v0.28.0/go.mod h1:jYjS3EySPkC7DuOg33gMHtm8DcIf75Tc+Gxo3zmMBTQ= github.com/IBM/vpc-go-sdk v0.29.0 h1:62S41gpqETkrSWKIbjOlxuY4FQGqQTlxkM1TidOrE1M= github.com/IBM/vpc-go-sdk v0.29.0/go.mod h1:jYjS3EySPkC7DuOg33gMHtm8DcIf75Tc+Gxo3zmMBTQ= github.com/Logicalis/asn1 v0.0.0-20190312173541-d60463189a56 h1:vuquMR410psHNax14XKNWa0Ae/kYgWJcXi0IFuX60N0= diff --git a/ibm/acctest/acctest.go b/ibm/acctest/acctest.go index c3eabb089c0..00fca22cee9 100644 --- a/ibm/acctest/acctest.go +++ b/ibm/acctest/acctest.go @@ -461,7 +461,7 @@ func init() { WorkerPoolSecondaryStorage = os.Getenv("IBM_WORKER_POOL_SECONDARY_STORAGE") if WorkerPoolSecondaryStorage == "" { - fmt.Println("[WARN] Set the environment variable IBM_WORKER_POOL_SECONDARY_STORAGE for testing user-defined secondary_storage attachment to IKS workerpools") + fmt.Println("[WARN] Set the environment variable IBM_WORKER_POOL_SECONDARY_STORAGE for testing secondary_storage attachment to IKS workerpools") } placementGroupName = os.Getenv("IBM_PLACEMENT_GROUP_NAME") diff --git a/ibm/flex/structures.go b/ibm/flex/structures.go index ed4d23d2914..24d6ac78f7b 100644 --- a/ibm/flex/structures.go +++ b/ibm/flex/structures.go @@ -308,15 +308,15 @@ func FlattenProtocols(list []datatypes.Network_LBaaS_Listener) []map[string]inte return result } -func FlattenVpcUserDefinedSecondaryDisk(userDefinedSecondaryDisk containerv2.DiskConfigResp) []map[string]interface{} { +func FlattenVpcWorkerPoolSecondaryDisk(secondaryDisk containerv2.DiskConfigResp) []map[string]interface{} { storageList := make([]map[string]interface{}, 1) secondary_storage := map[string]interface{}{ - "name": userDefinedSecondaryDisk.Name, - "count": strconv.Itoa(userDefinedSecondaryDisk.Count), - "size": strconv.Itoa(userDefinedSecondaryDisk.Size), - "device_type": userDefinedSecondaryDisk.DeviceType, - "raid_configuration": userDefinedSecondaryDisk.RAIDConfiguration, - "profile": userDefinedSecondaryDisk.Profile, + "name": secondaryDisk.Name, + "count": secondaryDisk.Count, + "size": secondaryDisk.Size, + "device_type": secondaryDisk.DeviceType, + "raid_configuration": secondaryDisk.RAIDConfiguration, + "profile": secondaryDisk.Profile, } storageList[0] = secondary_storage return storageList @@ -355,8 +355,8 @@ func FlattenVpcWorkerPools(list []containerv2.GetWorkerPoolResponse) []map[strin zonesConfig[j] = z } l["zones"] = zonesConfig - if workerPool.UserDefinedSecondaryDisk != nil { - l["secondary_storage"] = FlattenVpcUserDefinedSecondaryDisk(*workerPool.UserDefinedSecondaryDisk) + if workerPool.SecondaryStorageOption != nil { + l["secondary_storage"] = FlattenVpcWorkerPoolSecondaryDisk(*workerPool.SecondaryStorageOption) } workerPools[i] = l } diff --git a/ibm/service/kubernetes/data_source_ibm_container_vpc_cluster.go b/ibm/service/kubernetes/data_source_ibm_container_vpc_cluster.go index 7fe8fa263fa..fe7e3edff96 100644 --- a/ibm/service/kubernetes/data_source_ibm_container_vpc_cluster.go +++ b/ibm/service/kubernetes/data_source_ibm_container_vpc_cluster.go @@ -98,11 +98,11 @@ func DataSourceIBMContainerVPCCluster() *schema.Resource { Computed: true, }, "count": { - Type: schema.TypeString, + Type: schema.TypeInt, Computed: true, }, "size": { - Type: schema.TypeString, + Type: schema.TypeInt, Computed: true, }, "device_type": { diff --git a/ibm/service/kubernetes/data_source_ibm_container_vpc_worker_pool.go b/ibm/service/kubernetes/data_source_ibm_container_vpc_worker_pool.go index 9918d72830a..5539949530c 100644 --- a/ibm/service/kubernetes/data_source_ibm_container_vpc_worker_pool.go +++ b/ibm/service/kubernetes/data_source_ibm_container_vpc_worker_pool.go @@ -69,11 +69,11 @@ func DataSourceIBMContainerVpcClusterWorkerPool() *schema.Resource { Computed: true, }, "count": { - Type: schema.TypeString, + Type: schema.TypeInt, Computed: true, }, "size": { - Type: schema.TypeString, + Type: schema.TypeInt, Computed: true, }, "device_type": { @@ -187,8 +187,8 @@ func dataSourceIBMContainerVpcClusterWorkerPoolRead(d *schema.ResourceData, meta } } - if workerPool.UserDefinedSecondaryDisk != nil { - d.Set("secondary_storage", flex.FlattenVpcUserDefinedSecondaryDisk(*workerPool.UserDefinedSecondaryDisk)) + if workerPool.SecondaryStorageOption != nil { + d.Set("secondary_storage", flex.FlattenVpcWorkerPoolSecondaryDisk(*workerPool.SecondaryStorageOption)) } d.SetId(workerPool.ID) diff --git a/ibm/service/kubernetes/resource_ibm_container_vpc_cluster.go b/ibm/service/kubernetes/resource_ibm_container_vpc_cluster.go index 3c48c909fe6..799ba4f1138 100644 --- a/ibm/service/kubernetes/resource_ibm_container_vpc_cluster.go +++ b/ibm/service/kubernetes/resource_ibm_container_vpc_cluster.go @@ -1055,8 +1055,8 @@ func resourceIBMContainerVpcClusterRead(d *schema.ResourceData, meta interface{} d.Set("image_security_enforcement", cls.ImageSecurityEnabled) d.Set("host_pool_id", workerPool.HostPoolID) d.Set("operating_system", workerPool.OperatingSystem) - if workerPool.UserDefinedSecondaryDisk != nil { - d.Set("secondary_storage", workerPool.UserDefinedSecondaryDisk.Name) + if workerPool.SecondaryStorageOption != nil { + d.Set("secondary_storage", workerPool.SecondaryStorageOption.Name) } tags, err := flex.GetTagsUsingCRN(meta, cls.CRN) diff --git a/ibm/service/kubernetes/resource_ibm_container_vpc_worker_pool.go b/ibm/service/kubernetes/resource_ibm_container_vpc_worker_pool.go index 6fab6fbcb30..c848b32bd02 100644 --- a/ibm/service/kubernetes/resource_ibm_container_vpc_worker_pool.go +++ b/ibm/service/kubernetes/resource_ibm_container_vpc_worker_pool.go @@ -537,8 +537,8 @@ func resourceIBMContainerVpcWorkerPoolRead(d *schema.ResourceData, meta interfac d.Set("cluster", cluster) d.Set("vpc_id", workerPool.VpcID) d.Set("operating_system", workerPool.OperatingSystem) - if workerPool.UserDefinedSecondaryDisk != nil { - d.Set("secondary_storage", workerPool.UserDefinedSecondaryDisk.Name) + if workerPool.SecondaryStorageOption != nil { + d.Set("secondary_storage", workerPool.SecondaryStorageOption.Name) } d.Set("host_pool_id", workerPool.HostPoolID) if workerPool.Taints != nil { diff --git a/website/docs/d/container_vpc_cluster.html.markdown b/website/docs/d/container_vpc_cluster.html.markdown index 588e2d81660..8408a34c0cc 100644 --- a/website/docs/d/container_vpc_cluster.html.markdown +++ b/website/docs/d/container_vpc_cluster.html.markdown @@ -74,8 +74,8 @@ In addition to all argument reference list, you can access the following attribu Nested scheme for `secondary_storage`: - `name` - (String) The name of the secondary storage. - - `count` - (String) The device count of the secondary storage. - - `size` - (String) The size of the secondary storage. + - `count` - (Integer) The device count of the secondary storage. + - `size` - (Integer) The size of the secondary storage. - `device_type` - (String) The device type of the secondary storage. - `raid_configuration` - (String) The raid configuration of the secondary storage. - `profile` - (String) The profile of the secondary storage. diff --git a/website/docs/d/container_vpc_cluster_worker_pool.html.markdown b/website/docs/d/container_vpc_cluster_worker_pool.html.markdown index 820b71bbc1d..7d0768515f0 100644 --- a/website/docs/d/container_vpc_cluster_worker_pool.html.markdown +++ b/website/docs/d/container_vpc_cluster_worker_pool.html.markdown @@ -39,8 +39,8 @@ In addition to all argument reference list, you can access the following attribu Nested scheme for `secondary_storage`: - `name` - (String) The name of the secondary storage. - - `count` - (String) The device count of the secondary storage. - - `size` - (String) The size of the secondary storage. + - `count` - (Integer) The device count of the secondary storage. + - `size` - (Integer) The size of the secondary storage. - `device_type` - (String) The device type of the secondary storage. - `raid_configuration` - (String) The raid configuration of the secondary storage. - `profile` - (String) The profile of the secondary storage. From 23fe839eff3cd474d21f3889193999054d83888b Mon Sep 17 00:00:00 2001 From: Zoltan Illes Date: Fri, 20 Jan 2023 14:41:30 +0100 Subject: [PATCH 5/5] update docs --- ibm/service/kubernetes/resource_ibm_container_vpc_cluster.go | 2 +- .../kubernetes/resource_ibm_container_vpc_worker_pool.go | 2 +- website/docs/r/container_vpc_cluster.html.markdown | 2 +- website/docs/r/container_vpc_worker_pool.html.markdown | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ibm/service/kubernetes/resource_ibm_container_vpc_cluster.go b/ibm/service/kubernetes/resource_ibm_container_vpc_cluster.go index c43394cc924..afbdae033d1 100644 --- a/ibm/service/kubernetes/resource_ibm_container_vpc_cluster.go +++ b/ibm/service/kubernetes/resource_ibm_container_vpc_cluster.go @@ -211,7 +211,7 @@ func ResourceIBMContainerVpcCluster() *schema.Resource { Optional: true, Computed: true, ForceNew: true, - Description: "The ID of the secondary storage option for the default worker pool.", + Description: "The secondary storage option for the default worker pool.", }, "taints": { diff --git a/ibm/service/kubernetes/resource_ibm_container_vpc_worker_pool.go b/ibm/service/kubernetes/resource_ibm_container_vpc_worker_pool.go index c848b32bd02..935baf8d121 100644 --- a/ibm/service/kubernetes/resource_ibm_container_vpc_worker_pool.go +++ b/ibm/service/kubernetes/resource_ibm_container_vpc_worker_pool.go @@ -166,7 +166,7 @@ func ResourceIBMContainerVpcWorkerPool() *schema.Resource { Optional: true, Computed: true, ForceNew: true, - Description: "The ID of the secondary storage option for the workers in the worker pool.", + Description: "The secondary storage option for the workers in the worker pool.", }, "host_pool_id": { diff --git a/website/docs/r/container_vpc_cluster.html.markdown b/website/docs/r/container_vpc_cluster.html.markdown index 2f943cf3d36..ae738215c67 100644 --- a/website/docs/r/container_vpc_cluster.html.markdown +++ b/website/docs/r/container_vpc_cluster.html.markdown @@ -187,7 +187,7 @@ Review the argument references that you can specify for your resource. - `private_endpoint` - (Optional, Bool) Set **true** to configure the KMS private service endpoint. Default value is **false**. - `kube_version` - (Optional, String) Specify the Kubernetes version, including the major.minor version. If you do not include this flag, the default version is used. To see available versions, run `ibmcloud ks versions`. - `operating_system` - (Optional, Forces new resource, String) The operating system of the workers in the default worker pool. For supported options, see [Red Hat OpenShift on IBM Cloud version information](https://cloud.ibm.com/docs/openshift?topic=openshift-openshift_versions) or [IBM Cloud Kubernetes Service version information](https://cloud.ibm.com/docs/containers?topic=containers-cs_versions). -- `secondary_storage` - (Optional, Forces new resource, String) The ID of the secondary storage option for the default worker pool. +- `secondary_storage` - (Optional, Forces new resource, String) The secondary storage option for the default worker pool. - `patch_version` - (Optional, String) Updates the worker nodes with the required patch version. The patch_version should be in the format: `patch_version_fixpack_version`. For more information, about Kubernetes version information and update, see [Kubernetes version update](https://cloud.ibm.com/docs/containers?topic=containers-cs_versions). **Note** To update the patch or fix pack versions of the worker nodes, run the command `ibmcloud ks workers -c output json`. Fetch the required patch & fix pack versions from `kubeVersion.target` and set the `patch_version` parameter. - `pod_subnet` - (Optional, Forces new resource, String) Specify a custom subnet CIDR to provide private IP addresses for pods. The subnet must have a CIDR of at least `/23` or larger. For more information, see the [documentation](https://cloud.ibm.com/docs/containers?topic=containers-cli-plugin-kubernetes-service-cli#cs_subnets). Default value is `172.30.0.0/16`. - `retry_patch_version` - (Optional, Integer) This argument retries the update of `patch_version` if the previous update fails. Increment the value to retry the update of `patch_version` on worker nodes. diff --git a/website/docs/r/container_vpc_worker_pool.html.markdown b/website/docs/r/container_vpc_worker_pool.html.markdown index 0d71239d61b..bc1da9bd205 100644 --- a/website/docs/r/container_vpc_worker_pool.html.markdown +++ b/website/docs/r/container_vpc_worker_pool.html.markdown @@ -83,7 +83,7 @@ Review the argument references that you can specify for your resource. - `host_pool_id` - (Optional, String) The ID of the dedicated host pool the worker pool is associated with. - `labels` (Optional, Map) A list of labels that you want to add to all the worker nodes in the worker pool. - `operating_system` - (Optional, Forces new resource, String) The operating system of the workers in the worker pool. For supported options, see [Red Hat OpenShift on IBM Cloud version information](https://cloud.ibm.com/docs/openshift?topic=openshift-openshift_versions) or [IBM Cloud Kubernetes Service version information](https://cloud.ibm.com/docs/containers?topic=containers-cs_versions). -- `secondary_storage` - (Optional, Forces new resource, String) The ID of the secondary storage option for the workers in the worker pool. +- `secondary_storage` - (Optional, Forces new resource, String) The secondary storage option for the workers in the worker pool. - `resource_group_id` - (Optional, Forces new resource, String) The ID of the resource group. To retrieve the ID, run `ibmcloud resource groups` or use the `ibm_resource_group` data source. If no value is provided, the `default` resource group is used. - `taints` - (Optional, Set) A nested block that sets or removes Kubernetes taints for all worker nodes in a worker pool