Upgrade to terraform 0.12 (#394)

* run terraform upgrade tool

* fix post upgrade TODOs

* use strict typing for variables

* upgrade examples, point them at VPC module tf 0.12 PR

* remove unnecessary `coalesce()` calls

coalesce(lookup(map, key, ""), default) -> lookup(map, key, default)

* Fix autoscaling_enabled broken (#1)

* always set a value for tags, fix coalescelist calls

* always set a value for these tags

* fix tag value

* fix tag value

* default element available

* added default value

* added a general default

without this default - TF is throwing an error when running a destroy

* Fix CI

* Change vpc module back to `terraform-aws-modules/vpc/aws` in example

* Update CHANGELOG.md

* Change type of variable `cluster_log_retention_in_days` to number

* Remove `xx_count` variables

* Actual lists instead of strings with commas

* Remove `xx_count` variable from docs

* Replace element with list indexing

* Change variable `worker_group_tags` to a attribute of worker_group

* Fix workers_launch_template_mixed tags

* Change override_instance_type_x variables to list.

* Update CHANGELOG.md
This commit is contained in:
刘相轩
2019-06-19 15:57:51 +08:00
committed by Max Williams
parent 3f0601551f
commit da2c78b8ba
24 changed files with 1265 additions and 626 deletions

View File

@@ -1,17 +1,18 @@
terraform {
required_version = ">= 0.11.8"
required_version = ">= 0.12.0"
}
provider "aws" {
version = ">= 2.6.0"
region = "${var.region}"
version = ">= 2.11"
region = var.region
}
provider "random" {
version = "= 1.3.1"
version = "~> 2.1"
}
data "aws_availability_zones" "available" {}
data "aws_availability_zones" "available" {
}
locals {
cluster_name = "test-eks-lt-${random_string.suffix.result}"
@@ -24,10 +25,11 @@ resource "random_string" "suffix" {
module "vpc" {
source = "terraform-aws-modules/vpc/aws"
version = "1.60.0"
version = "2.6.0"
name = "test-vpc-lt"
cidr = "10.0.0.0/16"
azs = ["${data.aws_availability_zones.available.names}"]
azs = data.aws_availability_zones.available.names
public_subnets = ["10.0.4.0/24", "10.0.5.0/24", "10.0.6.0/24"]
tags = {
@@ -37,11 +39,9 @@ module "vpc" {
module "eks" {
source = "../.."
cluster_name = "${local.cluster_name}"
subnets = ["${module.vpc.public_subnets}"]
vpc_id = "${module.vpc.vpc_id}"
worker_group_count = 0
worker_group_launch_template_count = 2
cluster_name = local.cluster_name
subnets = module.vpc.public_subnets
vpc_id = module.vpc.vpc_id
worker_groups_launch_template = [
{
@@ -58,3 +58,4 @@ module "eks" {
},
]
}

View File

@@ -1,24 +1,25 @@
output "cluster_endpoint" {
description = "Endpoint for EKS control plane."
value = "${module.eks.cluster_endpoint}"
value = module.eks.cluster_endpoint
}
output "cluster_security_group_id" {
description = "Security group ids attached to the cluster control plane."
value = "${module.eks.cluster_security_group_id}"
value = module.eks.cluster_security_group_id
}
output "kubectl_config" {
description = "kubectl config as generated by the module."
value = "${module.eks.kubeconfig}"
value = module.eks.kubeconfig
}
output "config_map_aws_auth" {
description = "A kubernetes configuration to authenticate to this EKS cluster."
value = "${module.eks.config_map_aws_auth}"
value = module.eks.config_map_aws_auth
}
output "region" {
description = "AWS region."
value = "${var.region}"
value = var.region
}

View File

@@ -1,3 +1,4 @@
variable "region" {
default = "us-west-2"
}