【问题标题】:terraform alicloud failed to create alicloud_cs_managed_kubernetesterraform alicloud 创建 alicloud_cs_managed_kubernetes 失败
【发布时间】:2020-03-01 00:36:29
【问题描述】:

我正在使用 terraform 创建阿里云托管的 kubernetes。我关注的链接如下: https://www.terraform.io/docs/providers/alicloud/r/cs_managed_kubernetes.html

我使用与 terraform 状态完全相同的代码。我正在使用的可用区域是 cn-shenzhen-a,但是,当我运行 terraform apply 时,我总是收到此错误

alicloud_cs_managed_kubernetes.k8s: [ERROR] terraform-provider-alicloud/alicloud/resource_alicloud_cs_managed_kubernetes.go:322: Resource alicloud_cs_managed_kubernetes CreateKubernetesCluster Failed!!! [SDK denverdino/aliyungo ERROR]:
Aliyun API Error: RequestId: C598AA1D-6993-46F6-A831-A9A6E8B8CEC1 Status Code: 400 Code: ZoneNotSupported Message: The current zone  does not support creating SLB, please try other zones

Terraform does not automatically rollback in the face of errors.
Instead, your Terraform state file has been partially updated with
any resources that successfully completed. Please address the error
above and apply again to incrementally change your infrastructure.

我仔细检查了SLB,发现cn-shenzhen-a可以创建SLB。 我使用的阿里云账号是中国账号不是国际账号。

【问题讨论】:

    标签: terraform alibaba-cloud


    【解决方案1】:

    你应该尽早创建 vpc 和 vswitch,在 k8s 配置中设置 vswitch_ids。 它在我的环境中解决了同样的问题。

    data "alicloud_vswitches" "vswitch"{
    
    }
    resource "alicloud_cs_managed_kubernetes" "k8s" {
      ......
      vswitch_ids = [data.alicloud_vswitches.vswitch.vswitches[0].id]
    }
    

    【讨论】:

      【解决方案2】:

      通过指定 vswitch_ids 而不是 availability_zone 来尝试:

      resource "alicloud_cs_managed_kubernetes" "k8s" {
        name              = "${var.name}"
        # availability_zone = "cn-beijing-c"
        vswitch_ids = ["vsw-2ze........."]
        # availability_zone     = "${data.alicloud_zones.main.zones.2.id}"
        new_nat_gateway       = true
       ...
      

      参考以下链接:
      https://github.com/terraform-providers/terraform-provider-alicloud/issues/1097#issuecomment-555897474

      【讨论】:

        猜你喜欢
        • 2020-12-31
        • 2019-05-20
        • 2020-12-15
        • 2021-05-13
        • 2021-01-15
        • 2021-06-09
        • 1970-01-01
        • 2021-05-09
        • 2023-01-04
        相关资源
        最近更新 更多