Add support for session persistence to the load balancer (#238)
* Add support for session persistence to the load balancer * Set use_source_ip_address optional to true * Add unit tests for SessionPersistence Settings in LoadBalancer * Add acceptance test for using session persistence * Add session persistence to data source and fix acceptance tests * Update stackit/internal/services/loadbalancer/loadbalancer/resource.go Co-authored-by: Vicente Pinto <vicente.pinto@freiheit.com> * Update stackit/internal/services/loadbalancer/loadbalancer/datasource.go Co-authored-by: Vicente Pinto <vicente.pinto@freiheit.com> --------- Co-authored-by: Vicente Pinto <vicente.pinto@freiheit.com>
This commit is contained in:
parent
82611e96af
commit
b171e8a745
4 changed files with 182 additions and 71 deletions
|
|
@ -78,33 +78,35 @@ func (r *loadBalancerDataSource) Configure(ctx context.Context, req datasource.C
|
|||
// Schema defines the schema for the data source.
|
||||
func (r *loadBalancerDataSource) Schema(_ context.Context, _ datasource.SchemaRequest, resp *datasource.SchemaResponse) {
|
||||
descriptions := map[string]string{
|
||||
"main": "Load Balancer resource schema.",
|
||||
"id": "Terraform's internal resource ID. It is structured as \"`project_id`\",\"`name`\".",
|
||||
"project_id": "STACKIT project ID to which the Load Balancer is associated.",
|
||||
"external_address": "External Load Balancer IP address where this Load Balancer is exposed.",
|
||||
"listeners": "List of all listeners which will accept traffic. Limited to 20.",
|
||||
"port": "Port number where we listen for traffic.",
|
||||
"protocol": "Protocol is the highest network protocol we understand to load balance.",
|
||||
"target_pool": "Reference target pool by target pool name.",
|
||||
"name": "Load balancer name.",
|
||||
"networks": "List of networks that listeners and targets reside in.",
|
||||
"network_id": "Openstack network ID.",
|
||||
"role": "The role defines how the load balancer is using the network.",
|
||||
"options": "Defines any optional functionality you want to have enabled on your load balancer.",
|
||||
"acl": "Load Balancer is accessible only from an IP address in this range.",
|
||||
"private_network_only": "If true, Load Balancer is accessible only via a private network IP address.",
|
||||
"private_address": "Transient private Load Balancer IP address. It can change any time.",
|
||||
"target_pools": "List of all target pools which will be used in the Load Balancer. Limited to 20.",
|
||||
"healthy_threshold": "Healthy threshold of the health checking.",
|
||||
"interval": "Interval duration of health checking in seconds.",
|
||||
"interval_jitter": "Interval duration threshold of the health checking in seconds.",
|
||||
"timeout": "Active health checking timeout duration in seconds.",
|
||||
"unhealthy_threshold": "Unhealthy threshold of the health checking.",
|
||||
"target_pools.name": "Target pool name.",
|
||||
"target_port": "Identical port number where each target listens for traffic.",
|
||||
"targets": "List of all targets which will be used in the pool. Limited to 250.",
|
||||
"targets.display_name": "Target display name",
|
||||
"ip": "Target IP",
|
||||
"main": "Load Balancer resource schema.",
|
||||
"id": "Terraform's internal resource ID. It is structured as \"`project_id`\",\"`name`\".",
|
||||
"project_id": "STACKIT project ID to which the Load Balancer is associated.",
|
||||
"external_address": "External Load Balancer IP address where this Load Balancer is exposed.",
|
||||
"listeners": "List of all listeners which will accept traffic. Limited to 20.",
|
||||
"port": "Port number where we listen for traffic.",
|
||||
"protocol": "Protocol is the highest network protocol we understand to load balance.",
|
||||
"target_pool": "Reference target pool by target pool name.",
|
||||
"name": "Load balancer name.",
|
||||
"networks": "List of networks that listeners and targets reside in.",
|
||||
"network_id": "Openstack network ID.",
|
||||
"role": "The role defines how the load balancer is using the network.",
|
||||
"options": "Defines any optional functionality you want to have enabled on your load balancer.",
|
||||
"acl": "Load Balancer is accessible only from an IP address in this range.",
|
||||
"private_network_only": "If true, Load Balancer is accessible only via a private network IP address.",
|
||||
"session_persistence": "Here you can setup various session persistence options, so far only \"`use_source_ip_address`\" is supported.",
|
||||
"use_source_ip_address": "If true then all connections from one source IP address are redirected to the same target. This setting changes the load balancing algorithm to Maglev.",
|
||||
"private_address": "Transient private Load Balancer IP address. It can change any time.",
|
||||
"target_pools": "List of all target pools which will be used in the Load Balancer. Limited to 20.",
|
||||
"healthy_threshold": "Healthy threshold of the health checking.",
|
||||
"interval": "Interval duration of health checking in seconds.",
|
||||
"interval_jitter": "Interval duration threshold of the health checking in seconds.",
|
||||
"timeout": "Active health checking timeout duration in seconds.",
|
||||
"unhealthy_threshold": "Unhealthy threshold of the health checking.",
|
||||
"target_pools.name": "Target pool name.",
|
||||
"target_port": "Identical port number where each target listens for traffic.",
|
||||
"targets": "List of all targets which will be used in the pool. Limited to 250.",
|
||||
"targets.display_name": "Target display name",
|
||||
"ip": "Target IP",
|
||||
}
|
||||
|
||||
resp.Schema = schema.Schema{
|
||||
|
|
@ -250,6 +252,18 @@ func (r *loadBalancerDataSource) Schema(_ context.Context, _ datasource.SchemaRe
|
|||
Description: descriptions["target_port"],
|
||||
Computed: true,
|
||||
},
|
||||
"session_persistence": schema.SingleNestedAttribute{
|
||||
Description: descriptions["session_persistence"],
|
||||
Optional: true,
|
||||
Computed: false,
|
||||
Attributes: map[string]schema.Attribute{
|
||||
"use_source_ip_address": schema.BoolAttribute{
|
||||
Description: descriptions["use_source_ip_address"],
|
||||
Optional: true,
|
||||
Computed: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
"targets": schema.ListNestedAttribute{
|
||||
Description: descriptions["targets"],
|
||||
Computed: true,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue