gpt4 book ai didi

Terraform - 创建 OpenStack 负载均衡器 : Resource not found 时出错

转载 作者:行者123 更新时间:2023-12-04 02:30:04 31 4
gpt4 key购买 nike

我正在尝试使用 Terraform 创建 OpenStack 负载平衡器,但在 terraform apply 上出现以下错误:

Error: Error creating openstack_lb_loadbalancer_v2: Resource not found

on load-balancer/main.tf line 71, in resource"openstack_lb_loadbalancer_v2" "lb_1": 71: resource"openstack_lb_loadbalancer_v2" "lb_1" {


我的模板如下所示。
resource "openstack_lb_loadbalancer_v2" "lb_1" {
name = "loadbalancer"
vip_subnet_id = openstack_networking_subnet_v2.public.id
}

resource "openstack_lb_listener_v2" "listener_1" {
name = "https"
protocol = "TERMINATED_HTTPS"
protocol_port = 443
loadbalancer_id = openstack_lb_loadbalancer_v2.lb_1.id
default_tls_container_ref = openstack_keymanager_container_v1.tls_1.container_ref
}

resource "openstack_networking_network_v2" "lb_network" {
name = "lb-network"
port_security_enabled = "true"
}

resource "openstack_networking_subnet_v2" "public" {
name = "lb-subnet"
network_id = openstack_networking_network_v2.lb_network.id
cidr = "10.0.0.0/24"
ip_version = 4
}
我不知道如何进一步调试。是否意味着 vip_subnet_id没有找到?或者是 openstack_lb_loadbalancer_v2未知的资源类型?
我正在使用 Terraform v0.13.5 和 terraform-provider-openstack v1.33.0。
更新
我通过 Web 界面手动创建了一个 LB,现在我尝试通过 Terraform CLI 导入它并得到以下响应

Error: Cannot import non-existent remote object

While attempting to import an existing object toopenstack_lb_loadbalancer_v2.lb_1, the provider detected that noobject exists with the given id. Only pre-existing objects can beimported; check that the id is correct and that it is associated withthe provider's configured region or endpoint, or use "terraform apply"to create a new remote object for this resource.


我开始怀疑这可能是 OpenStack 服务器端的问题。

最佳答案

终于想通了你需要设置use_octiva = true在 openstack terraform 提供程序设置中。在此处查看相关文档:https://registry.terraform.io/providers/terraform-provider-openstack/openstack/latest/docs#use_octavia
示例配置:

cat main.tf
provider "openstack" {
user_name = var.os_user_name
tenant_name = var.os_tenant_name
password = var.os_password
auth_url = var.os_auth_url
region = var.os_region
endpoint_type = var.os_endpoint_type
use_octavia = true
}
这是相关的错误报告: https://github.com/terraform-provider-openstack/terraform-provider-openstack/issues/1100

关于Terraform - 创建 OpenStack 负载均衡器 : Resource not found 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64805162/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com