Skip to content

Commit 12451d6

Browse files
authored
Merge pull request #621 from rawmind0/gkev2
Added rancher2_cluster support to gke config v2
2 parents 3a138db + 14d1013 commit 12451d6

29 files changed

Lines changed: 2511 additions & 88 deletions

CHANGELOG.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## 1.14.0 (Unreleased)
1+
## 1.14.0 (May 7, 2021)
22

33
FEATURES:
44

@@ -10,11 +10,15 @@ FEATURES:
1010
* **New Argument:** `rancher2_cluster.rke_config.ingress.update_strategy` - (Optional) RKE ingress update strategy (list Maxitems: 1)
1111
* **New Argument:** `rancher2_cluster.rke2_config` - (Optional/Computed) The RKE2 configuration for `rke2` Clusters. Conflicts with `aks_config`, `eks_config`, `gke_config`, `oke_config`, `k3s_config` and `rke_config` (list maxitems:1)
1212
* **New Argument:** `rancher2_cluster_sync.wait_alerting` - (Optional) Wait until alerting is up and running. Default: `false` (bool)
13+
* **New Argument:** `rancher2_cluster.gke_config_v2` - (Optional) The Google GKE V2 configuration for `gke` Clusters. Conflicts with `aks_config`, `eks_config`, `eks_config_v2`, `gke_config`, `oke_config`, `k3s_config` and `rke_config`. For Rancher v2.5.8 or above (list maxitems:1)
14+
* **New Argument:** `rancher2_cloud_credential.google_credential_config` - (Optional) Google config for the Cloud Credential (list maxitems:1)
1315

1416
ENHANCEMENTS:
1517

16-
* Improved `rancher2_cluster_sync` with new cluster state check method and new option to wait until alerting is enabled
1718
* Updated `rancher2_catalog_v2` schema resource, defining conflict between `git_repo` and `url` arguments
19+
* Improved `rancher2_cluster_sync` with new cluster state check method and new option to wait until alerting is enabled
20+
* Updated go mod to support Rancher `v2.5.8`
21+
* Updated acceptance tests to use Rancher `v2.5.8`
1822

1923
BUG FIXES:
2024

