Skip to content

Commit d5bb291

Browse files
xiaobing.mengxiaozhu36
authored andcommitted
fix kubernetes module
1 parent ceba86a commit d5bb291

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

main.tf

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ resource "alicloud_vswitch" "vswitches" {
4141
}
4242

4343
resource "alicloud_nat_gateway" "default" {
44-
count = var.new_nat_gateway == true ? 1 : 0
44+
count = var.new_nat_gateway == "true" ? 1 : 0
4545
vpc_id = var.vpc_id == "" ? join("", alicloud_vpc.vpc.*.id) : var.vpc_id
4646
name = var.example_name
4747
}
@@ -75,6 +75,8 @@ resource "alicloud_cs_kubernetes" "k8s" {
7575
var.k8s_name_prefix,
7676
format(var.number_format, count.index + 1),
7777
)
78+
vswitch_ids = [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)))]]
79+
7880
new_nat_gateway = false
7981
master_disk_category = var.master_disk_category
8082
worker_disk_category = var.worker_disk_category

outputs.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ output "vpc_id" {
66

77
output "vswitch_ids" {
88
description = "List ID of the VSwitches."
9-
value = [alicloud_cs_kubernetes.k8s.*.vswitch_id]
9+
value = [alicloud_cs_kubernetes.k8s.*.vswitch_ids]
1010
}
1111

1212
output "nat_gateway_id" {
@@ -26,6 +26,6 @@ output "security_group_id" {
2626

2727
output "cluster_nodes" {
2828
description = "List nodes of cluster."
29-
value = alicloud_cs_kubernetes.k8s.*.nodes
29+
value = alicloud_cs_kubernetes.k8s.*.worker_nodes
3030
}
3131

variables.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
variable "region" {
55
description = "The region used to launch this module resources."
6-
default = ""
6+
default = "cn-beijing"
77
}
88

99
variable "availability_zone" {
@@ -75,13 +75,13 @@ variable "new_nat_gateway" {
7575
variable "master_instance_types" {
7676
description = "The ecs instance type used to launch master nodes. Default from instance typs datasource."
7777
type = list(string)
78-
default = [""]
78+
default = ["ecs.n4.xlarge"]
7979
}
8080

8181
variable "worker_instance_types" {
8282
description = "The ecs instance type used to launch worker nodes. Default from instance typs datasource."
8383
type = list(string)
84-
default = [""]
84+
default = ["ecs.n4.xlarge"]
8585
}
8686

8787
variable "master_disk_category" {

0 commit comments

Comments
 (0)