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

Enable LB support #356

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Enable LB support #356

wants to merge 6 commits into from

Conversation

uzaxirr
Copy link
Member

@uzaxirr uzaxirr commented Nov 12, 2024

No description provided.

@uzaxirr uzaxirr self-assigned this Nov 12, 2024
Optional: true,
Description: "Firewall rules for the load balancer (e.g., 'all', '80,443', '40-80,90-120').",
},
"backend": {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be backends

Copy link
Member Author

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": {

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

Copy link
Member Author

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")

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")

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)

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? :)

Copy link
Member Author

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 {

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") {

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{})

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") {

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{})

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instance_pools

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants