Open garutilorenzo opened 2 years ago
The same probelm occures if i try to use the private ip ocid as target_id:
β Error: 404-NotAuthorizedOrNotFound
β Provider version: 4.64.0, released on 2022-02-16. This provider is 13 Update(s) behind to current.
β Service: Network Load Balancer Backend
β Error Message: Unknown resource Entity of type Backend with key ocid1.privateip.oc1.eu-zurich-1.ab5heljrku3dvhwandbamb34s7cthenz4vki52iycqgoj5obfkoexbserhzq.6443 not found
β OPC request ID: 73aca760d408945945bcb3ed681d8b8b/EF6781C100C57DB2EF6AC79D40FF19F1/74E7BA9E972DCF1A125522BF258F90E0
β Suggestion: Either the resource has been deleted or service Network Load Balancer Backend need policy to access this resource. Policy reference: https://docs.oracle.com/en-us/iaas/Content/Identity/Reference/policyreference.htm
β
β
β with module.k3s_cluster.oci_network_load_balancer_backend.k3s_kube_api_backend[0],
β on ../k3slb.tf line 36, in resource "oci_network_load_balancer_backend" "k3s_kube_api_backend":
β 36: resource "oci_network_load_balancer_backend" "k3s_kube_api_backend" {
β
β΅
β·
β Error: 404-NotAuthorizedOrNotFound
β Provider version: 4.64.0, released on 2022-02-16. This provider is 13 Update(s) behind to current.
β Service: Network Load Balancer Backend
β Error Message: Unknown resource Entity of type Backend with key ocid1.privateip.oc1.eu-zurich-1.ab5heljryssggfe4rldf26asmvcpjrj2aoktk7fp6yzwdxpngqszpqgugfja.6443 not found
β OPC request ID: ba08ecc04d664aa6a44161e9fa453ec3/06469C6E7FA4A2840278859A5C74EB5E/79880A506DB3F22E3DA470E79C826946
β Suggestion: Either the resource has been deleted or service Network Load Balancer Backend need policy to access this resource. Policy reference: https://docs.oracle.com/en-us/iaas/Content/Identity/Reference/policyreference.htm
β
β
β with module.k3s_cluster.oci_network_load_balancer_backend.k3s_kube_api_backend[1],
β on ../k3slb.tf line 36, in resource "oci_network_load_balancer_backend" "k3s_kube_api_backend":
β 36: resource "oci_network_load_balancer_backend" "k3s_kube_api_backend" {
I've found a workaround. With some reverse enginereeng i've inspected the html of the web console and i've found that the name was setted to the instance name (the name if is not provided is automatically generated). Inspecting the page i've found that in the id of the html the name instead was setted to $instance_id:$backend_port
Then i've tried to import the resurce with:
terraform import module.k3s_cluster.oci_network_load_balancer_backend.k3s_kube_api_backend[1] "networkLoadBalancers/ocid1.networkloadbalancer.oc1.eu-zurich-1.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/backendSets/k3s_kube_api_backend/backends/ocid1.instance.oc1.eu-zurich-1.xxxxxxxxxxxxxxxxxxxxxx:6443"
and the import has correctly imported the backend
Changing the backend name to $instance_id:$backend_port fix the problem, but this is only a workaround.
Also, with this workaround the backand name in the web console is always setted to the instance name. I think something has changed in the OCI api and at the moment is not documented.
UPDATE
The value in the name argument can be any kind of string
name = format("%s_%s", "k3s_server", count.index)
or
name = data.oci_core_instance_pool_instances.k3s_servers_instances.instances[count.index].display_name
so the name argument is a required argument, the value must be "any kind of string". In the web interface the result is always the same, the instance name is displayed:
This is the working code:
resource "oci_network_load_balancer_backend" "k3s_kube_api_backend" {
depends_on = [
oci_core_instance_pool.k3s_servers,
]
count = var.k3s_server_pool_size
backend_set_name = oci_network_load_balancer_backend_set.k3s_kube_api_backend_set.name
network_load_balancer_id = oci_network_load_balancer_network_load_balancer.k3s_load_balancer.id
name = data.oci_core_instance_pool_instances.k3s_servers_instances.instances[count.index].display_name
port = var.kube_api_port
target_id = data.oci_core_instance_pool_instances.k3s_servers_instances.instances[count.index].id
}
Thank you for reporting the issue. We have raised an internal ticket to track this. Our service engineers will get back to you.
Community Note
Terraform Version and Provider Version
Terraform v1.1.6 on linux_amd64
i've tried also oracle/oci module v.4.64.0 and the latest oracle oci module
Affected Resource(s)
oci_network_load_balancer_backend
Terraform Configuration Files
lb.tf
data.tf
instance_pool.tf
Panic Output
If i try to apply again:
Actual Behavior
Backend are correctly created but 404-NotAuthorizedOrNotFound error occured
Steps to Reproduce
Apply this module