@@ -31,29 +31,7 @@ resource "huaweicloud_as_group" "my_as_group" {
31
31
networks {
32
32
id = var.subnet_id
33
33
}
34
- }
35
- ```
36
-
37
- ### Autoscaling Group with tags
38
-
39
- ``` hcl
40
- variable "configuration_id" {}
41
- variable "vpc_id" {}
42
- variable "subnet_id" {}
43
34
44
- resource "huaweicloud_as_group" "my_as_group_tags" {
45
- scaling_group_name = "my_as_group_tags"
46
- scaling_configuration_id = var.configuration_id
47
- desire_instance_number = 2
48
- min_instance_number = 0
49
- max_instance_number = 10
50
- vpc_id = var.vpc_id
51
- delete_publicip = true
52
- delete_instances = "yes"
53
-
54
- networks {
55
- id = var.subnet_id
56
- }
57
35
tags = {
58
36
foo = "bar"
59
37
key = "value"
@@ -92,23 +70,23 @@ variable "vpc_id" {}
92
70
variable "subnet_id" {}
93
71
variable "ipv4_subnet_id" {}
94
72
95
- resource "huaweicloud_lb_loadbalancer" "loadbalancer_1 " {
96
- name = "loadbalancer_1 "
73
+ resource "huaweicloud_lb_loadbalancer" "test " {
74
+ name = "test_name "
97
75
vip_subnet_id = var.ipv4_subnet_id
98
76
}
99
77
100
- resource "huaweicloud_lb_listener" "listener_1 " {
101
- name = "listener_1 "
78
+ resource "huaweicloud_lb_listener" "test " {
79
+ name = "test_name "
102
80
protocol = "HTTP"
103
81
protocol_port = 8080
104
- loadbalancer_id = huaweicloud_lb_loadbalancer.loadbalancer_1 .id
82
+ loadbalancer_id = huaweicloud_lb_loadbalancer.test .id
105
83
}
106
84
107
- resource "huaweicloud_lb_pool" "pool_1 " {
108
- name = "pool_1 "
85
+ resource "huaweicloud_lb_pool" "test " {
86
+ name = "test_name "
109
87
protocol = "HTTP"
110
88
lb_method = "ROUND_ROBIN"
111
- listener_id = huaweicloud_lb_listener.listener_1 .id
89
+ listener_id = huaweicloud_lb_listener.test .id
112
90
}
113
91
114
92
resource "huaweicloud_as_group" "my_as_group_with_enhanced_lb" {
@@ -123,8 +101,8 @@ resource "huaweicloud_as_group" "my_as_group_with_enhanced_lb" {
123
101
id = var.subnet_id
124
102
}
125
103
lbaas_listeners {
126
- pool_id = huaweicloud_lb_pool.pool_1 .id
127
- protocol_port = huaweicloud_lb_listener.listener_1 .protocol_port
104
+ pool_id = huaweicloud_lb_pool.test .id
105
+ protocol_port = huaweicloud_lb_listener.test .protocol_port
128
106
}
129
107
}
130
108
```
@@ -145,18 +123,19 @@ The following arguments are supported:
145
123
* ` desire_instance_number ` - (Optional, Int) Specifies the expected number of instances. The default value is the
146
124
minimum number of instances. The value ranges from the minimum number of instances to the maximum number of instances.
147
125
148
- * ` min_instance_number ` - (Optional, Int) Specifies the minimum number of instances. The default value is 0 .
126
+ * ` min_instance_number ` - (Optional, Int) Specifies the minimum number of instances. Defaults to ** 0 ** .
149
127
150
- * ` max_instance_number ` - (Optional, Int) Specifies the maximum number of instances. The default value is 0.
128
+ * ` max_instance_number ` - (Optional, Int) Specifies the maximum number of instances. The value ranges from ** 0** to ** 300** .
129
+ Defaults to ** 0** .
151
130
152
- * ` cool_down_time ` - (Optional, Int) Specifies the cooling duration (in seconds). The value ranges from 0 to 86400,
153
- and is 300 by default .
131
+ * ` cool_down_time ` - (Optional, Int) Specifies the cooling duration (in seconds). The value ranges from ** 0 ** to ** 86,400 ** .
132
+ Defaults to ** 300** .
154
133
155
134
* ` availability_zones ` - (Optional, List) Specifies the availability zones in which to create the instances in the
156
- autoscaling group.
135
+ autoscaling group. If this field is not specified, the system will automatically specify one.
157
136
158
137
* ` multi_az_scaling_policy ` - (Optional, String) Specifies the priority policy used to select target AZs when adjusting
159
- the number of instances in an AS group. The value can be ` EQUILIBRIUM_DISTRIBUTE ` and ` PICK_FIRST ` .
138
+ the number of instances in an AS group. The value can be ** EQUILIBRIUM_DISTRIBUTE** or ** PICK_FIRST** .
160
139
161
140
+ ** EQUILIBRIUM_DISTRIBUTE** (default): When adjusting the number of instances, ensure that instances in each AZ in the
162
141
availability_zones list is evenly distributed. If instances cannot be added in the target AZ, select another AZ based
@@ -167,33 +146,34 @@ The following arguments are supported:
167
146
* ` vpc_id ` - (Required, String, ForceNew) Specifies the VPC ID. Changing this creates a new group.
168
147
169
148
* ` networks ` - (Required, List) Specifies an array of one or more network IDs. The system supports up to five networks.
170
- The [ object ] ( #group_network_object ) structure is documented below.
149
+ The [ networks ] ( #group_network_object ) structure is documented below.
171
150
172
151
* ` security_groups ` - (Optional, List) Specifies an array of one or more security group IDs to associate with the group.
173
- The [ object ] ( #group_security_group_object ) structure is documented below.
152
+ The [ security_groups ] ( #group_security_group_object ) structure is documented below.
174
153
175
154
-> If the security group is specified both in the AS configuration and AS group, scaled ECS instances will be added to
176
155
the security group specified in the AS configuration. If the security group is not specified in either of them, scaled
177
156
ECS instances will be added to the default security group. For your convenience, you are advised to specify the security
178
157
group in the AS configuration.
179
158
180
159
* ` lbaas_listeners ` - (Optional, List) Specifies an array of one or more enhanced load balancer. The system supports
181
- the binding of up to six load balancers. The [ object ] ( #group_lbaas_listener_object ) structure is documented below.
160
+ the binding of up to six load balancers. The [ lbaas_listeners ] ( #group_lbaas_listener_object ) structure is documented below.
182
161
183
162
* ` health_periodic_audit_method ` - (Optional, String) Specifies the health check method for instances in the AS group.
184
- The health check methods include ` ELB_AUDIT ` and ` NOVA_AUDIT ` . If load balancing is configured, the default value of
185
- this parameter is ` ELB_AUDIT ` . Otherwise, the default value is ` NOVA_AUDIT ` .
163
+ The health check methods include ** ELB_AUDIT** and ** NOVA_AUDIT** . If load balancing is configured, the default value of
164
+ this parameter is ** ELB_AUDIT** . Otherwise, the default value is ** NOVA_AUDIT** .
186
165
187
166
* ` health_periodic_audit_time ` - (Optional, Int) Specifies the health check period for instances. The unit is minute
188
- and value includes 0, 1, 5 (default), 15, 60, and 180. If the value is set to 0, health check is performed every 10 seconds.
167
+ and value includes ** 0** , ** 1** , ** 5** (default), ** 15** , ** 60** , and ** 180** .
168
+ If the value is set to ** 0** , health check is performed every 10 seconds.
189
169
190
170
* ` health_periodic_audit_grace_period ` - (Optional, Int) Specifies the health check grace period for instances.
191
- The unit is second and the value ranges from 0 to 86400. The default value is 600.
171
+ The unit is second and the value ranges from ** 0 ** to ** 86,400 ** . Defaults to ** 600** .
192
172
193
- -> This parameter is valid only when the instance health check method of the AS group is ` ELB_AUDIT ` .
173
+ -> This parameter is valid only when the instance health check method of the AS group is ** ELB_AUDIT** .
194
174
195
175
* ` instance_terminate_policy ` - (Optional, String) Specifies the instance removal policy. The policy has four
196
- options: ` OLD_CONFIG_OLD_INSTANCE ` (default), ` OLD_CONFIG_NEW_INSTANCE ` , ` OLD_INSTANCE ` , and ` NEW_INSTANCE ` .
176
+ options: ** OLD_CONFIG_OLD_INSTANCE** (default), ** OLD_CONFIG_NEW_INSTANCE** , ** OLD_INSTANCE** , and ** NEW_INSTANCE** .
197
177
198
178
+ ** OLD_CONFIG_OLD_INSTANCE** (default): The earlier-created instances based on the earlier-created AS configurations
199
179
are removed first.
@@ -204,36 +184,41 @@ The following arguments are supported:
204
184
* ` tags ` - (Optional, Map) Specifies the key/value pairs to associate with the AS group.
205
185
206
186
* ` description ` - (Optional, String) Specifies the description of the AS group.
207
- The value can contain 0 to 256 characters.
187
+ The value can contain ` 0 ` to ` 256 ` characters.
208
188
209
189
* ` agency_name ` - (Optional, String) Specifies the IAM agency name. If you change the agency,
210
190
the new agency will be available for ECSs scaled out after the change.
211
191
212
- * ` delete_publicip ` - (Optional, Bool) Specifies whether to delete the elastic IP address bound to the instances of
213
- AS group when deleting the instances. The options are ` true ` and ` false ` .
192
+ * ` delete_publicip ` - (Optional, Bool) Specifies whether to release the EIPs bound to ECSs when the ECSs are removed
193
+ from the AS group. Defaults to ** false** .
194
+
195
+ + ** true** : The EIPs bound to ECSs will be released when the ECSs are removed. If the EIPs are billed on a
196
+ ` yearly/monthly ` basis, they will not be released when the ECSs are removed.
197
+ + ** false** : The EIPs bound to ECSs will be unbound but will not be released when the ECSs are removed.
214
198
215
199
* ` delete_instances ` - (Optional, String) Specifies whether to delete the instances in the AS group when deleting
216
- the AS group. The options are ` yes ` and ` no ` .
200
+ the AS group. The options are ** yes** and ** no** .
201
+
202
+ -> If the instances were manually added to an AS group, they are removed from the AS group but are not deleted.
217
203
218
204
* ` force_delete ` - (Optional, Bool) Specifies whether to forcibly delete the AS group, remove the ECS instances and
219
- release them. The default value is ` false ` .
205
+ release them. Defaults to ** false** .
220
206
221
- * ` enable ` - (Optional, Bool) Specifies whether to enable the AS Group. The options are ` true ` and ` false ` .
222
- The default value is ` true ` .
207
+ * ` enable ` - (Optional, Bool) Specifies whether to enable the AS Group. Defaults to ** true** .
223
208
224
- * ` enterprise_project_id ` - (Optional, String) Specifies the enterprise project id of the AS group.
209
+ * ` enterprise_project_id ` - (Optional, String) Specifies the enterprise project ID of the AS group.
225
210
226
211
<a name =" group_network_object " ></a >
227
212
The ` networks ` block supports:
228
213
229
214
* ` id ` - (Required, String) Specifies the subnet ID.
230
215
231
- * ` ipv6_enable ` - (Optional, Bool) Specifies whether to support IPv6 addresses. The default value is ` false ` .
216
+ * ` ipv6_enable ` - (Optional, Bool) Specifies whether to support IPv6 addresses. Defaults to ** false** .
232
217
233
218
* ` ipv6_bandwidth_id ` - (Optional, String) Specifies the ID of the shared bandwidth of an IPv6 address.
234
219
235
220
* ` source_dest_check ` - (Optional, Bool) Specifies whether process only traffic that is destined specifically
236
- for it. Defaults to true.
221
+ for it. Defaults to ** true** .
237
222
238
223
<a name =" group_security_group_object " ></a >
239
224
The ` security_groups ` block supports:
@@ -246,11 +231,11 @@ The `lbaas_listeners` block supports:
246
231
* ` pool_id ` - (Required, String) Specifies the backend ECS group ID.
247
232
248
233
* ` protocol_port ` - (Required, Int) Specifies the backend protocol, which is the port on which a backend ECS listens for
249
- traffic. The number of the port ranges from 1 to 65535 .
234
+ traffic. The number of the port ranges from ** 1 ** to ** 65,535 ** .
250
235
251
236
* ` weight ` - (Optional, Int) Specifies the weight, which determines the portion of requests a backend ECS processes
252
- compared to other backend ECSs added to the same listener. The value of this parameter ranges from 0 to 100. The
253
- default value is 1 .
237
+ compared to other backend ECSs added to the same listener. The value of this parameter ranges from ** 0 ** to ** 100** .
238
+ Defaults to ** 1 ** .
254
239
255
240
## Attribute Reference
256
241
@@ -275,6 +260,24 @@ This resource provides the following timeouts configuration options:
275
260
276
261
AS groups can be imported by their ` id ` . For example,
277
262
263
+ ``` bash
264
+ $ terraform import huaweicloud_as_group.test < id>
278
265
```
279
- terraform import huaweicloud_as_group.my_as_group 9ec5bea6-a728-4082-8109-5a7dc5c7af74
266
+
267
+ Note that the imported state may not be identical to your resource definition, due to some attributes missing from the
268
+ API response, security or some other reason. The missing attributes include: ` delete_instances ` .
269
+ It is generally recommended running ` terraform plan ` after importing the resource. You can then decide if changes should
270
+ be applied to the resource, or the resource definition should be updated to align with the group. Also, you can ignore
271
+ changes as below.
272
+
273
+ ```
274
+ resource "huaweicloud_as_group" "test" {
275
+ ...
276
+
277
+ lifecycle {
278
+ ignore_changes = [
279
+ delete_instances,
280
+ ]
281
+ }
282
+ }
280
283
```
0 commit comments