Skip to content

Commit

Permalink
Merge pull request #12 from ministryofjustice/ANPL-1197
Browse files Browse the repository at this point in the history
feat: add test folder
  • Loading branch information
bogdan-mania-moj committed Sep 8, 2022
2 parents bca29c9 + 5bcac62 commit dca76bf
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 0 deletions.
60 changes: 60 additions & 0 deletions test/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
locals {

cluster_name = "eks-core-dev-cluster"
vpc_availability_zones = ["eu-west-1a", "eu-west-1b", "eu-west-1c"]
vpc_cidr = "10.69.0.0/16"
vpc_private_subnets = ["10.69.96.0/20", "10.69.112.0/20", "10.69.128.0/20"]
vpc_public_subnets = ["10.69.144.0/20", "10.69.160.0/20", "10.69.176.0/20"]

# Add more locals as required
}

module "eks_cluster" {
source = "./.."

# This needs specifiying properly
map_roles = []
subnets = module.vpc.private_subnets
cluster_name = local.cluster_name
cluster_version = "1.21"
cluster_node_group_version = "1.21"
cluster_vpc_cni_version = "v1.9.0-eksbuild.1"
cluster_coredns_version = "v1.8.4-eksbuild.1"
cluster_kube_proxy_version = "v1.21.2-eksbuild.2"
main_nodegroup_instance_types = "r5.2xlarge"
core_infra_nodegroup_instance_types = "r5.4xlarge"
main_nodegroup_min_capacity = 3
main_nodegroup_max_capacity = 6
main_nodegroup_desired_capacity = 3
core_infra_nodegroup_min_capacity = 3
core_infra_nodegroup_max_capacity = 6
core_infra_nodegroup_desired_capacity = 3
disk_size = 50
vpc_id = module.vpc.vpc_id

# You will likely have to use a fake ARN here
route53_zone_arn = "arn:aws:route53:::hostedzone/Z111XEXAMPLE9"

}

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

azs = local.vpc_availability_zones
cidr = local.vpc_cidr
enable_dns_hostnames = true
enable_nat_gateway = true
name = local.cluster_name
private_subnet_tags = {
"kubernetes.io/cluster/${local.cluster_name}" = "shared"
"kubernetes.io/role/internal-elb" = "1"
}
private_subnets = local.vpc_private_subnets
public_subnet_tags = {
"kubernetes.io/cluster/${local.cluster_name}" = "shared"
"kubernetes.io/role/elb" = "1"
}
public_subnets = local.vpc_public_subnets
single_nat_gateway = false
}
13 changes: 13 additions & 0 deletions test/providers.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
provider "kubernetes" {
host = data.aws_eks_cluster.cluster.endpoint
cluster_ca_certificate = base64decode(data.aws_eks_cluster.cluster.certificate_authority[0].data)
token = data.aws_eks_cluster_auth.cluster.token
}

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

data "aws_eks_cluster_auth" "cluster" {
name = module.eks_cluster.cluster_id
}
10 changes: 10 additions & 0 deletions test/versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 3.71.0"
}
}

required_version = ">= 0.14.0"
}

0 comments on commit dca76bf

Please sign in to comment.