Skip to content

Commit 7c33c9e

Browse files
committed
update doc terraform vks
1 parent d185bfd commit 7c33c9e

File tree

2 files changed

+112
-1
lines changed

2 files changed

+112
-1
lines changed

docs/resources/vks_cluster.md

+57-1
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,62 @@ resource "vngcloud_vks_cluster" "primary" {
7171
* `enabled_load_balancer_plugin` (Optional) Enables the attachment of load balancers (both network and application) via Kubernetes YAML. The default value is "true".
7272
* `enabled_block_store_csi_plugin`(Optional) Automatically deploys and manages the BlockStore Persistent Disk CSI Driver via Kubernetes YAML. The default value is "true".
7373

74+
---
75+
### **Some important notes when using VKS with Terraform:**
76+
77+
When using **Terraform** to create a **Cluster** and **Node Group** on the VKS system, if you modify any of the following fields, the system will automatically delete the existing Node Group/Cluster and recreate a new one with the corresponding new parameters. The deletion process will occur before the creation of the new Node Group/Cluster.
78+
79+
* For the resource `vngcloud_vks_cluster`, the fields that, when modified, will cause the system to delete and recreate the Cluster include:
80+
* `name` 
81+
* `description` 
82+
* `enable_private_cluster` 
83+
* `network_type` 
84+
* `vpc_id` 
85+
* `subnet_id` 
86+
* `cidr` 
87+
* `enabled_load_balancer_plugin` 
88+
* `enabled_block_store_csi_plugin` 
89+
* `node_group` 
90+
* `secondary_subnets` 
91+
* `node_netmask_size`
92+
* For the resource `vngcloud_vks_cluster_node_group`, the fields that, when modified, will cause the system to delete and recreate the Node Group include:
93+
* `cluster_id` 
94+
* `name` 
95+
* `flavor_id` 
96+
* `disk_size` 
97+
* `disk_type` 
98+
* `enable_private_nodes` 
99+
* `ssh_key_id` 
100+
* `secondary_subnets` 
101+
* `enabled_encryption_volume` 
102+
* `subnet_id`
103+
104+
To specify that the system should create a new cluster/node group before deleting the old one, you can add the parameter `lifecycle { create_before_destroy = true }`to your main.tf file. Specifically:
105+
106+
* For the resource `vngcloud_vks_cluster`
107+
108+
```
109+
resource "vngcloud_vks_cluster" "example" {
110+
# ...
111+
112+
lifecycle {
113+
create_before_destroy = true
114+
}
115+
}
116+
```
117+
118+
* For the resource `vngcloud_vks_cluster_node_group`
119+
120+
```
121+
resource "vngcloud_vks_cluster_node_group" "example" {
122+
# ...
123+
124+
lifecycle {
125+
create_before_destroy = true
126+
}
127+
}
128+
```
129+
74130
---
75131

76132
### Example Usage 1 - Create a Cluster with Network type CALICO OVERLAY and a Node Group with AutoScale Mode
@@ -216,4 +272,4 @@ resource "vngcloud_vks_cluster_node_group" "primary" {
216272
effect = "PreferNoSchedule"
217273
}
218274
}
219-
```
275+
```

docs/resources/vks_cluster_node_group.md

+55
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,61 @@ resource "vngcloud_vks_cluster_node_group" "primary" {
9090
* `effect` - (Optional) - The effect for the taint. Accepted values are `NoSchedule`, `PreferNoSchedule`, and `NoExecute`.
9191

9292
---
93+
### **Some important notes when using VKS with Terraform:**
94+
95+
When using **Terraform** to create a **Cluster** and **Node Group** on the VKS system, if you modify any of the following fields, the system will automatically delete the existing Node Group/Cluster and recreate a new one with the corresponding new parameters. The deletion process will occur before the creation of the new Node Group/Cluster.
96+
97+
* For the resource `vngcloud_vks_cluster`, the fields that, when modified, will cause the system to delete and recreate the Cluster include:
98+
* `name` 
99+
* `description` 
100+
* `enable_private_cluster` 
101+
* `network_type` 
102+
* `vpc_id` 
103+
* `subnet_id` 
104+
* `cidr` 
105+
* `enabled_load_balancer_plugin` 
106+
* `enabled_block_store_csi_plugin` 
107+
* `node_group` 
108+
* `secondary_subnets` 
109+
* `node_netmask_size`
110+
* For the resource `vngcloud_vks_cluster_node_group`, the fields that, when modified, will cause the system to delete and recreate the Node Group include:
111+
* `cluster_id` 
112+
* `name` 
113+
* `flavor_id` 
114+
* `disk_size` 
115+
* `disk_type` 
116+
* `enable_private_nodes` 
117+
* `ssh_key_id` 
118+
* `secondary_subnets` 
119+
* `enabled_encryption_volume` 
120+
* `subnet_id`
121+
122+
To specify that the system should create a new cluster/node group before deleting the old one, you can add the parameter `lifecycle { create_before_destroy = true }`to your main.tf file. Specifically:
123+
124+
* For the resource `vngcloud_vks_cluster`
125+
126+
```
127+
resource "vngcloud_vks_cluster" "example" {
128+
# ...
129+
130+
lifecycle {
131+
create_before_destroy = true
132+
}
133+
}
134+
```
135+
136+
* For the resource `vngcloud_vks_cluster_node_group`
137+
138+
```
139+
resource "vngcloud_vks_cluster_node_group" "example" {
140+
# ...
141+
142+
lifecycle {
143+
create_before_destroy = true
144+
}
145+
}
146+
```
147+
---
93148

94149
### Example Usage 1 - Create a Cluster with Network type CALICO OVERLAY and a Node Group with AutoScale Mode
95150

0 commit comments

Comments
 (0)