add terraform config files

This commit is contained in:
Nana Janashia
2020-12-20 13:28:58 +01:00
parent 70fb6f1f11
commit 6566e1b821
6 changed files with 237 additions and 0 deletions

43
terraform/eks-cluster.tf Normal file
View File

@@ -0,0 +1,43 @@
provider "kubernetes" {
load_config_file = "false"
host = data.aws_eks_cluster.myapp-cluster.endpoint
token = data.aws_eks_cluster_auth.myapp-cluster.token
cluster_ca_certificate = base64decode(data.aws_eks_cluster.myapp-cluster.certificate_authority.0.data)
}
data "aws_eks_cluster" "myapp-cluster" {
name = module.eks.cluster_id
}
data "aws_eks_cluster_auth" "myapp-cluster" {
name = module.eks.cluster_id
}
module "eks" {
source = "terraform-aws-modules/eks/aws"
version = "13.2.1"
cluster_name = var.cluster_name
cluster_version = var.k8s_version
subnets = module.myapp-vpc.private_subnets
vpc_id = module.myapp-vpc.vpc_id
tags = {
environment = var.env_prefix
application = "myapp"
}
worker_groups = [
{
instance_type = "t2.small"
name = "worker-group-1"
asg_desired_capacity = 2
},
{
instance_type = "t2.medium"
name = "worker-group-2"
asg_desired_capacity = 1
}
]
}