-
-
Notifications
You must be signed in to change notification settings - Fork 179
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #34 from WesleyCharlesBlake/ops/ec2-key
adds ec2 key pair creation
- Loading branch information
Showing
10 changed files
with
59 additions
and
58 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
# terraform-aws-eks | ||
|
||
[![CircleCI](https://circleci.com/gh/WesleyCharlesBlake/terraform-aws-eks.svg?style=svg)](https://circleci.com/gh/WesleyCharlesBlake/terraform-aws-eks) | ||
[![TerraformRefigistry](https://img.shields.io/badge/Terraform%20Registry-v2.0.2-blue.svg)](https://registry.terraform.io/modules/WesleyCharlesBlake/eks/aws/) | ||
[![TerraformRefigistry](https://img.shields.io/badge/Terraform%20Registry-version_2-blue.svg)](https://registry.terraform.io/modules/WesleyCharlesBlake/eks/aws/) | ||
|
||
|
||
Deploy a full AWS EKS cluster with Terraform | ||
|
@@ -24,26 +24,26 @@ Deploy a full AWS EKS cluster with Terraform | |
|
||
You can configure you config with the following input variables: | ||
|
||
| Name | Description | Default | | ||
| ------------------------- | ---------------------------------- | --------------------------------------------------------------------- | | ||
| `cluster-name` | The name of your EKS Cluster | `eks-cluster` | | ||
| `aws-region` | The AWS Region to deploy EKS | `us-east-1` | | ||
| `availability-zones` | AWS Availability Zones | `["us-east-1a", "us-east-1b", "us-east-1c"]` | | ||
| `k8s-version` | The desired K8s version to launch | `1.13` | | ||
| `node-instance-type` | Worker Node EC2 instance type | `m4.large` | | ||
| `root-block-size` | Size of the root EBS block device | `20` | | ||
| `desired-capacity` | Autoscaling Desired node capacity | `2` | | ||
| `max-size` | Autoscaling Maximum node capacity | `5` | | ||
| `min-size` | Autoscaling Minimum node capacity | `1` | | ||
| `public-min-size` | Public Node groups ASG capacity | `1` | | ||
| `public-max-size` | Public Node groups ASG capacity | `1` | | ||
| `public-desired-capacity` | Public Node groups ASG capacity | `1` | | ||
| `vpc-subnet-cidr` | Subnet CIDR | `10.0.0.0/16` | | ||
| `private-subnet-cidr` | Private Subnet CIDR | `["10.0.0.0/19", "10.0.32.0/19", "10.0.64.0/19"]` | | ||
| `public-subnet-cidr` | Public Subnet CIDR | `["10.0.128.0/20", "10.0.144.0/20", "10.0.160.0/20"]` | | ||
| `db-subnet-cidr` | DB/Spare Subnet CIDR | `["10.0.192.0/21", "10.0.200.0/21", "10.0.208.0/21"]` | | ||
| `eks-cw-logging` | EKS Logging Components | `["api", "audit", "authenticator", "controllerManager", "scheduler"]` | | ||
| `ec2-key` | EC2 Key Pair for bastion and nodes | `my-key` | | ||
| Name | Description | Default | | ||
| ------------------------- | ---------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| `cluster-name` | The name of your EKS Cluster | `eks-cluster` | | ||
| `aws-region` | The AWS Region to deploy EKS | `us-east-1` | | ||
| `availability-zones` | AWS Availability Zones | `["us-east-1a", "us-east-1b", "us-east-1c"]` | | ||
| `k8s-version` | The desired K8s version to launch | `1.13` | | ||
| `node-instance-type` | Worker Node EC2 instance type | `m4.large` | | ||
| `root-block-size` | Size of the root EBS block device | `20` | | ||
| `desired-capacity` | Autoscaling Desired node capacity | `2` | | ||
| `max-size` | Autoscaling Maximum node capacity | `5` | | ||
| `min-size` | Autoscaling Minimum node capacity | `1` | | ||
| `public-min-size` | Public Node groups ASG capacity | `1` | | ||
| `public-max-size` | Public Node groups ASG capacity | `1` | | ||
| `public-desired-capacity` | Public Node groups ASG capacity | `1` | | ||
| `vpc-subnet-cidr` | Subnet CIDR | `10.0.0.0/16` | | ||
| `private-subnet-cidr` | Private Subnet CIDR | `["10.0.0.0/19", "10.0.32.0/19", "10.0.64.0/19"]` | | ||
| `public-subnet-cidr` | Public Subnet CIDR | `["10.0.128.0/20", "10.0.144.0/20", "10.0.160.0/20"]` | | ||
| `db-subnet-cidr` | DB/Spare Subnet CIDR | `["10.0.192.0/21", "10.0.200.0/21", "10.0.208.0/21"]` | | ||
| `eks-cw-logging` | EKS Logging Components | `["api", "audit", "authenticator", "controllerManager", "scheduler"]` | | ||
| `ec2-key-public-key` | EC2 Key Pair for bastion and nodes | `ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQD3F6tyPEFEzV0LX3X8BsXdMsQz1x2cEikKDEY0aIj41qgxMCP/iteneqXSIFZBp5vizPvaoIR3Um9xK7PGoW8giupGn+EPuxIA4cDM4vzOqOkiMPhz5XK0whEjkVzTo4+S0puvDZuwIsdiW9mxhJc7tgBNL0cYlWSYVkz4G/fslNfRPW5mYAM49f4fhtxPb5ok4Q2Lg9dPKVHO/Bgeu5woMc7RY0p1ej6D4CKFE6lymSDJpW0YHX/wqE9+cfEauh7xZcG0q9t2ta6F6fmX0agvpFyZo8aFbXeUBr7osSCJNgvavWbM/06niWrOvYX2xwWdhXmXSrbX8ZbabVohBK41 [email protected]` | | ||
|
||
> You can create a file called terraform.tfvars or copy [variables.tf](https://github.com/WesleyCharlesBlake/terraform-aws-eks/blob/master/variables.tf) into the project root, if you would like to over-ride the defaults. | ||
|
@@ -82,7 +82,7 @@ module "eks" { | |
public-subnet-cidr = ["10.0.128.0/20", "10.0.144.0/20", "10.0.160.0/20"] | ||
db-subnet-cidr = ["10.0.192.0/21", "10.0.200.0/21", "10.0.208.0/21"] | ||
eks-cw-logging = ["api", "audit", "authenticator", "controllerManager", "scheduler"] | ||
ec2-key = "my-key" | ||
ec2-key-public-key = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQD3F6tyPEFEzV0LX3X8BsXdMsQz1x2cEikKDEY0aIj41qgxMCP/iteneqXSIFZBp5vizPvaoIR3Um9xK7PGoW8giupGn+EPuxIA4cDM4vzOqOkiMPhz5XK0whEjkVzTo4+S0puvDZuwIsdiW9mxhJc7tgBNL0cYlWSYVkz4G/fslNfRPW5mYAM49f4fhtxPb5ok4Q2Lg9dPKVHO/Bgeu5woMc7RY0p1ej6D4CKFE6lymSDJpW0YHX/wqE9+cfEauh7xZcG0q9t2ta6F6fmX0agvpFyZo8aFbXeUBr7osSCJNgvavWbM/06niWrOvYX2xwWdhXmXSrbX8ZbabVohBK41 [email protected]" | ||
} | ||
output "kubeconfig" { | ||
|
@@ -118,7 +118,7 @@ module "eks" { | |
public-subnet-cidr = var.public-subnet-cidr | ||
db-subnet-cidr = var.db-subnet-cidr | ||
eks-cw-logging = var.eks-cw-logging | ||
ec2-key = var.ec2-key | ||
ec2-key-public-key = var.ec2-key | ||
} | ||
``` | ||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
### VPC | ||
|
||
# use terraform cloud remote backend | ||
# use terraform cloud remote backend OR you can use your prefered remote backend | ||
|
||
terraform { | ||
backend "remote" { | ||
|
@@ -13,22 +13,25 @@ terraform { | |
|
||
|
||
module "eks" { | ||
source = "../modules/eks" | ||
source = "../modules/eks" | ||
|
||
aws-region = "us-east-1" | ||
availability-zones = ["us-east-1a", "us-east-1b", "us-east-1c"] | ||
cluster-name = "my-cluster" | ||
k8s-version = "1.13" | ||
node-instance-type = "t3.medium" | ||
desired-capacity = "3" | ||
max-size = "5" | ||
min-size = "1" | ||
vpc-subnet-cidr = "10.0.0.0/16" | ||
private-subnet-cidr = ["10.0.0.0/19", "10.0.32.0/19", "10.0.64.0/19"] | ||
public-subnet-cidr = ["10.0.128.0/20", "10.0.144.0/20", "10.0.160.0/20"] | ||
db-subnet-cidr = ["10.0.192.0/21", "10.0.200.0/21", "10.0.208.0/21"] | ||
eks-cw-logging = ["api", "audit", "authenticator", "controllerManager", "scheduler"] | ||
ec2-key = "my-key" | ||
aws-region = "us-east-1" | ||
availability-zones = ["us-east-1a", "us-east-1b", "us-east-1c"] | ||
cluster-name = "my-cluster" | ||
k8s-version = "1.13" | ||
node-instance-type = "t3.medium" | ||
desired-capacity = 3 | ||
max-size = 5 | ||
min-size = 1 | ||
public-min-size = 1 | ||
public-max-size = 5 | ||
public-desired-capacity = 3 | ||
vpc-subnet-cidr = "10.0.0.0/16" | ||
private-subnet-cidr = ["10.0.0.0/19", "10.0.32.0/19", "10.0.64.0/19"] | ||
public-subnet-cidr = ["10.0.128.0/20", "10.0.144.0/20", "10.0.160.0/20"] | ||
db-subnet-cidr = ["10.0.192.0/21", "10.0.200.0/21", "10.0.208.0/21"] | ||
eks-cw-logging = ["api", "audit", "authenticator", "controllerManager", "scheduler"] | ||
ec2-key-public-key = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQD3F6tyPEFEzV0LX3X8BsXdMsQz1x2cEikKDEY0aIj41qgxMCP/iteneqXSIFZBp5vizPvaoIR3Um9xK7PGoW8giupGn+EPuxIA4cDM4vzOqOkiMPhz5XK0whEjkVzTo4+S0puvDZuwIsdiW9mxhJc7tgBNL0cYlWSYVkz4G/fslNfRPW5mYAM49f4fhtxPb5ok4Q2Lg9dPKVHO/Bgeu5woMc7RY0p1ej6D4CKFE6lymSDJpW0YHX/wqE9+cfEauh7xZcG0q9t2ta6F6fmX0agvpFyZo8aFbXeUBr7osSCJNgvavWbM/06niWrOvYX2xwWdhXmXSrbX8ZbabVohBK41 [email protected]" | ||
} | ||
|
||
output "kubeconfig" { | ||
|
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
variable "ec2-key-public-key" {} | ||
|
||
resource "aws_key_pair" "deployer" { | ||
key_name = var.cluster-name | ||
public_key = var.ec2-key-public-key | ||
} |
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
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
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -101,23 +101,23 @@ variable "min-size" { | |
variable "public-min-size" { | ||
default = 1 | ||
type = string | ||
description = "Public Node groups ASG capacity" | ||
description = "Public Node groups min ASG capacity" | ||
} | ||
|
||
variable "public-max-size" { | ||
default = 1 | ||
type = string | ||
description = "Public Node groups ASG capacity" | ||
description = "Public Node groups max ASG capacity" | ||
} | ||
|
||
variable "public-desired-capacity" { | ||
default = 1 | ||
type = string | ||
description = "Public Node groups ASG capacity" | ||
description = "Public Node groups desired ASG capacity" | ||
} | ||
|
||
variable "ec2-key" { | ||
default = "my-key" | ||
variable "ec2-key-public-key" { | ||
default = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQD3F6tyPEFEzV0LX3X8BsXdMsQz1x2cEikKDEY0aIj41qgxMCP/iteneqXSIFZBp5vizPvaoIR3Um9xK7PGoW8giupGn+EPuxIA4cDM4vzOqOkiMPhz5XK0whEjkVzTo4+S0puvDZuwIsdiW9mxhJc7tgBNL0cYlWSYVkz4G/fslNfRPW5mYAM49f4fhtxPb5ok4Q2Lg9dPKVHO/Bgeu5woMc7RY0p1ej6D4CKFE6lymSDJpW0YHX/wqE9+cfEauh7xZcG0q9t2ta6F6fmX0agvpFyZo8aFbXeUBr7osSCJNgvavWbM/06niWrOvYX2xwWdhXmXSrbX8ZbabVohBK41 [email protected]" | ||
type = string | ||
description = "Autoscaling Minimum node capacity" | ||
description = "AWS EC2 public key data" | ||
} |