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
|
|
@ -88,6 +88,12 @@ func TestToCreatePayload(t *testing.T) {
|
|||
Ip: types.StringValue("ip"),
|
||||
},
|
||||
},
|
||||
SessionPersistence: types.ObjectValueMust(
|
||||
sessionPersistenceTypes,
|
||||
map[string]attr.Value{
|
||||
"use_source_ip_address": types.BoolValue(true),
|
||||
},
|
||||
),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -135,6 +141,9 @@ func TestToCreatePayload(t *testing.T) {
|
|||
Ip: utils.Ptr("ip"),
|
||||
},
|
||||
}),
|
||||
SessionPersistence: utils.Ptr(loadbalancer.SessionPersistence{
|
||||
UseSourceIpAddress: utils.Ptr(true),
|
||||
}),
|
||||
},
|
||||
}),
|
||||
},
|
||||
|
|
@ -200,6 +209,12 @@ func TestToTargetPoolUpdatePayload(t *testing.T) {
|
|||
Ip: types.StringValue("ip"),
|
||||
},
|
||||
},
|
||||
SessionPersistence: types.ObjectValueMust(
|
||||
sessionPersistenceTypes,
|
||||
map[string]attr.Value{
|
||||
"use_source_ip_address": types.BoolValue(false),
|
||||
},
|
||||
),
|
||||
},
|
||||
&loadbalancer.UpdateTargetPoolPayload{
|
||||
ActiveHealthCheck: utils.Ptr(loadbalancer.ActiveHealthCheck{
|
||||
|
|
@ -217,6 +232,9 @@ func TestToTargetPoolUpdatePayload(t *testing.T) {
|
|||
Ip: utils.Ptr("ip"),
|
||||
},
|
||||
}),
|
||||
SessionPersistence: utils.Ptr(loadbalancer.SessionPersistence{
|
||||
UseSourceIpAddress: utils.Ptr(false),
|
||||
}),
|
||||
},
|
||||
true,
|
||||
},
|
||||
|
|
@ -322,6 +340,9 @@ func TestMapFields(t *testing.T) {
|
|||
Ip: utils.Ptr("ip"),
|
||||
},
|
||||
}),
|
||||
SessionPersistence: utils.Ptr(loadbalancer.SessionPersistence{
|
||||
UseSourceIpAddress: utils.Ptr(true),
|
||||
}),
|
||||
},
|
||||
}),
|
||||
},
|
||||
|
|
@ -378,6 +399,12 @@ func TestMapFields(t *testing.T) {
|
|||
Ip: types.StringValue("ip"),
|
||||
},
|
||||
},
|
||||
SessionPersistence: types.ObjectValueMust(
|
||||
sessionPersistenceTypes,
|
||||
map[string]attr.Value{
|
||||
"use_source_ip_address": types.BoolValue(true),
|
||||
},
|
||||
),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue