diff --git a/examples/complete/main.tf b/examples/complete/main.tf index cc3ba6a..e17bf27 100644 --- a/examples/complete/main.tf +++ b/examples/complete/main.tf @@ -3,7 +3,7 @@ variable "profile" { } variable "region" { - default = "cn-hangzhou" + default = "cn-shanghai" } data "alicloud_vpcs" "default" { diff --git a/main.tf b/main.tf index d600fb9..22a8efc 100644 --- a/main.tf +++ b/main.tf @@ -43,9 +43,11 @@ resource "alicloud_vswitch" "vswitches" { } resource "alicloud_nat_gateway" "default" { - count = var.new_nat_gateway == true ? 1 : 0 - vpc_id = var.vpc_id == "" ? join("", alicloud_vpc.vpc.*.id) : var.vpc_id - name = var.example_name + count = var.new_nat_gateway == true ? 1 : 0 + vpc_id = var.vpc_id == "" ? join("", alicloud_vpc.vpc.*.id) : var.vpc_id + name = var.example_name + nat_type = var.nat_type + vswitch_id = length(var.vswitch_ids) > 0 ? split(",", join(",", var.vswitch_ids))[count.index % length(split(",", join(",", var.vswitch_ids)))] : length(var.vswitch_cidrs) < 1 ? "" : split(",", join(",", alicloud_vswitch.vswitches.*.id))[count.index % length(split(",", join(",", alicloud_vswitch.vswitches.*.id)))] } resource "alicloud_eip" "default" { diff --git a/variables.tf b/variables.tf index 42d2daa..c2d26b0 100644 --- a/variables.tf +++ b/variables.tf @@ -177,16 +177,26 @@ variable "k8s_service_cidr" { } variable "k8s_version" { - description = "The version of the kubernetes version. Valid values: '1.16.6-aliyun.1','1.14.8-aliyun.1'. Default to '1.16.6-aliyun.1'." + description = "The version of the kubernetes version. Valid values: 1.20.11-aliyun.1 1.18.8-aliyun.1." type = string - default = "1.16.6-aliyun.1" + default = "1.20.11-aliyun.1" } variable "cluster_addons" { - description = "Addon components in kubernetes cluster" - type = list(object({ - name = string - config = string + description = "Addon components in kubernetes cluster" + type = list(object({ + name = string + config = string })) - default = [] + default = [{ + "name" = "flannel", + "config" = "", + } + ] +} + +variable "nat_type" { + description = "The type of NAT gateway. Valid values: 'Enhanced'." + type = string + default = "Enhanced" }