Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/complete/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ variable "profile" {
}

variable "region" {
default = "cn-hangzhou"
default = "cn-shanghai"
}

data "alicloud_vpcs" "default" {
Expand Down
8 changes: 5 additions & 3 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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" {
Expand Down
24 changes: 17 additions & 7 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
variable "region" {
description = "The region used to launch this module resources."
type = string
default = ""
default = "cn-shanghai"
}
variable "profile" {
description = "The profile name as set in the shared credentials file. If not set, it will be sourced from the ALICLOUD_PROFILE environment variable."
type = string
default = ""
default = "default"
}
variable "shared_credentials_file" {
description = "This is the path to the shared credentials file. If this is not set and a profile is specified, $HOME/.aliyun/config.json will be used."
Expand Down Expand Up @@ -112,13 +112,13 @@ variable "new_nat_gateway" {
variable "master_instance_types" {
description = "The ecs instance types used to launch master nodes."
type = list(string)
default = []
default = ["ecs.n1.medium", "ecs.c5.large", "ecs.n1.medium"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不要写死,用 datasource

}

variable "worker_instance_types" {
description = "The ecs instance types used to launch worker nodes."
type = list(string)
default = []
default = ["ecs.n1.medium"]
}

variable "node_cidr_mask" {
Expand Down Expand Up @@ -177,9 +177,9 @@ 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" {
Expand All @@ -188,5 +188,15 @@ variable "cluster_addons" {
name = string
config = string
}))
default = []
default = [{
"name" = "flannel",
"config" = "",
}
]
}

variable "nat_type" {
description = "The type of NAT gateway. Valid values: 'Enhanced'."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

格式

type = string
default = "Enhanced"
}