Rapha-Borges / oke-free

Uma maneira fácil de garantir seu próprio cluster Kubernetes gratuitamente e para sempre
GNU General Public License v3.0
891 stars 381 forks source link

Invalid count argument #52

Open romanharen1 opened 2 days ago

romanharen1 commented 2 days ago

Ao tentar executar o tofu plan/apply os erros abaixo foram apresentados.

Error: Invalid count argument
on loadbalancer/loadbalancer.tf line 43, in resource "oci_network_load_balancer_backend" "nlb_backend_http":
43:   count                    = length(data.oci_containerengine_node_pool.oke_node_pool.nodes)
The "count" value depends on resource attributes that cannot be determined until apply, so OpenTofu cannot predict how many instances will be created.

Error: Invalid count argument
on loadbalancer/loadbalancer.tf line 52, in resource "oci_network_load_balancer_backend" "nlb_backend_https":
52:   count                    = length(data.oci_containerengine_node_pool.oke_node_pool.nodes)
The "count" value depends on resource attributes that cannot be determined until apply, so OpenTofu cannot predict how many instances will be created.
Rapha-Borges commented 2 days ago

Você pode testar o código na branch fix/loadbalancer-backend para ver se o erro persiste?

romanharen1 commented 2 days ago

Acabei de testar, infelizmente não funcionou, dê uma olhada abaixo no retorno.

Error: Invalid for_each argument
on loadbalancer/loadbalancer.tf line 39, in resource "oci_network_load_balancer_backend" "nlb_backend_http":
39:   for_each                 = { for idx, node in data.oci_containerengine_node_pool.oke_node_pool.nodes : idx => node }
data.oci_containerengine_node_pool.oke_node_pool.nodes is a list of object, known only after apply

The "for_each" map includes keys derived from resource attributes that cannot be determined until apply, and so OpenTofu cannot determine the full set of keys that will identify the instances of this resource.

Error: Invalid for_each argument
on loadbalancer/loadbalancer.tf line 48, in resource "oci_network_load_balancer_backend" "nlb_backend_https":
48:   for_each                 = { for idx, node in data.oci_containerengine_node_pool.oke_node_pool.nodes : idx => node }
data.oci_containerengine_node_pool.oke_node_pool.nodes is a list of object, known only after apply

The "for_each" map includes keys derived from resource attributes that cannot be determined until apply, and so OpenTofu cannot determine the full set of keys that will identify the instances of this resource.
Rapha-Borges commented 2 days ago

Obrigado por validar. Vou precisar de mais tempo para analisar e refatorar o código. Enquanto isso, você pode utilizar a branch revert-51-fix/network-load-balancer-backends, que contém o código antigo.