Last active
February 27, 2021 13:40
-
-
Save NassK/12dc078a90224e076184a6fd86db1be6 to your computer and use it in GitHub Desktop.
Terraform EKS cluster step 1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
provider "aws" { | |
version = "~> 2.0" | |
region = "eu-west-1" | |
} | |
## Step 1: Configuring the VPC | |
module "vpc" { | |
source = "terraform-aws-modules/vpc/aws" | |
name = "my-eks-vpc" | |
cidr = "10.0.0.0/16" | |
azs = ["eu-west-1a", "eu-west-1b", "eu-west-1c"] | |
private_subnets = ["10.0.1.0/24", "10.0.2.0/24", "10.0.3.0/24"] | |
public_subnets = ["10.0.101.0/24", "10.0.102.0/24", "10.0.103.0/24"] | |
enable_nat_gateway = true | |
enable_vpn_gateway = false | |
vpc_tags = { | |
"kubernetes.io/cluster/${var.cluster_name}" = "shared" | |
} | |
private_subnet_tags = { | |
"kubernetes.io/cluster/${var.cluster_name}" = "shared" | |
} | |
public_subnet_tags = { | |
"kubernetes.io/cluster/${var.cluster_name}" = "shared" | |
} | |
enable_dns_hostnames = true # Needed for worker nodes in private subnets | |
enable_dns_support = true | |
/** | |
* Needed for workers node in public subnets. | |
* map_public_ip_on_launch = true | |
*/ | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
variable "region" { | |
description = "The AWS region" | |
default = "eu-west-1" | |
} | |
variable "cluster_name" { | |
description = "The name of the Amazon EKS cluster." | |
default = "my-eks-cluster" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment