Skip to content
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

feat(elb): add ress/data cloudavenue_elb_pool #981

Merged
merged 1 commit into from
Feb 10, 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
2 changes: 1 addition & 1 deletion .changelog/892.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
```release-note:new-data-source
`datasource/cloudavenue_alb_service_engine_group` - Added a new data source to retrieve information about a Service Engine Group.
`datasource/cloudavenue_elb_service_engine_group` - Added a new data source to retrieve information about a Service Engine Group.
```
2 changes: 1 addition & 1 deletion .changelog/901.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
```release-note:new-data-source
`datasource/cloudavenue_alb_service_engine_groups` - Added a new data source to list all Service Engine Group attached to an Edge Gateway.
`datasource/cloudavenue_elb_service_engine_groups` - Added a new data source to list all Service Engine Group attached to an Edge Gateway.
```
7 changes: 7 additions & 0 deletions .changelog/974.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
```release-note:new-resource
`resource/cloudavenue_elb_pool` - Added new resource `cloudavenue_elb_pool` to manage edgegateway load balancer pools. Pools maintain the list of servers assigned to them and perform health monitoring, load balancing, persistence.
```

```release-note:new-data-source
`datasource/cloudavenue_elb_pool` - Added new datasource `cloudavenue_elb_pool` to read details of an existing edgegateway load balancer pool.
```
93 changes: 93 additions & 0 deletions docs/data-sources/elb_pool.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
---
page_title: "cloudavenue_elb_pool Data Source - cloudavenue"
subcategory: "ELB (EdgeGateway Load Balancer)"
description: |-
The cloudavenue_elb_pool data source allows you to retrieve information about an existing edgegateway load balancer pool.
---

# cloudavenue_elb_pool (Data Source)

The `cloudavenue_elb_pool` data source allows you to retrieve information about an existing edgegateway load balancer pool.

## Example Usage

```terraform
data "cloudavenue_elb_pool" "example" {
name = "example"
edge_gateway_id = cloudavenue_edge_gateway.example.id
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `name` (String) The name of the pool.

### Optional

- `edge_gateway_id` (String) The ID of the Edge Gateway. Ensure that one and only one attribute from this collection is set : `edge_gateway_name`, `edge_gateway_id`.
- `edge_gateway_name` (String) The name of the Edge Gateway. Ensure that one and only one attribute from this collection is set : `edge_gateway_name`, `edge_gateway_id`.

### Read-Only

- `algorithm` (String) The heart of a load balancer is its ability to effectively distribute traffic across healthy servers. If persistence is enabled, only the first connection from a client is load balanced. While the persistence remains in effect, subsequent connections or requests from a client are directed to the same server.
- `default_port` (Number) DefaultPort defines destination server port used by the traffic sent to the member.
- `description` (String) The name of the pool.
- `enabled` (Boolean) Enable or disable the pool.
- `health` (Attributes) . (see [below for nested schema](#nestedatt--health))
- `id` (String) The ID of the pool.
- `members` (Attributes) . (see [below for nested schema](#nestedatt--members))
- `persistence` (Attributes) . (see [below for nested schema](#nestedatt--persistence))
- `tls` (Attributes) . (see [below for nested schema](#nestedatt--tls))

<a id="nestedatt--health"></a>
### Nested Schema for `health`

Read-Only:

- `monitors` (List of String) The active health monitors.
- `passive_monitoring_enabled` (Boolean) PassiveMonitoringEnabled sets if client traffic should be used to check if pool member is up or down.


<a id="nestedatt--members"></a>
### Nested Schema for `members`

Read-Only:

- `graceful_timeout_period` (String) Maximum time (in minutes) to gracefully disable a member. Virtual service waits for the specified time before terminating the existing connections to the members that are disabled. Special values: `0` represents `Immediate` and `-1` represents `Infinite`. The maximum value is `7200` minutes.
- `target_group` (String) The group contains reference to the Edge Firewall Group representing destination servers which are used by the Load Balancer Pool to direct load balanced traffic. This permit to reference `IP Set` or `Static Group` ID.
- `targets` (Attributes List) targets field defines list of destination servers which are used by the Load Balancer Pool to direct load balanced traffic. (see [below for nested schema](#nestedatt--members--targets))

<a id="nestedatt--members--targets"></a>
### Nested Schema for `members.targets`

Read-Only:

- `enabled` (Boolean) Enable or disable the member.
- `ip_address` (String) The IP address of the member.
- `port` (Number) The port of the member.
- `ratio` (Number) The ratio of the member. The ratio of each pool member denotes the traffic that goes to each server pool member. A server with a ratio of 2 gets twice as much traffic as a server with a ratio of 1.



<a id="nestedatt--persistence"></a>
### Nested Schema for `persistence`

Read-Only:

- `type` (String) The type of the persistence.
- `value` (String) The value of the persistence.


<a id="nestedatt--tls"></a>
### Nested Schema for `tls`

Read-Only:

- `ca_certificate_refs` (List of String) The CA certificate references point to root certificates to use when validating certificates presented by the pool members.
- `common_name_check_enabled` (Boolean) Enable common name check for server certificate. If enabled and no explicit domain name is specified, the incoming host header will be used to do the match.
- `domain_names` (List of String) The domain names of the TLS check. This attribute is taken into account if the `common_name_check_enabled` is set to `true`.
- `enabled` (Boolean) Enable or disable the TLS.

236 changes: 236 additions & 0 deletions docs/resources/elb_pool.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,236 @@
---
page_title: "cloudavenue_elb_pool Resource - cloudavenue"
subcategory: "ELB (EdgeGateway Load Balancer)"
description: |-
The cloudavenue_elb_pool resource allows you to manage edgegateway load balancer pools. Pools maintain the list of servers assigned to them and perform health monitoring, load balancing, persistence. A pool may only be used or referenced by only one virtual service at a time.
---

# cloudavenue_elb_pool (Resource)

The `cloudavenue_elb_pool` resource allows you to manage edgegateway load balancer pools. Pools maintain the list of servers assigned to them and perform health monitoring, load balancing, persistence. A pool may only be used or referenced by only one virtual service at a time.

## Example Usage

Basic working example:

```hcl
resource "cloudavenue_elb_pool" "example" {
name = "example"
edge_gateway_id = data.cloudavenue_edgegateway.example.id
enabled = true
default_port = 80
members = {
targets = [
{
ip_address = "192.168.0.1"
port = 80
}
]
}
}
```

-> More examples can be found at the [Advanced Usage](#advanced-usage) section.



<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `default_port` (Number) DefaultPort defines destination server port used by the traffic sent to the member.
- `members` (Attributes) . (see [below for nested schema](#nestedatt--members))
- `name` (String) The name of the pool.

### Optional

- `algorithm` (String) The heart of a load balancer is its ability to effectively distribute traffic across healthy servers. If persistence is enabled, only the first connection from a client is load balanced. While the persistence remains in effect, subsequent connections or requests from a client are directed to the same server. Value must be one of: `CONSISTENT_HASH` (New connections are distributed across the servers by using the IP address of the client to generate an IP hash.), `CORE_AFFINITY` (Each CPU core uses a subset of servers, and each server is used by a subset of cores. Essentially it provides a many-to-many mapping between servers and cores.), `FASTEST_RESPONSE` (New connections are sent to the server that is currently providing the fastest response to new connections or requests.), `FEWEST_SERVERS` (Instead of attempting to distribute all connections or requests across all servers, the fewest number of servers which are required to satisfy the current client load will be determined.), `FEWEST_TASKS` (Load is adaptively balanced, based on server feedback.), `LEAST_CONNECTIONS` (New connections are sent to the server that currently has the least number of outstanding concurrent connections.), `LEAST_LOAD` (New connections are sent to the server with the lightest load, regardless of the number of connections that server has.), `RANDOM` (Picks servers at random), `ROUND_ROBIN` (New connections are sent to the next eligible server in the pool in sequential order.). Value defaults to `LEAST_CONNECTIONS`.
- `description` (String) The name of the pool.
- `edge_gateway_id` (String) (ForceNew) The ID of the Edge Gateway. Ensure that one and only one attribute from this collection is set : `edge_gateway_name`, `edge_gateway_id`.
- `edge_gateway_name` (String) (ForceNew) The name of the Edge Gateway. Ensure that one and only one attribute from this collection is set : `edge_gateway_name`, `edge_gateway_id`.
- `enabled` (Boolean) Enable or disable the pool. Value defaults to `true`.
- `health` (Attributes) . Value defaults to `{"monitors":<null>,"passive_monitoring_enabled":true}`. (see [below for nested schema](#nestedatt--health))
- `persistence` (Attributes) . Value defaults to `{"type":"CLIENT_IP","value":<null>}`. (see [below for nested schema](#nestedatt--persistence))
- `tls` (Attributes) . Value defaults to `{"ca_certificate_refs":<null>,"common_name_check_enabled":false,"domain_names":<null>,"enabled":false}`. (see [below for nested schema](#nestedatt--tls))

### Read-Only

- `id` (String) The ID of the pool.

<a id="nestedatt--members"></a>
### Nested Schema for `members`

Optional:

- `graceful_timeout_period` (String) Maximum time (in minutes) to gracefully disable a member. Virtual service waits for the specified time before terminating the existing connections to the members that are disabled. Special values: `0` represents `Immediate` and `-1` represents `Infinite`. The maximum value is `7200` minutes. Value defaults to `1`.
- `target_group` (String) The group contains reference to the Edge Firewall Group representing destination servers which are used by the Load Balancer Pool to direct load balanced traffic. This permit to reference `IP Set` or `Static Group` ID. Ensure that one and only one attribute from this collection is set : `targets`, `target_group`.
- `targets` (Attributes List) targets field defines list of destination servers which are used by the Load Balancer Pool to direct load balanced traffic. Ensure that one and only one attribute from this collection is set : `targets`, `target_group`. (see [below for nested schema](#nestedatt--members--targets))

<a id="nestedatt--members--targets"></a>
### Nested Schema for `members.targets`

Required:

- `ip_address` (String) The IP address of the member. The value must be a valid IPV4 address (`192.168.0.1`).
- `port` (Number) The port of the member.

Optional:

- `enabled` (Boolean) Enable or disable the member. Value defaults to `true`.
- `ratio` (Number) The ratio of the member. The ratio of each pool member denotes the traffic that goes to each server pool member. A server with a ratio of 2 gets twice as much traffic as a server with a ratio of 1. Value defaults to `1`.



<a id="nestedatt--health"></a>
### Nested Schema for `health`

Optional:

- `monitors` (List of String) The active health monitors. Element value must satisfy all validations: value must be one of: ["HTTP" "HTTPS" "PING" "TCP" "UDP"].
- `passive_monitoring_enabled` (Boolean) PassiveMonitoringEnabled sets if client traffic should be used to check if pool member is up or down. Value defaults to `true`.


<a id="nestedatt--persistence"></a>
### Nested Schema for `persistence`

Optional:

- `type` (String) The type of the persistence. Value must be one of: `APP_COOKIE` (Load Balancer reads existing server cookies or URI embedded data such as JSessionID. Cookie name must be provided as value.), `CLIENT_IP` (The clients IP is used as the identifier and mapped to the server.), `CUSTOM_HTTP_HEADER` (Custom, static mappings of header values to specific servers are used. Header name must be provided as value.), `HTTP_COOKIE` (Load Balancer inserts a cookie into HTTP responses. Cookie name must be provided as value.), `TLS` (Information is embedded in the client's SSL/TLS ticket ID. This will use default system profile System-Persistence-TLS.). Value defaults to `CLIENT_IP`.
- `value` (String) The value of the persistence. If the value of [`<.type`](#<.type) attribute is one of `HTTP_COOKIE`, `CUSTOM_HTTP_HEADER` or `APP_COOKIE` this attribute is **REQUIRED**.


<a id="nestedatt--tls"></a>
### Nested Schema for `tls`

Optional:

- `ca_certificate_refs` (List of String) The CA certificate references point to root certificates to use when validating certificates presented by the pool members. Use `cloudavenue_org_certificate` resource to create a certificate and get the ID. Element value must satisfy all validations: must start with "urn:vcloud:certificateLibraryItem:".
- `common_name_check_enabled` (Boolean) Enable common name check for server certificate. If enabled and no explicit domain name is specified, the incoming host header will be used to do the match. Value defaults to `false`.
- `domain_names` (List of String) The domain names of the TLS check. This attribute is taken into account if the `common_name_check_enabled` is set to `true`. List must contain at least 0 elements and at most 10 elements.
- `enabled` (Boolean) Enable or disable the TLS. Value defaults to `false`.

## Advanced Usage

### Multiple Members and health monitors
```hcl
resource "cloudavenue_elb_pool" "example" {
name = "example"
edge_gateway_id = data.cloudavenue_edgegateway.example.id
enabled = true
default_port = 80
algorithm = "ROUND_ROBIN"
members = {
targets = [
{
ip_address = "192.168.0.1"
port = 80
},
{
ip_address = "192.168.0.2"
port = 80
}
]
}
health = {
monitors = ["HTTP", "TCP"]
}
}
```

### Setting TLS configuration
```hcl
resource "cloudavenue_elb_pool" "example" {
name = "example"
edge_gateway_id = data.cloudavenue_edgegateway.example.id
enabled = true
default_port = 80
members = {
targets = [
{
ip_address = "192.168.0.1"
port = 80
}
]
}
tls = {
enabled = true
ca_certificate_refs = [
cloudavenue_org_certificate_library.example.id
]
}
}
```

### Use IPSet for members
```hcl
resource "cloudavenue_elb_pool" "example" {
name = "example"
edge_gateway_id = data.cloudavenue_edgegateway.example.id
enabled = true
default_port = 80
members = {
graceful_timeout_period = 2
target_group = cloudavenue_edgegateway_ip_set.example.id
}
}
```

### Full configuration
```hcl
resource "cloudavenue_elb_pool" "example" {
name = "example"
edge_gateway_id = data.cloudavenue_edgegateway.example.id
enabled = true
default_port = 80
algorithm = "ROUND_ROBIN"
members = {
graceful_timeout_period = 2
targets = [
{
ip_address = "192.168.0.1"
port = 80
enabled = true
ratio = 1
},
{
ip_address = "192.168.0.2"
port = 80
enabled = true
ratio = 1
},
{
ip_address = "192.168.0.10"
port = 8080
enabled = true
ratio = 10
}
]
}

health = {
monitors = ["HTTP", "TCP"]
passive_monitoring_enabled = true
}

tls = {
enabled = true
ca_certificate_refs = [
cloudavenue_org_certificate_library.example.id
]
common_name_check_enabled = true
}

persistence = {
type = "CUSTOM_HTTP_HEADER"
value = "X-Custom"
}
}
```

## Import

Import is supported using the following syntax:
```shell
terraform import cloudavenue_elb_pool.example edgeGatewayNameOrID.poolNameOrID
```
4 changes: 4 additions & 0 deletions examples/data-sources/cloudavenue_elb_pool/data-source.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
data "cloudavenue_elb_pool" "example" {
name = "example"
edge_gateway_id = cloudavenue_edge_gateway.example.id
}
1 change: 1 addition & 0 deletions examples/resources/cloudavenue_elb_pool/import.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
terraform import cloudavenue_elb_pool.example edgeGatewayNameOrID.poolNameOrID
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ require (
github.com/hashicorp/terraform-plugin-sdk/v2 v2.35.0
github.com/iancoleman/strcase v0.3.0
github.com/madflojo/testcerts v1.4.0
github.com/orange-cloudavenue/cloudavenue-sdk-go v0.21.4-0.20250205091902-6063db5d300f
github.com/orange-cloudavenue/cloudavenue-sdk-go v0.21.4-0.20250207103134-f809a9e41443
github.com/orange-cloudavenue/common-go/print v0.0.0-20250109171729-2be550d5d3ac
github.com/orange-cloudavenue/common-go/utils v0.0.0-20240119163616-66b473d92339
github.com/orange-cloudavenue/terraform-plugin-framework-planmodifiers v1.4.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,8 @@ github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE=
github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU=
github.com/onsi/gomega v1.18.1 h1:M1GfJqGRrBrrGGsbxzV5dqM2U2ApXefZCQpkukxYRLE=
github.com/onsi/gomega v1.18.1/go.mod h1:0q+aL8jAiMXy9hbwj2mr5GziHiwhAIQpFmmtT5hitRs=
github.com/orange-cloudavenue/cloudavenue-sdk-go v0.21.4-0.20250205091902-6063db5d300f h1:5G8037p+OPF9vKomSm2UMCDVwO6evq6rk3lzZ+HkbH4=
github.com/orange-cloudavenue/cloudavenue-sdk-go v0.21.4-0.20250205091902-6063db5d300f/go.mod h1:qijxgnnyB2JBkHWslCPD45NhJk5UVrVrm//Vq6qQ1c8=
github.com/orange-cloudavenue/cloudavenue-sdk-go v0.21.4-0.20250207103134-f809a9e41443 h1:BwXh2VkEiEEdwOo3+WyG4OLWY0WiZcxjYaA/RsnWnpg=
github.com/orange-cloudavenue/cloudavenue-sdk-go v0.21.4-0.20250207103134-f809a9e41443/go.mod h1:qijxgnnyB2JBkHWslCPD45NhJk5UVrVrm//Vq6qQ1c8=
github.com/orange-cloudavenue/common-go/print v0.0.0-20250109171729-2be550d5d3ac h1:f1Fd70+PMDTK6FE4gHdNfoHSQHLn5pfJMTjZPzOWZtc=
github.com/orange-cloudavenue/common-go/print v0.0.0-20250109171729-2be550d5d3ac/go.mod h1:IYtCusqpEGS0dhC6F8X9GHrrt1gp1zHaNhSKGYV59Xg=
github.com/orange-cloudavenue/common-go/utils v0.0.0-20240119163616-66b473d92339 h1:DEKcWLGbEhu/I6kn9NAXhVCFrbPhR+Ef7oLmpLVnnPM=
Expand Down
Loading
Loading