Skip to content

Commit

Permalink
add explicit cluster_version otherwise search errors with ami
Browse files Browse the repository at this point in the history
  • Loading branch information
darkn3rd committed May 17, 2022
1 parent 7a8a1e4 commit 3c2cb8e
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 14 deletions.
27 changes: 18 additions & 9 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ data "aws_availability_zones" "available" {}

module "vpc" {
source = "terraform-aws-modules/vpc/aws"
version = "3.14.0"
version = "3.2.0"

name = "ekstf-vpc"
cidr = "192.168.0.0/16"
cidr = "10.0.0.0/16"
azs = data.aws_availability_zones.available.names
private_subnets = ["192.168.160.0/19", "192.168.128.0/19", "192.168.96.0/19"]
public_subnets = ["192.168.64.0/19", "192.168.32.0/19", "192.168.0.0/19"]
private_subnets = ["10.0.1.0/24", "10.0.2.0/24", "10.0.3.0/24"]
public_subnets = ["10.0.4.0/24", "10.0.5.0/24", "10.0.6.0/24"]
enable_nat_gateway = true
single_nat_gateway = true
enable_dns_hostnames = true
Expand All @@ -38,11 +38,12 @@ module "vpc" {
}

module "eks" {
source = "terraform-aws-modules/eks/aws"
version = "18.21.0"
cluster_name = var.eks_cluster_name
subnets = module.vpc.private_subnets
vpc_id = module.vpc.vpc_id
source = "terraform-aws-modules/eks/aws"
version = "17.24.0"
cluster_name = var.eks_cluster_name
cluster_version = "1.22"
subnets = module.vpc.private_subnets
vpc_id = module.vpc.vpc_id

workers_additional_policies = var.workers_additional_policies

Expand All @@ -54,3 +55,11 @@ module "eks" {
}
]
}

data "aws_eks_cluster" "cluster" {
name = module.eks.cluster_id
}

data "aws_eks_cluster_auth" "cluster" {
name = module.eks.cluster_id
}
17 changes: 12 additions & 5 deletions provider.tf
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
provider "aws" {
region = var.region
region = var.region
}

provider "random" {}
provider "local" {}
provider "null" {}
provider "template" {}
provider "kubernetes" {
host = module.eks.cluster_endpoint
cluster_ca_certificate = base64decode(module.eks.cluster_certificate_authority_data)

exec {
api_version = "client.authentication.k8s.io/v1alpha1"
command = "aws"
# This requires the awscli to be installed locally where Terraform is executed
args = ["eks", "get-token", "--cluster-name", module.eks.cluster_id]
}
}

0 comments on commit 3c2cb8e

Please sign in to comment.