Skip to content

fix(as): [122205033] tencentcloud_as_load_balancer add doc #3202

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 12, 2025
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
1 change: 1 addition & 0 deletions tencentcloud/provider.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ tencentcloud_as_limits
tencentcloud_as_last_activity

Resource
tencentcloud_as_load_balancer
tencentcloud_as_scaling_config
tencentcloud_as_scaling_group
tencentcloud_as_scaling_group_status
Expand Down
136 changes: 136 additions & 0 deletions website/docs/r/as_load_balancer.html.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
---
subcategory: "Auto Scaling(AS)"
layout: "tencentcloud"
page_title: "TencentCloud: tencentcloud_as_load_balancer"
sidebar_current: "docs-tencentcloud-resource-as_load_balancer"
description: |-
Provides a resource to create a as load balancer
---

# tencentcloud_as_load_balancer

Provides a resource to create a as load balancer

~> **NOTE:** This resource must exclusive in one auto scaling group, do not declare additional rule resources of this auto scaling group elsewhere.

~> **NOTE:** If the `auto_scaling_group_id` field of this resource comes from the `tencentcloud_as_scaling_group` resource, then the `forward_balancer_ids` field of the `tencentcloud_as_scaling_group` resource cannot be set simultaneously with this resource, which may result in conflicts

~> **NOTE:** `forward_load_balancers` List of application type load balancers, with a maximum of 100 bound application type load balancers for each scaling group.

## Example Usage

```hcl
variable "availability_zone" {
default = "ap-guangzhou-6"
}

// create vpc
resource "tencentcloud_vpc" "vpc" {
cidr_block = "10.0.0.0/16"
name = "vpc"
}

// create subnet
resource "tencentcloud_subnet" "subnet" {
vpc_id = tencentcloud_vpc.vpc.id
availability_zone = var.availability_zone
name = "subnet"
cidr_block = "10.0.1.0/24"
is_multicast = false
}


resource "tencentcloud_as_scaling_config" "example" {
configuration_name = "tf-example"
image_id = "img-eb30mz89"
instance_types = ["S6.MEDIUM4"]
instance_name_settings {
instance_name = "demo-ins-name"
}
}

resource "tencentcloud_as_scaling_group" "example" {
scaling_group_name = "tf-example"
configuration_id = tencentcloud_as_scaling_config.example.id
max_size = 1
min_size = 0
vpc_id = tencentcloud_vpc.vpc.id
subnet_ids = [tencentcloud_subnet.subnet.id]
}

resource "tencentcloud_clb_instance" "example" {
network_type = "INTERNAL"
clb_name = "tf-example"
vpc_id = tencentcloud_vpc.vpc.id
subnet_id = tencentcloud_subnet.subnet.id
tags = {
createBy = "Terraform"
}
}

resource "tencentcloud_clb_listener" "example" {
clb_id = tencentcloud_clb_instance.example.id
listener_name = "tf-example"
port = 80
protocol = "HTTP"
}

resource "tencentcloud_clb_listener_rule" "example" {
listener_id = tencentcloud_clb_listener.example.listener_id
clb_id = tencentcloud_clb_instance.example.id
domain = "foo.net"
url = "/bar"
}

resource "tencentcloud_as_load_balancer" "example" {
auto_scaling_group_id = tencentcloud_as_scaling_group.example.id

forward_load_balancers {
load_balancer_id = tencentcloud_clb_instance.example.id
listener_id = tencentcloud_clb_listener.example.listener_id
location_id = tencentcloud_clb_listener_rule.example.rule_id

target_attributes {
port = 8080
weight = 20
}
}
}
```

## Argument Reference

The following arguments are supported:

* `auto_scaling_group_id` - (Required, String) ID of a scaling group.
* `forward_load_balancers` - (Optional, List) List of application load balancers. The maximum number of application-type load balancers bound to each scaling group is 100.

The `forward_load_balancers` object supports the following:

* `listener_id` - (Required, String) Application load balancer listener ID.
* `load_balancer_id` - (Required, String) Application load balancer instance ID.
* `target_attributes` - (Required, List) List of TargetAttribute.
* `location_id` - (Optional, String) Application load balancer location ID.
* `region` - (Optional, String) Load balancer instance region. Default value is the region of current auto scaling group. The format is the same as the public parameter Region, for example: ap-guangzhou.

The `target_attributes` object of `forward_load_balancers` supports the following:

* `port` - (Required, Int) Target port.
* `weight` - (Required, Int) Target weight.

## Attributes Reference

In addition to all arguments above, the following attributes are exported:

* `id` - ID of the resource.



## Import

as load balancer can be imported using the id, e.g.

```
terraform import tencentcloud_as_load_balancer.example asg-bpp4uol2
```

3 changes: 3 additions & 0 deletions website/tencentcloud.erb
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,9 @@
<li>
<a href="/docs/providers/tencentcloud/r/as_lifecycle_hook.html">tencentcloud_as_lifecycle_hook</a>
</li>
<li>
<a href="/docs/providers/tencentcloud/r/as_load_balancer.html">tencentcloud_as_load_balancer</a>
</li>
<li>
<a href="/docs/providers/tencentcloud/r/as_notification.html">tencentcloud_as_notification</a>
</li>
Expand Down
Loading