diff --git a/ibm/acctest/acctest.go b/ibm/acctest/acctest.go index 862164e055d..37f0e8685a9 100644 --- a/ibm/acctest/acctest.go +++ b/ibm/acctest/acctest.go @@ -25,6 +25,7 @@ var CisInstance string var CisResourceGroup string var CloudShellAccountID string var CosCRN string +var CosName string var Ibmid1 string var Ibmid2 string var IAMUser string @@ -320,6 +321,12 @@ func init() { fmt.Println("[WARN] Set the environment variable IBM_COS_CRN with a VALID COS instance CRN for testing ibm_cos_* resources") } + CosName = os.Getenv("IBM_COS_NAME") + if CosName == "" { + CosName = "" + fmt.Println("[WARN] Set the environment variable IBM_COS_NAME with a VALID COS instance name for testing resources with cos deps") + } + trustedMachineType = os.Getenv("IBM_TRUSTED_MACHINE_TYPE") if trustedMachineType == "" { trustedMachineType = "mb1c.16x64" diff --git a/ibm/service/kubernetes/resource_ibm_container_cluster.go b/ibm/service/kubernetes/resource_ibm_container_cluster.go index bd602bae352..e188bde6b52 100644 --- a/ibm/service/kubernetes/resource_ibm_container_cluster.go +++ b/ibm/service/kubernetes/resource_ibm_container_cluster.go @@ -313,6 +313,7 @@ func ResourceIBMContainerCluster() *schema.Resource { "operating_system": { Type: schema.TypeString, Optional: true, + ForceNew: true, Computed: true, Description: "The operating system of the workers in the default worker pool.", }, diff --git a/ibm/service/kubernetes/resource_ibm_container_vpc_cluster.go b/ibm/service/kubernetes/resource_ibm_container_vpc_cluster.go index 050ec628328..aecbba16f35 100644 --- a/ibm/service/kubernetes/resource_ibm_container_vpc_cluster.go +++ b/ibm/service/kubernetes/resource_ibm_container_vpc_cluster.go @@ -201,6 +201,7 @@ func ResourceIBMContainerVpcCluster() *schema.Resource { "operating_system": { Type: schema.TypeString, Optional: true, + ForceNew: true, Computed: true, Description: "The operating system of the workers in the default worker pool.", }, 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 90c4dd32f13..cbdcedcd195 100644 --- a/ibm/service/kubernetes/resource_ibm_container_vpc_cluster_test.go +++ b/ibm/service/kubernetes/resource_ibm_container_vpc_cluster_test.go @@ -81,7 +81,7 @@ func TestAccIBMContainerOpenshiftClusterBasic(t *testing.T) { name := fmt.Sprintf("tf-vpc-cluster-%d", acctest.RandIntRange(10, 100)) openshiftFlavour := "bx2.16x64" openShiftworkerCount := "2" - operatingSystem := "REDHAT_7_64" + operatingSystem := "REDHAT_8_64" var conf *v2.ClusterInfo resource.Test(t, resource.TestCase{ @@ -335,46 +335,31 @@ resource "ibm_container_vpc_cluster" "cluster" { }`, name) } func testAccCheckIBMContainerOcpClusterBasic(name, openshiftFlavour, openShiftworkerCount, operatingSystem string) string { - vpcName := "" - subnetName := "" - cosInstanceName := "" return fmt.Sprintf(` -provider "ibm" { - region="us-south" -} -data "ibm_resource_group" "resource_group" { - is_default=true -} -data "ibm_is_vpc" "vpc" { - name = "%s" -} - -data "ibm_is_subnet" "subnet" { - name = "%s" -} data "ibm_resource_instance" "cos_instance" { - name = "%s" + name = "%[5]s" } + resource "ibm_container_vpc_cluster" "cluster" { - name = "%s" - vpc_id = data.ibm_is_vpc.vpc.id - flavor = "%s" - worker_count = "%s" + name = "%[1]s" + vpc_id = "%[2]s" + flavor = "%[6]s" + worker_count = "%[7]s" kube_version = "4.11_openshift" - operating_system = "%s" + operating_system = "%[8]s" wait_till = "OneWorkerNodeReady" entitlement = "cloud_pak" cos_instance_crn = data.ibm_resource_instance.cos_instance.id - resource_group_id = data.ibm_resource_group.resource_group.id + resource_group_id = "%[3]s" zones { - subnet_id = data.ibm_is_subnet.subnet.id + subnet_id = "%[4]s" name = "us-south-1" } } data "ibm_container_cluster_config" "testacc_ds_cluster" { cluster_name_id = ibm_container_vpc_cluster.cluster.id } - `, vpcName, subnetName, cosInstanceName, name, openshiftFlavour, openShiftworkerCount, operatingSystem) + `, name, acc.IksClusterVpcID, acc.IksClusterResourceGroupID, acc.IksClusterSubnetID, acc.CosName, openshiftFlavour, openShiftworkerCount, operatingSystem) } 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 0243e24be26..88c87228c61 100644 --- a/ibm/service/kubernetes/resource_ibm_container_vpc_worker_pool.go +++ b/ibm/service/kubernetes/resource_ibm_container_vpc_worker_pool.go @@ -157,6 +157,7 @@ func ResourceIBMContainerVpcWorkerPool() *schema.Resource { Type: schema.TypeString, Computed: true, Optional: true, + ForceNew: true, Description: "The operating system of the workers in the worker pool.", }, 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 ddf773741e1..00392c6c377 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 @@ -392,14 +392,14 @@ func testAccCheckIBMOpcContainerWorkerPoolBasic(name, openshiftFlavour, openShif resource "ibm_container_vpc_worker_pool" "test_pool" { cluster = ibm_container_vpc_cluster.cluster.id worker_pool_name = "%[1]s" - flavor = "%s" - worker_count = "%s" - vpc_id = data.ibm_is_vpc.vpc.id - resource_group_id = data.ibm_resource_group.resource_group.id - operating_system = "%s" + flavor = "%[5]s" + worker_count = "%[6]s" + vpc_id = "%[2]s" + resource_group_id = "%[3]s" + operating_system = "%[7]s" entitlement = "cloud_pak" zones { - subnet_id = data.ibm_is_subnet.subnet.id + subnet_id = "%[4]s" name = "us-south-1" } labels = { @@ -407,5 +407,5 @@ func testAccCheckIBMOpcContainerWorkerPoolBasic(name, openshiftFlavour, openShif "test1" = "test-pool1" } } - `, name, openshiftFlavour, openShiftworkerCount, operatingSystem) + `, name, acc.IksClusterVpcID, acc.IksClusterResourceGroupID, acc.IksClusterSubnetID, openshiftFlavour, openShiftworkerCount, operatingSystem) } diff --git a/ibm/service/kubernetes/resource_ibm_container_worker_pool.go b/ibm/service/kubernetes/resource_ibm_container_worker_pool.go index 9d3f844f635..1aebbd2b3b5 100644 --- a/ibm/service/kubernetes/resource_ibm_container_worker_pool.go +++ b/ibm/service/kubernetes/resource_ibm_container_worker_pool.go @@ -74,6 +74,7 @@ func ResourceIBMContainerWorkerPool() *schema.Resource { Type: schema.TypeString, Computed: true, Optional: true, + ForceNew: true, Description: "The operating system of the workers in the worker pool.", }, diff --git a/website/docs/r/container_cluster.html.markdown b/website/docs/r/container_cluster.html.markdown index 2c2a1bb3172..a2e3d52ebca 100644 --- a/website/docs/r/container_cluster.html.markdown +++ b/website/docs/r/container_cluster.html.markdown @@ -215,7 +215,7 @@ Review the argument references that you can specify for your resource. - `machine_type` - (Optional, Forces new resource, String) The machine type for your worker node. The machine type determines the amount of memory, CPU, and disk space that is available to the worker node. For an overview of supported machine types, see [Planning your worker node setup](https://cloud.ibm.com/docs/containers?topic=containers-planning_worker_nodes). You can retrieve the value by executing the `ibmcloud ks machine-types ` command in the IBM Cloud CLI. - `name` - (Required, Forces new resource, String) The name of the cluster. The name must start with a letter, can contain letters, numbers, and hyphen (-), and must be 35 characters or fewer. Use a name that is unique across regions. The cluster name and the region in which the cluster is deployed form the fully qualified domain name for the Ingress subdomain. To ensure that the Ingress subdomain is unique within a region, the cluster name might be truncated and appended with a random value within the Ingress domain name. - `no_subnet` - (Optional, Forces new resource, Bool) If set to **true**, no portable subnet is created during cluster creation. The portable subnet is used to provide portable IP addresses for the Ingress subdomain and Kubernetes load balancer services. If set to **false**, a portable subnet is created by default. The default is **false**. -- `operating_system` - (Optional, String) The operating system of the workers in the default worker pool. For supported options, see [Red Hat OpenShift on IBM Cloud CLI reference](https://cloud.ibm.com/docs/openshift?topic=openshift-kubernetes-service-cli&interface=ui#cluster). +- `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). - `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. - `public_service_endpoint` - (Optional, Forces new resource, Bool) If set to **true**, your cluster is set up with a public service endpoint. You can use the public service endpoint to access the Kubernetes master from the public network. To use service endpoints, your account must be enabled for [Virtual Routing and Forwarding (VRF)](https://cloud.ibm.com/docs/account?topic=account-vrf-service-endpoint#vrf). For more information, see [Worker-to-master and user-to-master communication: Service endpoints](https://cloud.ibm.com/docs/containers?topic=containers-plan_clusters#workeruser-master). If set to **false**, the public service endpoint is disabled for your cluster. - `public_vlan_id` - (Optional, Forces new resource, String) The ID of the public VLAN that you want to use for your worker nodes. You can retrieve the VLAN ID with the `ibmcloud ks vlans --zone ` command.

* **Free clusters**: If you want to provision a free cluster, you do not need to enter a public VLAN ID. Your cluster is automatically connected to a public VLAN that is owned by IBM.
* **Standard clusters**: If you create a standard cluster and you have an existing public VLAN ID for the zone where you plan to set up worker nodes, you must enter the VLAN ID. To retrieve the ID, run `ibmcloud ks vlans --zone `. If you do not have an existing public VLAN ID, or you want to connect your cluster to a private VLAN only, do not specify this option. **Note**: The prerequisite for using service endpoints, account must be enabled for [Virtual Routing and Forwarding (VRF)](https://cloud.ibm.com/docs/infrastructure/direct-link/vrf-on-ibm-cloud.html#overview-of-virtual-routing-and-forwarding-vrf-on-ibm-cloud). Account must be enabled for connectivity to service endpoints. Use the resource `ibm_container_cluster_feature` to update the `public_service_endpoint` and `private_service_endpoint`. diff --git a/website/docs/r/container_vpc_cluster.html.markdown b/website/docs/r/container_vpc_cluster.html.markdown index 1a406423839..adec2d49e3f 100644 --- a/website/docs/r/container_vpc_cluster.html.markdown +++ b/website/docs/r/container_vpc_cluster.html.markdown @@ -186,7 +186,7 @@ Review the argument references that you can specify for your resource. - `instance_id` - (Optional, String) The GUID of the Key Protect instance. - `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, String) The operating system of the workers in the default worker pool. For supported options, see [Red Hat OpenShift on IBM Cloud CLI reference](https://cloud.ibm.com/docs/openshift?topic=openshift-kubernetes-service-cli&interface=ui#cluster). +- `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). - `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 833555d8e5e..4d6a3aa340c 100644 --- a/website/docs/r/container_vpc_worker_pool.html.markdown +++ b/website/docs/r/container_vpc_worker_pool.html.markdown @@ -82,7 +82,7 @@ Review the argument references that you can specify for your resource. - `flavor` - (Required, Forces new resource, String) The flavor of the worker node. - `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, String) The operating system of the workers in the worker pool. For supported options, see [Red Hat OpenShift on IBM Cloud CLI reference](https://cloud.ibm.com/docs/openshift?topic=openshift-kubernetes-service-cli&interface=ui#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). - `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 diff --git a/website/docs/r/container_worker_pool.html.markdown b/website/docs/r/container_worker_pool.html.markdown index 64fbe03a982..4d278380a0a 100644 --- a/website/docs/r/container_worker_pool.html.markdown +++ b/website/docs/r/container_worker_pool.html.markdown @@ -68,7 +68,7 @@ Review the argument references that you can specify for your resource. - `labels` - (Optional, Map) A list of labels that you want to add to your worker pool. The labels can help you find the worker pool more easily later. - `machine_type` - (Required, Forces new resource, String) The machine type for your worker node. The machine type determines the amount of memory, CPU, and disk space that is available to the worker node. For an overview of supported machine types, see [Planning your worker node setup](https://cloud.ibm.com/docs/containers?topic=containers-planning_worker_nodes). - `name` - (Required, Forces new resource, String) The name of the worker pool. -- `operating_system` - (Optional, String) The operating system of the workers in the worker pool. For supported options, see [Red Hat OpenShift on IBM Cloud CLI reference](https://cloud.ibm.com/docs/openshift?topic=openshift-kubernetes-service-cli&interface=ui#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). - `resource_group_id` - (Optional, Forces new resource, String) The ID of the resource group where your cluster is provisioned into. To list resource groups, run `ibmcloud resource groups` or use the `ibm_resource_group` data source. - `size_per_zone` - (Required, Integer) The number of worker nodes per zone that you want to add to the worker pool. - `taints` - (Optional, Set) A nested block that sets or removes Kubernetes taints for all worker nodes in a worker pool