Skip to content

Commit

Permalink
add ForceNew tag to OS fileds, updated doc
Browse files Browse the repository at this point in the history
  • Loading branch information
Zoltan Illes committed Jan 12, 2023
1 parent 36113c1 commit fc2451e
Show file tree
Hide file tree
Showing 11 changed files with 33 additions and 37 deletions.
7 changes: 7 additions & 0 deletions ibm/acctest/acctest.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,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
Expand Down Expand Up @@ -318,6 +319,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"
Expand Down
1 change: 1 addition & 0 deletions ibm/service/kubernetes/resource_ibm_container_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
},
Expand Down
37 changes: 11 additions & 26 deletions ibm/service/kubernetes/resource_ibm_container_vpc_cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down Expand Up @@ -335,46 +335,31 @@ resource "ibm_container_vpc_cluster" "cluster" {
}`, name)
}
func testAccCheckIBMContainerOcpClusterBasic(name, openshiftFlavour, openShiftworkerCount, operatingSystem string) string {
vpcName := "<test-vpc-name>"
subnetName := "<test-subnet-name>"
cosInstanceName := "<test-cos-name>"
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)

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -392,20 +392,20 @@ 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 = {
"test" = "test-pool"
"test1" = "test-pool1"
}
}
`, name, openshiftFlavour, openShiftworkerCount, operatingSystem)
`, name, acc.IksClusterVpcID, acc.IksClusterResourceGroupID, acc.IksClusterSubnetID, openshiftFlavour, openShiftworkerCount, operatingSystem)
}
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
},

Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/container_cluster.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,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 <data-center>` 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, 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 <cluster_name_or_id> 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 <zone>` command. </br></br> * **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. </br> * **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 <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`.
Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/container_vpc_cluster.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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, 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 <cluster_name_or_id> 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.
Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/container_vpc_worker_pool.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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, 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

Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/container_worker_pool.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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, 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
Expand Down

0 comments on commit fc2451e

Please sign in to comment.