Skip to content

Commit

Permalink
address some review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
daroga0002 committed Oct 8, 2021
1 parent cc8c7d7 commit 95b659e
Show file tree
Hide file tree
Showing 50 changed files with 728 additions and 913 deletions.
14 changes: 0 additions & 14 deletions examples/README.md

This file was deleted.

14 changes: 9 additions & 5 deletions examples/bottlerocket/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Bottlerocket example
# AWS EKS cluster running Bottlerocket AMI

This is EKS example using Bottlerocket workers in EKS.
Configuration in this directory creates EKS cluster with workers group running [AWS Bottlerocket OS](https://github.com/bottlerocket-os/bottlerocket)

This is a minimalistic example which shows what knobs to turn to make Bottlerocket work.

See [the official documentation](https://docs.aws.amazon.com/eks/latest/userguide/eks-optimized-ami-bottlerocket.html) for more details.

## Usage

Expand All @@ -21,7 +25,8 @@ Note that this example may create resources which cost money. Run `terraform des
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.1 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.22.0 |
| <a name="requirement_kubernetes"></a> [kubernetes](#requirement\_kubernetes) | >= 2.0.0 |
| <a name="requirement_kubernetes"></a> [kubernetes](#requirement\_kubernetes) | ~> 2.0 |
| <a name="requirement_local"></a> [local](#requirement\_local) | >= 1.4 |
| <a name="requirement_random"></a> [random](#requirement\_random) | >= 2.1 |
| <a name="requirement_tls"></a> [tls](#requirement\_tls) | >= 2.0 |

Expand All @@ -38,7 +43,7 @@ Note that this example may create resources which cost money. Run `terraform des
| Name | Source | Version |
|------|--------|---------|
| <a name="module_eks"></a> [eks](#module\_eks) | ../.. | |
| <a name="module_vpc"></a> [vpc](#module\_vpc) | terraform-aws-modules/vpc/aws | ~> 3.7.0 |
| <a name="module_vpc"></a> [vpc](#module\_vpc) | terraform-aws-modules/vpc/aws | ~> 3.0 |

## Resources

Expand All @@ -58,7 +63,6 @@ Note that this example may create resources which cost money. Run `terraform des
| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_cluster_version"></a> [cluster\_version](#input\_cluster\_version) | EKS version | `string` | `"1.20"` | no |
| <a name="input_example_name"></a> [example\_name](#input\_example\_name) | Example name | `string` | `"bottlerocket"` | no |
| <a name="input_region"></a> [region](#input\_region) | AWS region where example will be created | `string` | `"eu-west-1"` | no |

## Outputs
Expand Down
59 changes: 0 additions & 59 deletions examples/bottlerocket/generic.tf

This file was deleted.

83 changes: 77 additions & 6 deletions examples/bottlerocket/main.tf
Original file line number Diff line number Diff line change
@@ -1,9 +1,80 @@
provider "aws" {
region = var.region
}

locals {
name = "bottlerocket-${random_string.suffix.result}"
}

################################################################################
# Supporting Resources
################################################################################

data "aws_availability_zones" "available" {
}

resource "random_string" "suffix" {
length = 8
special = false
}

module "vpc" {
source = "terraform-aws-modules/vpc/aws"
version = "~> 3.0"

name = local.name
cidr = "10.0.0.0/16"
azs = data.aws_availability_zones.available.names
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

public_subnet_tags = {
"kubernetes.io/cluster/${local.name}" = "shared"
"kubernetes.io/role/elb" = "1"
}

private_subnet_tags = {
"kubernetes.io/cluster/${local.name}" = "shared"
"kubernetes.io/role/internal-elb" = "1"
}

tags = {
Example = local.name
GithubRepo = "terraform-aws-eks"
GithubOrg = "terraform-aws-modules"
}
}

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

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

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
}

module "eks" {
source = "../.."
cluster_name = local.cluster_name
cluster_version = var.cluster_version
vpc_id = module.vpc.vpc_id
subnets = module.vpc.private_subnets
source = "../.."

cluster_name = local.name
cluster_version = var.cluster_version

vpc_id = module.vpc.vpc_id
subnets = [module.vpc.private_subnets[0], module.vpc.public_subnets[1]]
fargate_subnets = [module.vpc.private_subnets[2]]

cluster_endpoint_private_access = true
cluster_endpoint_public_access = true

Expand Down Expand Up @@ -42,7 +113,7 @@ EOT
]

tags = {
Example = var.example_name
Example = local.name
GithubRepo = "terraform-aws-eks"
GithubOrg = "terraform-aws-modules"
}
Expand Down
10 changes: 2 additions & 8 deletions examples/bottlerocket/variables.tf
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
variable "region" {
type = string
description = "AWS region where example will be created"
default = "eu-west-1"
}

variable "example_name" {
type = string
description = "Example name"
default = "bottlerocket"
default = "eu-west-1"
}

variable "cluster_version" {
type = string
description = "EKS version"
type = string
default = "1.20"
}
3 changes: 2 additions & 1 deletion examples/bottlerocket/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ terraform {

required_providers {
aws = ">= 3.22.0"
local = ">= 1.4"
random = ">= 2.1"
kubernetes = "~> 2.0"
tls = ">= 2.0"
kubernetes = ">= 2.0.0"
}
}
16 changes: 10 additions & 6 deletions examples/complete/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# Complete example
# Complete AWS EKS Cluster

Configuration in this directory creates EKS cluster with different features shown all-in-one cluster (e.g. Managed Node Groups, Worker Groups, Fargate, Spot instances, AWS Auth enabled).

This example can be used to do smoke test.

See configurations in other `examples` directories for more specific cases.

This is EKS example using creating various EKS clusters with different setups of this module.
## Usage

To run this example you need to execute:
Expand All @@ -20,8 +25,8 @@ Note that this example may create resources which cost money. Run `terraform des
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.1 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.22.0 |
| <a name="requirement_kubernetes"></a> [kubernetes](#requirement\_kubernetes) | >= 2.0.0 |
| <a name="requirement_local"></a> [local](#requirement\_local) | >= 2.0.0 |
| <a name="requirement_kubernetes"></a> [kubernetes](#requirement\_kubernetes) | ~> 2.0 |
| <a name="requirement_local"></a> [local](#requirement\_local) | >= 1.4 |
| <a name="requirement_random"></a> [random](#requirement\_random) | >= 2.1 |

## Providers
Expand All @@ -39,7 +44,7 @@ Note that this example may create resources which cost money. Run `terraform des
| <a name="module_disabled_fargate"></a> [disabled\_fargate](#module\_disabled\_fargate) | ../../modules/fargate | |
| <a name="module_disabled_node_groups"></a> [disabled\_node\_groups](#module\_disabled\_node\_groups) | ../../modules/node_groups | |
| <a name="module_eks"></a> [eks](#module\_eks) | ../.. | |
| <a name="module_vpc"></a> [vpc](#module\_vpc) | terraform-aws-modules/vpc/aws | ~> 3.7.0 |
| <a name="module_vpc"></a> [vpc](#module\_vpc) | terraform-aws-modules/vpc/aws | ~> 3.0 |

## Resources

Expand All @@ -58,7 +63,6 @@ Note that this example may create resources which cost money. Run `terraform des
| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| <a name="input_cluster_version"></a> [cluster\_version](#input\_cluster\_version) | EKS version | `string` | `"1.20"` | no |
| <a name="input_example_name"></a> [example\_name](#input\_example\_name) | Example name | `string` | `"complete"` | no |
| <a name="input_region"></a> [region](#input\_region) | AWS region where example will be created | `string` | `"eu-west-1"` | no |

## Outputs
Expand Down
59 changes: 0 additions & 59 deletions examples/complete/generic.tf

This file was deleted.

Loading

0 comments on commit 95b659e

Please sign in to comment.