Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion docs/data-sources/as_groups.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
subcategory: "Auto Scaling"
layout: "huaweicloud"
page_title: "HuaweiCloud: huaweicloud_as_groups"
description: ""
description: |-
Use this data source to get a list of AS groups.
---

# huaweicloud_as_groups
Expand Down Expand Up @@ -121,6 +122,10 @@ The `lbaas_listeners` block supports:
* `weight` - The weight, which determines the portion of requests a backend ECS processes
compared to other backend ECSs added to the same listener.

* `protocol_version` - The version of IP addresses of backend servers to be bound with the ELB.

* `listener_id` - The ID of the listener associate with the ELB.

<a name="network_object"></a>
The `networks` block supports:

Expand Down
15 changes: 14 additions & 1 deletion docs/resources/as_group.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
subcategory: "Auto Scaling"
layout: "huaweicloud"
page_title: "HuaweiCloud: huaweicloud_as_group"
description: ""
description: |-
Manages an AS group resource within HuaweiCloud.
---

# huaweicloud_as_group
Expand Down Expand Up @@ -254,6 +255,8 @@ The `lbaas_listeners` block supports:
<br/>3. If you add two or more load balancers whose pool_id, protocol_port, and protocol_version settings are totally
same, deduplication will be performed.

* `listener_id` - The ID of the listener assocaite with the ELB.

## Attribute Reference

In addition to all arguments above, the following attributes are exported:
Expand All @@ -266,6 +269,16 @@ In addition to all arguments above, the following attributes are exported:

* `instances` - The instances IDs of the AS group.

* `scaling_configuration_name` - The name of the AS configuration to which the AS group belongs.

* `detail` - The details about the AS group. If a scaling action fails, this parameter is used to record errors.

* `is_scaling` - The scaling flag of the AS group.

* `activity_type` - The scaling activity type of the AS group.

* `create_time` - The creation time of the AS group.

## Timeouts

This resource provides the following timeouts configuration options:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,9 @@ func TestAccASGroup_forceDelete(t *testing.T) {
resource.TestCheckResourceAttr(resourceName, "status", "INSERVICE"),
resource.TestCheckResourceAttr(resourceName, "delete_publicip", "true"),
resource.TestCheckResourceAttr(resourceName, "delete_volume", "true"),
resource.TestCheckResourceAttrSet(resourceName, "scaling_configuration_name"),
resource.TestCheckResourceAttrSet(resourceName, "is_scaling"),
resource.TestCheckResourceAttrSet(resourceName, "create_time"),
),
},
},
Expand Down
18 changes: 15 additions & 3 deletions huaweicloud/services/as/data_source_huaweicloud_as_groups.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,16 @@ func groupDataSourceLBaasListenersSchema() *schema.Resource {
Description: "The weight, which determines the portion of requests a backend " +
"ECS processes compared to other backend ECSs added to the same listener.",
},
"listener_id": {
Type: schema.TypeString,
Computed: true,
Description: "The ID of the listener associate with the ELB.",
},
"protocol_version": {
Type: schema.TypeString,
Computed: true,
Description: "The version of IP addresses of backend servers to be bound with the ELB.",
},
},
}
}
Expand Down Expand Up @@ -289,9 +299,11 @@ func flattenDataSourceLBaaSListeners(listeners []groups.LBaaSListener) []map[str
res := make([]map[string]interface{}, len(listeners))
for i, item := range listeners {
res[i] = map[string]interface{}{
"pool_id": item.PoolID,
"protocol_port": item.ProtocolPort,
"weight": item.Weight,
"pool_id": item.PoolID,
"protocol_port": item.ProtocolPort,
"weight": item.Weight,
"protocol_version": item.ProtocolVersion,
"listener_id": item.ListenerID,
}
}
return res
Expand Down
30 changes: 30 additions & 0 deletions huaweicloud/services/as/resource_huaweicloud_as_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@ func ResourceASGroup() *schema.Resource {
Optional: true,
Computed: true,
},
"listener_id": {
Type: schema.TypeString,
Computed: true,
},
},
},
},
Expand Down Expand Up @@ -246,6 +250,26 @@ func ResourceASGroup() *schema.Resource {
Type: schema.TypeString,
Computed: true,
},
"scaling_configuration_name": {
Type: schema.TypeString,
Computed: true,
},
"activity_type": {
Type: schema.TypeString,
Computed: true,
},
"detail": {
Type: schema.TypeString,
Computed: true,
},
"is_scaling": {
Type: schema.TypeBool,
Computed: true,
},
"create_time": {
Type: schema.TypeString,
Computed: true,
},

// Deprecated
"lb_listener_id": {
Expand Down Expand Up @@ -602,6 +626,11 @@ func resourceASGroupRead(_ context.Context, d *schema.ResourceData, meta interfa
d.Set("networks", flattenNetworks(asg.Networks)),
d.Set("security_groups", flattenSecurityGroups(asg.SecurityGroups)),
d.Set("lbaas_listeners", flattenLBaaSListeners(asg.LBaaSListeners)),
d.Set("scaling_configuration_name", asg.ConfigurationName),
d.Set("detail", asg.Detail),
d.Set("is_scaling", asg.IsScaling),
d.Set("activity_type", asg.ActivityType),
d.Set("create_time", asg.CreateTime),
)

// save group tags
Expand Down Expand Up @@ -653,6 +682,7 @@ func flattenLBaaSListeners(listeners []groups.LBaaSListener) []map[string]interf
"protocol_port": item.ProtocolPort,
"weight": item.Weight,
"protocol_version": item.ProtocolVersion,
"listener_id": item.ListenerID,
}
}
return res
Expand Down
Loading