-
Notifications
You must be signed in to change notification settings - Fork 55
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
Enable LB support #356
base: master
Are you sure you want to change the base?
Enable LB support #356
Conversation
Optional: true, | ||
Description: "Firewall rules for the load balancer (e.g., 'all', '80,443', '40-80,90-120').", | ||
}, | ||
"backend": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be backends
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is supposed to look like
resource "civo_load_balancer" "example" {
name = "uzaiii-lodbal"
# service_name = "example-service"
network_id = civo_network.example.id
algorithm = "round_robin"
external_traffic_policy = "Cluster"
session_affinity = "ClientIP"
session_affinity_config_timeout = 120
enable_proxy_protocol = "send-proxy-v2"
max_concurrent_requests = 500
firewall_id = civo_firewall.example.id
backend {
ip = "192.168.1.11"
protocol = "TCP"
source_port = 443
target_port = 8443
health_check_port = 9443
}
backend {
ip = "192.168.1.10"
protocol = "TCP"
source_port = 80
target_port = 8080
health_check_port = 9090
}
}
so since we define each backend separately so imo it should be backned
, if we define all of them in a single array then it should be backends
}, | ||
}, | ||
}, | ||
"instance_pool": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be instance_pools
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
again the same logic as above
name := d.Get("name").(string) | ||
|
||
// Check that either backend or instance_pool is provided | ||
backends, backendSet := d.GetOk("backend") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
backends
|
||
// Check that either backend or instance_pool is provided | ||
backends, backendSet := d.GetOk("backend") | ||
instancePools, instancePoolSet := d.GetOk("instance_pool") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instance_pools
d.Set("cluster_id", loadBalancer.ClusterID) | ||
d.Set("firewall_id", loadBalancer.FirewallID) | ||
|
||
fmt.Println("FIREEEE ID", loadBalancer.FirewallID) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you mean to leave this in? :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
opps my bad!
|
||
if loadBalancer.InstancePool != nil { | ||
flattenedInstancePool := flattenInstancePool(loadBalancer.InstancePool) | ||
if err := d.Set("instance_pool", flattenedInstancePool); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instance_pools
} | ||
|
||
// If backend configuration has changed, update backends in the request | ||
if d.HasChange("backend") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
backends
|
||
// If backend configuration has changed, update backends in the request | ||
if d.HasChange("backend") { | ||
backends := d.Get("backend").([]interface{}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
backends
} | ||
|
||
// If instance pool configuration has changed, update instance pools in the request | ||
if d.HasChange("instance_pool") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instance_pools
|
||
// If instance pool configuration has changed, update instance pools in the request | ||
if d.HasChange("instance_pool") { | ||
instancePools := d.Get("instance_pool").([]interface{}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instance_pools
No description provided.