ucloud/terraform-provider-ucloud

区域指定华北2 报错返回区域不可用

Pger-Y opened this issue · 4 comments

ucloud_instance.example: Creating...

│ Error: error on creating instance, api:
│ [server.RetCodeError] 230 Params [Zone] not available

│ with ucloud_instance.example,
│ on main.tf line 26, in resource "ucloud_instance" "example":
│ 26: resource "ucloud_instance" "example" {


Releasing state lock. This may take a few moments...

看上去是因为镜像和主机指定的availability_zone不一致导致的。

另外,请贴代码而不要贴截图,以方便我们复制,谢谢。

感谢回复,当时尝试了查询和创建都写了cn-wlcb-01但错误是一样的,所以当时把查询的zone改了,如下代码依然是报同样的错误

image

查询指定可用区中的主机镜像

data "ucloud_images" "default" {
availability_zone = "cn-wlcb-01"
name_regex = "^Rocky.*"
image_type = "base"
}

创建一台 UCloud 云主机

resource "ucloud_instance" "example" {
availability_zone = "cn-wlcb-01"
image_id = data.ucloud_images.default.images[0].id
instance_type = "o-basic-1"
root_password = "xxxxxxx&*%"
name = "room.test"
min_cpu_platform = "Amd/Auto"
charge_type = "year"
data_disk_type = "local_normal"
data_disk_size = 20
}

Error: error on reading image list, api:
│ [server.RetCodeError] 230 Params [Zone] not available

│ with data.ucloud_images.default,
│ on main.tf line 19, in data "ucloud_images" "default":
│ 19: data "ucloud_images" "default" {

看上去是因为镜像和主机指定的availability_zone不一致导致的。

另外,请贴代码而不要贴截图,以方便我们复制,谢谢。

依然报错,怀疑是zone参数写的有问题,但确实是看文档配置的 https://docs.ucloud.cn/api/summary/regionlist

如果用的是华北二地域,应该是cn-wlcb,而不是cn-wlcb-01