docs/data-sources/cluster.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,15 @@ The following attributes are exported:
3131
* `kube_config` - (Computed) Kube Config generated for the cluster (string)
3232
* `ca_cert` - (Computed) K8s cluster ca cert (string)
3333
* `system_project_id` - (Computed) System project ID for the cluster (string)
34-
* `rke_config` - (Computed) The RKE configuration for `rke` Clusters. Conflicts with `aks_config`, `eks_config`, `gke_config`, `oke_config`, `k3s_config` and `rke2_config` (list maxitems:1)
34+
* `rke_config` - (Computed) The RKE configuration for `rke` Clusters. Conflicts with `aks_config`, `eks_config`, `eks_config_v2`, `gke_config`, `gke_config_v2`, `oke_config` and `k3s_config` (list maxitems:1)
3535
* `rke2_config` - (Computed) The RKE2 configuration for `rke2` Clusters. Conflicts with `aks_config`, `eks_config`, `gke_config`, `oke_config`, `k3s_config` and `rke_config` (list maxitems:1)
36-
* `k3s_config` - (Computed) The K3S configuration for `k3s` imported Clusters. Conflicts with `aks_config`, `eks_config`, `gke_config`, `oke_config`, `rke_config` and `rke2_config` (list maxitems:1)
37-
* `aks_config` - (Computed) The Azure AKS configuration for `aks` Clusters. Conflicts with `eks_config`, `eks_config_v2`, `gke_config`, `oke_config` `k3s_config`, `rke_config` and `rke2_config` (list maxitems:1)
38-
* `eks_config` - (Computed) The Amazon EKS configuration for `eks` Clusters. Conflicts with `aks_config`, `eks_config_v2`, `gke_config`, `oke_config` `k3s_config`, `rke_config` and `rke2_config` (list maxitems:1)
39-
* `eks_config_v2` - (Computed) The Amazon EKS configuration to create or import `eks` Clusters. Conflicts with `aks_config`, `eks_config`, `gke_config`, `oke_config` `k3s_config`, `rke_config` and `rke2_config`. For Rancher v2.5.x or above (list maxitems:1)
40-
* `gke_config` - (Computed) The Google GKE configuration for `gke` Clusters. Conflicts with `aks_config`, `eks_config`, `eks_import`, `oke_config` `k3s_config`, `rke_config` and `rke2_config` (list maxitems:1)
41-
* `oke_config` - (Computed) The Oracle OKE configuration for `oke` Clusters. Conflicts with `aks_config`, `eks_config`, `eks_import`, `gke_config` `k3s_config`, `rke_config` and `rke2_config` (list maxitems:1)
36+
* `k3s_config` - (Computed) The K3S configuration for `k3s` imported Clusters. Conflicts with `aks_config`, `eks_config`, `eks_config_v2`, `gke_config`, `gke_config_v2`, `oke_config` and `rke_config` (list maxitems:1)
37+
* `aks_config` - (Computed) The Azure aks configuration for `aks` Clusters. Conflicts with `eks_config`, `eks_config_v2`, `gke_config`, `gke_config_v2`, `oke_config`, `k3s_config` and `rke_config` (list maxitems:1)
38+
* `eks_config` - (Computed) The Amazon eks configuration for `eks` Conflicts with `aks_config`, `eks_config_v2`, `gke_config`, `gke_config_v2`, `oke_config`, `k3s_config` and `rke_config` (list maxitems:1)
39+
* `eks_config_v2` - (Computed) The Amazon EKS V2 configuration to create or import `eks` Clusters. Conflicts with `aks_config`, `eks_config`, `gke_config`, `gke_config_v2`, `oke_config`, `k3s_config` and `rke_config`. For Rancher v2.5.x or above (list maxitems:1)
40+
* `gke_config` - (Computed) The Google gke configuration for `gke` Clusters. Conflicts with `aks_config`, `eks_config`, `eks_config_v2`, `gke_config_v2`, `oke_config`, `k3s_config` and `rke_config` (list maxitems:1) (list maxitems:1)
41+
* `gke_config_v2` - (Computed) The Google GKE V2 configuration for `gke` Clusters. Conflicts with `aks_config`, `eks_config`, `eks_config_v2`, `gke_config`, `oke_config`, `k3s_config` and `rke_config`. For Rancher v2.5.8 or above (list maxitems:1)
42+
* `oke_config` - (Computed) The Oracle OKE configuration for `oke` Clusters. Conflicts with `aks_config`, `eks_config`, `eks_config_v2`, `gke_config`, `gke_config_v2`, `k3s_config` and `rke_config` (list maxitems:1)
4243
* `description` - (Computed) The description for Cluster (string)
4344
* `cluster_auth_endpoint` - (Computed) Enabling the [local cluster authorized endpoint](https://rancher.com/docs/rancher/v2.x/en/cluster-provisioning/rke-clusters/options/#local-cluster-auth-endpoint) allows direct communication with the cluster, bypassing the Rancher API proxy. (list maxitems:1)
4445
* `cluster_monitoring_input` - (Computed) Cluster monitoring config (list maxitems:1)

docs/resources/cloud_credential.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ The following arguments are supported:
3131
* `azure_credential_config` - (Optional) Azure config for the Cloud Credential (list maxitems:1)
3232
* `description` - (Optional) Description for the Cloud Credential (string)
3333
* `digitalocean_credential_config` - (Optional) DigitalOcean config for the Cloud Credential (list maxitems:1)
34+
* `google_credential_config` - (Optional) Google config for the Cloud Credential (list maxitems:1)
3435
* `linode_credential_config` - (Optional) Linode config for the Cloud Credential (list maxitems:1)
3536
* `openstack_credential_config` - (Optional) OpenStack config for the Cloud Credential (list maxitems:1)
3637
* `vsphere_credential_config` - (Optional) vSphere config for the Cloud Credential (list maxitems:1)
@@ -67,6 +68,12 @@ The following attributes are exported:
6768

6869
* `access_token` - (Required/Sensitive) DigitalOcean access token (string)
6970

71+
### `google_credential_config`
72+
73+
#### Arguments
74+
75+
* `auth_encoded_json` - (Required/Sensitive) Google auth encoded json (string)
76+
7077
### `linode_credential_config`
7178

7279
#### Arguments

docs/resources/cluster.md

Lines changed: 186 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -442,19 +442,78 @@ resource "rancher2_cluster" "foo" {
442442
}
443443
```
444444

445+
### Importing GKE cluster from Rancher v2, using `gke_config_v2`. For Rancher v2.5.8 or above.
446+
447+
```hcl
448+
resource "rancher2_cloud_credential" "foo-google" {
449+
name = "foo-google"
450+
description= "Terraform cloudCredential acceptance test"
451+
google_credential_config {
452+
auth_encoded_json = file(<GOOGLE_AUTH_ENCODED_JSON>)
453+
}
454+
}
455+
456+
resource "rancher2_cluster" "foo" {
457+
name = "foo"
458+
description = "Foo rancher2 imported GKE cluster"
459+
gke_config_v2 {
460+
name = "foo"
461+
google_credential_secret = rancher2_cloud_credential.foo-google.id
462+
region = <REGION> # Zone argument could also be used instead of region
463+
project_id = <PROJECT_ID>
464+
imported = true
465+
}
466+
}
467+
```
468+
469+
### Creating GKE cluster from Rancher v2, using `gke_config_v2`. For Rancher v2.5.8 or above.
470+
471+
**Note** At the moment, routed-based GKE clusters are not supported due to [rancher/issues/32585]](https://github.com/rancher/rancher/issues/32585)
472+
473+
```
474+
resource "rancher2_cloud_credential" "foo-google" {
475+
name = "foo-google"
476+
description= "Terraform cloudCredential acceptance test"
477+
google_credential_config {
478+
auth_encoded_json = file(<GOOGLE_AUTH_ENCODED_JSON>)
479+
}
480+
}
481+
482+
resource "rancher2_cluster" "foo" {
483+
name = "foo"
484+
description = "Terraform GKE cluster"
485+
gke_config_v2 {
486+
name = "foo"
487+
google_credential_secret = rancher2_cloud_credential.foo-google.id
488+
region = <REGION> # Zone argument could also be used instead of region
489+
project_id = <PROJECT_ID>
490+
kubernetes_version = <K8S_VERSION>
491+
network = <NETWORK>
492+
subnetwork = <SUBNET>
493+
node_pools {
494+
initial_node_count = 1
495+
max_pods_constraint = 110
496+
name = <NODE_POOL_NAME>
497+
version = <VERSION>
498+
}
499+
}
500+
}
501+
```
502+
445503
## Argument Reference
446504

447505
The following arguments are supported:
448506

449507
* `name` - (Required) The name of the Cluster (string)
450-
* `rke_config` - (Optional/Computed) The RKE configuration for `rke` Clusters. Conflicts with `aks_config`, `eks_config`, `gke_config`, `oke_config`, `k3s_config` and `rke2_config` (list maxitems:1)
508+
* `rke_config` - (Optional/Computed) The RKE configuration for `rke` Clusters. Conflicts with `aks_config`, `eks_config`, `eks_config_v2`, `gke_config`, `gke_config_v2`, `oke_config` and `k3s_config` (list maxitems:1)
451509
* `rke2_config` - (Optional/Computed) The RKE2 configuration for `rke2` Clusters. Conflicts with `aks_config`, `eks_config`, `gke_config`, `oke_config`, `k3s_config` and `rke_config` (list maxitems:1)
452-
* `k3s_config` - (Optional/Computed) The K3S configuration for `k3s` imported Clusters. Conflicts with `aks_config`, `eks_config`, `gke_config`, `oke_config`, `rke_config` and `rke2_config` (list maxitems:1)
453-
* `aks_config` - (Optional) The Azure AKS configuration for `aks` Clusters. Conflicts with `eks_config`, `eks_config_v2`, `gke_config`, `oke_config` `k3s_config`, `rke_config` and `rke2_config` (list maxitems:1)
454-
* `eks_config` - (Optional) The Amazon EKS configuration for `eks` Clusters. Conflicts with `aks_config`, `eks_config_v2`, `gke_config`, `oke_config` `k3s_config`, `rke_config` and `rke2_config` (list maxitems:1)
455-
* `eks_config_v2` - (Optional) The Amazon EKS configuration to create or import `eks` Clusters. Conflicts with `aks_config`, `eks_config`, `gke_config`, `oke_config` `k3s_config`, `rke_config` and `rke2_config`. For Rancher v2.5.x or above (list maxitems:1)
456-
* `gke_config` - (Optional) The Google GKE configuration for `gke` Clusters. Conflicts with `aks_config`, `eks_config`, `eks_import`, `oke_config` `k3s_config`, `rke_config` and `rke2_config` (list maxitems:1)
457-
* `oke_config` - (Optional) The Oracle OKE configuration for `oke` Clusters. Conflicts with `aks_config`, `eks_config`, `eks_import`, `gke_config` `k3s_config`, `rke_config` and `rke2_config` (list maxitems:1)
510+
* `k3s_config` - (Optional/Computed) The K3S configuration for `k3s` imported Clusters. Conflicts with `aks_config`, `eks_config`, `eks_config_v2`, `gke_config`, `gke_config_v2`, `oke_config` and `rke_config` (list maxitems:1)
511+
* `aks_config` - (Optional) The Azure AKS configuration for `aks` Clusters. Conflicts with `eks_config`, `eks_config_v2`, `gke_config`, `gke_config_v2`, `oke_config` `k3s_config` and `rke_config` (list maxitems:1)
512+
* `eks_config` - (Optional) The Amazon EKS configuration for `eks` Clusters. Conflicts with `aks_config`, `eks_config_v2`, `gke_config`, `gke_config_v2`, `oke_config` `k3s_config` and `rke_config` (list maxitems:1)
513+
* `eks_config_v2` - (Optional) The Amazon EKS V2 configuration to create or import `eks` Clusters. Conflicts with `aks_config`, `eks_config`, `gke_config`, `gke_config_v2`, `oke_config` `k3s_config` and `rke_config`. For Rancher v2.5.x or above (list maxitems:1)
514+
* `gke_config` - (Optional) The Google GKE configuration for `gke` Clusters. Conflicts with `aks_config`, `eks_config`, `eks_config_v2`, `gke_config_v2`, `oke_config`, `k3s_config` and `rke_config` (list maxitems:1)
515+
* `gke_config_v2` - (Optional) The Google GKE V2 configuration for `gke` Clusters. Conflicts with `aks_config`, `eks_config`, `eks_config_v2`, `gke_config`, `oke_config`, `k3s_config` and `rke_config`. For Rancher v2.5.8 or above (list maxitems:1)
516+
* `oke_config` - (Optional) The Oracle OKE configuration for `oke` Clusters. Conflicts with `aks_config`, `eks_config`, `eks_config_v2`, `gke_config`, `gke_config_v2`, `k3s_config` and `rke_config` (list maxitems:1)
458517
* `description` - (Optional) The description for Cluster (string)
459518
* `cluster_auth_endpoint` - (Optional/Computed) Enabling the [local cluster authorized endpoint](https://rancher.com/docs/rancher/v2.x/en/cluster-provisioning/rke-clusters/options/#local-cluster-auth-endpoint) allows direct communication with the cluster, bypassing the Rancher API proxy. (list maxitems:1)
460519
* `cluster_monitoring_input` - (Optional) Cluster monitoring config. Any parameter defined in [rancher-monitoring charts](https://github.com/rancher/system-charts/tree/dev/charts/rancher-monitoring) could be configured (list maxitems:1)
@@ -1275,6 +1334,126 @@ The following arguments are supported:
12751334
* `taints` - (Required) List of Kubernetes taints to be applied to each node (list)
12761335
* `zone` - (Optional) GKE cluster zone. Conflicts with `region` (string)
12771336

1337+
### `gke_config_v2`
1338+
1339+
#### Arguments
1340+
1341+
* `name` - (Required/ForceNew) The GKE ip v4 cidr block (string)
1342+
* `google_credential_secret` - (Required/Sensitive) Google credential secret (string)
1343+
* `project_id` - (Required/ForceNew) The GKE cluster project id (string)
1344+
* `cluster_ipv4_cidr_block` - (Optional/Computed/ForceNew) The GKE ip v4 cidr block (string)
1345+
* `cluster_addons` - (Optional/Computed) The GKE cluster addons (List maxitems:1)
1346+
* `description` - (Optional/Computed/ForceNew) The GKE cluster addons (string)
1347+
* `enable_kubernetes_alpha` - (Optional/Computed/ForceNew) Enable Kubernetes alpha. Default: `false` (bool)
1348+
* `ip_allocation_policy` - (Optional/Computed/ForceNew) The GKE ip allocation policy (List maxitems:1)
1349+
* `imported` - (Optional/ForceNew) Is GKE cluster imported? Default: `false` (bool)
1350+
* `kubernetes_version` - (Optional/Computed) The kubernetes master version. Required for create new cluster (string)
1351+
* `labels` - (Optional/Computed) The GKE cluster labels (map)
1352+
* `locations` - (Optional/Computed) The GKE cluster locations (List)
1353+
* `logging_service` - (Optional/Computed) The GKE cluster logging service (string)
1354+
* `maintenance_window` - (Optional/Computed) The GKE cluster maintenance window (string)
1355+
* `master_authorized_networks_config` - (Optional/Computed/ForceNew) The GKE cluster master authorized networks config (List maxitems:1)
1356+
* `monitoring_service` - (Optional/Computed) The GKE cluster monitoring service (string)
1357+
* `network` - (Optional/Computed/ForceNew) The GKE cluster network. Required for create new cluster (string)
1358+
* `network_policy_enabled` - (Optional/Computed) Is GKE cluster network policy enabled? Default: `false` (bool)
1359+
* `node_pools` - (Optional/Computed) The GKE cluster node pools. Required for create new cluster (List)
1360+
* `private_cluster_config` - (Optional/Computed/ForceNew) The GKE private cluster config (List maxitems:1)
1361+
* `region` - (Optional/Computed/ForceNew) The GKE cluster region. Required if `zone` not set (string)
1362+
* `subnetwork` - (Optional/Computed/ForceNew) The GKE cluster subnetwork. Required for create new cluster (string)
1363+
* `zone` - (Optional/Computed/ForceNew) The GKE cluster zone. Required if `region` not set (string)
1364+
1365+
#### `cluster_addons`
1366+
1367+
##### Arguments
1368+
1369+
* `http_load_balancing` - (Optional/Computed) Enable GKE HTTP load balancing. Default: `false` (bool)
1370+
* `horizontal_pod_autoscaling` - (Optional/Computed) Enable GKE horizontal pod autoscaling. Default: `false` (bool)
1371+
* `network_policy_config` - (Optional/Computed) Enable GKE network policy config. Default: `false` (bool)
1372+
1373+
#### `ip_allocation_policy`
1374+
1375+
##### Arguments
1376+
1377+
* `cluster_ipv4_cidr_block` - (Optional/Computed) The GKE cluster ip v4 allocation cidr block (string)
1378+
* `cluster_secondary_range_name` - (Optional/Computed) The GKE cluster ip v4 allocation secondary range name(string)
1379+
* `create_subnetwork` - (Optional/Computed) Create GKE subnetwork? Default: `false` (bool)
1380+
* `node_ipv4_cidr_block` - (Optional/Computed) The GKE node ip v4 allocation cidr block (string)
1381+
* `services_ipv4_cidr_block` - (Optional/Computed) The GKE services ip v4 allocation cidr block (string)
1382+
* `services_secondary_range_name` - (Optional/Computed) The GKE services ip v4 allocation secondary range name (string)
1383+
* `subnetwork_name` - (Optional/Computed) The GKE cluster subnetwork name (string)
1384+
* `use_ip_aliases` - (Optional/Computed) Use GKE ip aliases? Default: `true` (bool)
1385+
1386+
#### `master_authorized_networks_config`
1387+
1388+
##### Arguments
1389+
1390+
* `cidr_blocks` - (Required) The GKE master authorized network config cidr blocks (List)
1391+
* `enabled` - (Optional) Enable GKE master authorized network config Default: `false` (bool)
1392+
1393+
##### `cidr_blocks`
1394+
1395+
###### Arguments
1396+
1397+
* `cidr_block` - (Required) The GKE master authorized network config cidr block (string)
1398+
* `display_name` - (Optional) The GKE master authorized network config cidr block dispaly name (string)
1399+
1400+
#### `node_pools`
1401+
1402+
##### Arguments
1403+
1404+
* `name` - (Required) The GKE node pool config name (string)
1405+
* `initial_node_count` - (Required) The GKE node pool config initial node count (int)
1406+
* `version` - (Required) The GKE node pool config version. Required for create new cluster (string)
1407+
* `autoscaling` - (Optional/computed) The GKE node pool config autoscaling (List maxitems:1)
1408+
* `config` - (Optional/Computed/ForceNew) The GKE node pool node config (List maxitems:1)
1409+
* `management` - (Optional/Computed) The GKE node pool config management (List maxitems:1)
1410+
* `max_pods_constraint` - (Optional/Computed) The GKE node pool config max pods constraint. Required for create new cluster if `ip_allocation_policy.use_ip_aliases = true` (int)
1411+
1412+
##### `autoscaling`
1413+
1414+
###### Arguments
1415+
1416+
* `enabled` - (Optional) Enable GKE node pool config autoscaling. Default: `false` (bool)
1417+
* `max_node_count` - (Optional/Computed) The GKE node pool config max node count (int)
1418+
* `min_node_count` - (Optional/Computed) The GKE node pool config min node count (int)
1419+
1420+
##### `config`
1421+
1422+
###### Arguments
1423+
1424+
* `disk_size_gb` - (Optional/Computed) The GKE node config disk size Gb (int)
1425+
* `disk_type` - (Optional/Computed) The GKE node config disk type (string)
1426+
* `image_type` - (Optional/Computed) The GKE node config image type (string)
1427+
* `labels` - (Optional/Computed) The GKE node config labels (map)
1428+
* `local_ssd_count` - (Optional/Computed) The GKE node config local ssd count (int)
1429+
* `machine_type` - (Optional/Computed) The GKE node config machine type (string)
1430+
* `oauth_scopes` - (Optional) The GKE node config oauth scopes (List)
1431+
* `preemptible` - (Optional) Enable GKE node config preemptible. Default: `false` (bool)
1432+
* `taints` - (Optional) The GKE node config taints (List)
1433+
1434+
###### `taints`
1435+
1436+
####### Arguments
1437+
1438+
* `key` - (Required) The GKE taint key (string)
1439+
* `value` - (Required) The GKE taint value (string)
1440+
* `effect` - (Required) The GKE taint effect (string)
1441+
1442+
##### `management`
1443+
1444+
###### Arguments
1445+
1446+
* `auto_repair` - (Optional/Computed) Enable GKE node pool config management auto repair. Default: `false` (bool)
1447+
* `auto_upgrade` - (Optional/Computed) Enable GKE node pool config management auto upgrade. Default: `false` (bool)
1448+
1449+
#### `private_cluster_config`
1450+
1451+
##### Arguments
1452+
1453+
* `master_ipv4_cidr_block` - (Required) The GKE cluster private master ip v4 cidr block (string)
1454+
* `enable_private_endpoint` - (Optional) Enable GKE cluster private endpoint. Default: `false` (bool)
1455+
* `enable_private_nodes` - (Optional) Enable GKE cluster private endpoint. Default: `false` (bool)
1456+
12781457
### `oke_config`
12791458

12801459
#### Arguments

0 commit comments

Comments
 (0)