Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version upgrades: Terraform -> v1.0.0, AWS TF Provider -> v3.37.0, AWS TF EKS module -> v15.2.0 #5

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,17 @@ all-test: clean tf-plan-eks

.PHONY: clean
clean:
rm -rf .terraform
rm -rf source/.terraform

.PHONY: tf-plan-eks
tf-plan-eks:
export AWS_REGION=${region} && terraform init -backend-config ./live/${env}/${region}/${account}/${subenv}/backend.conf -reconfigure source && terraform validate && terraform plan -var-file ./live/${env}/${region}/${account}/${subenv}/base.tfvars source
export AWS_REGION=${region} && cd source && terraform init -backend-config ../live/${env}/${region}/${account}/${subenv}/backend.conf -reconfigure && terraform validate && terraform plan -var-file ../live/${env}/${region}/${account}/${subenv}/base.tfvars

.PHONY: tf-apply-eks
tf-apply-eks:
export AWS_REGION=${region} && terraform init -backend-config ./live/${env}/${region}/${account}/${subenv}/backend.conf -reconfigure source && terraform validate && terraform apply -var-file ./live/${env}/${region}/${account}/${subenv}/base.tfvars -auto-approve source
export AWS_REGION=${region} && cd source && terraform init -backend-config ../live/${env}/${region}/${account}/${subenv}/backend.conf -reconfigure && terraform validate && terraform apply -var-file ../live/${env}/${region}/${account}/${subenv}/base.tfvars -auto-approve

.PHONY: tf-destroy-eks
tf-destroy-eks:
export AWS_REGION=${region} && terraform init -backend-config ./live/${env}/${region}/${account}/${subenv}/backend.conf -reconfigure source && terraform validate && terraform destroy -var-file ./live/${env}/${region}/${account}/${subenv}/base.tfvars -auto-approve source
export AWS_REGION=${region} && cd source && terraform init -backend-config ../live/${env}/${region}/${account}/${subenv}/backend.conf -reconfigure && terraform validate && terraform destroy -var-file ../live/${env}/${region}/${account}/${subenv}/base.tfvars -auto-approve

12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,9 @@ Ensure that you have installed the following tools in your Mac or Windows Laptop

1. [aws cli](https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2.html)
2. [aws-iam-authenticator](https://docs.aws.amazon.com/eks/latest/userguide/install-aws-iam-authenticator.html)
3. [kubectl](https://Kubernetes.io/docs/tasks/tools/)
4. wget
3. [terraform](https://learn.hashicorp.com/tutorials/terraform/install-cli)
4. [kubectl](https://kubernetes.io/docs/tasks/tools/)
5. wget

## Deployment Steps
The following steps walks you through the deployment of example [DEV cluster](live/preprod/eu-west-1/application/dev/base.tfvars) configuration. This config deploys a private EKS cluster with public and private subnets.
Expand All @@ -135,6 +136,7 @@ It also deploys few kubernetes apps i.e., LB Ingress Controller, Metrics Server,
#### Step1: Clone the repo using the command below

$ git clone https://github.com/aws-samples/aws-eks-accelerator-for-terraform.git
$ cd aws-eks-accelerator-for-terraform/source

#### Step2: Update base.tfvars file

Expand Down Expand Up @@ -162,17 +164,17 @@ This role will become the Kubernetes Admin by default.
#### Step5: Run Terraform init
to initialize a working directory with configuration files

$ terraform init -backend-config ./live/preprod/eu-west-1/application/dev/backend.conf source
$ terraform init -backend-config ../live/preprod/eu-west-1/application/dev/backend.conf

#### Step6: Run Terraform plan
to verify the resources created by this execution

$ terraform plan -var-file ./live/preprod/eu-west-1/application/dev/base.tfvars source
$ terraform plan -var-file ../live/preprod/eu-west-1/application/dev/base.tfvars

#### Step7: Finally, Terraform apply
to create resources

$ terraform apply -var-file ./live/preprod/eu-west-1/application/dev/base.tfvars source
$ terraform apply -var-file ../live/preprod/eu-west-1/application/dev/base.tfvars

**Alternatively you can use Makefile to deploy by skipping Step5, Step6 and Step7**

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ tenant = "aws001" # AWS account name or unique id for tenant
environment = "preprod" # Environment area eg., preprod or prod
zone = "dev" # Environment with in one sub_tenant or business unit
region = "eu-west-1" # EKS Cluster region
terraform_version = "Terraform v0.14.9"
terraform_version = "Terraform v1.0.0"
#---------------------------------------------------------#
# VPC and PRIVATE SUBNET DETAILS for EKS Cluster
#---------------------------------------------------------#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ org = "aws" # Organization Name. Used to tag resources
tenant = "aws001" # AWS account name or unique id for tenant
environment = "preprod" # Environment area eg., preprod or prod
zone = "dev" # Environment with in one sub_tenant or business unit
terraform_version = "Terraform v0.14.9"
terraform_version = "Terraform v1.0.0"
#---------------------------------------------------------#
# VPC and PRIVATE SUBNET DETAILS for EKS Cluster
#---------------------------------------------------------#
Expand Down
2 changes: 1 addition & 1 deletion examples/eks-with-lb-ingress/eks-with-lb-ingress.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ org = "aws" # Organization Name. Used to tag resources
tenant = "aws001" # AWS account name or unique id for tenant
environment = "preprod" # Environment area eg., preprod or prod
zone = "dev" # Environment with in one sub_tenant or business unit
terraform_version = "Terraform v0.14.9"
terraform_version = "Terraform v1.0.0"
#---------------------------------------------------------#
# VPC and PRIVATE SUBNET DETAILS for EKS Cluster
#---------------------------------------------------------#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ org = "aws" # Organization Name. Used to tag resources
tenant = "aws001" # AWS account name or unique id for tenant
environment = "preprod" # Environment area eg., preprod or prod
zone = "dev" # Environment with in one sub_tenant or business unit
terraform_version = "Terraform v0.14.9"
terraform_version = "Terraform v1.0.0"
#---------------------------------------------------------#
# VPC and PRIVATE SUBNET DETAILS for EKS Cluster
#---------------------------------------------------------#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ org = "aws" # Organization Name. Used to tag resources
tenant = "aws001" # AWS account name or unique id for tenant
environment = "preprod" # Environment area eg., preprod or prod
zone = "dev" # Environment with in one sub_tenant or business unit
terraform_version = "Terraform v0.14.9"
terraform_version = "Terraform v1.0.0"
#---------------------------------------------------------#
# VPC and PRIVATE SUBNET DETAILS for EKS Cluster
#---------------------------------------------------------#
Expand Down
2 changes: 1 addition & 1 deletion live/preprod/eu-west-1/application/dev/base.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ org = "aws" # Organization Name. Used to tag resources
tenant = "aws001" # AWS account name or unique id for tenant
environment = "preprod" # Environment area eg., preprod or prod
zone = "dev" # Environment with in one sub_tenant or business unit
terraform_version = "Terraform v0.14.9"
terraform_version = "Terraform v1.0.0"
#---------------------------------------------------------#
# VPC and PRIVATE SUBNET DETAILS for EKS Cluster
#---------------------------------------------------------#
Expand Down
2 changes: 1 addition & 1 deletion modules/launch-templates/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ resource "aws_launch_template" "default" {

tag_specifications {
resource_type = "instance"
tags = merge(var.tags, map("Name", "${var.cluster_name}-${var.node_group_name}"))
tags = merge(var.tags, tomap({"Name" = "${var.cluster_name}-${var.node_group_name}"}))
}

network_interfaces {
Expand Down
20 changes: 10 additions & 10 deletions source/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.12 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | 3.34.0 |
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | 3.37.0 |
| <a name="requirement_helm"></a> [helm](#requirement\_helm) | 2.0.3 |
| <a name="requirement_kubernetes"></a> [kubernetes](#requirement\_kubernetes) | 2.0.3 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | 3.34.0 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | 3.37.0 |

## Modules

| Name | Source | Version |
|------|--------|---------|
| <a name="module_eks"></a> [eks](#module\_eks) | terraform-aws-modules/eks/aws | 14.0.0 |
| <a name="module_eks"></a> [eks](#module\_eks) | terraform-aws-modules/eks/aws | 15.2.0 |
| <a name="module_eks-label"></a> [eks-label](#module\_eks-label) | ../modules/aws-resource-label | |
| <a name="module_helm"></a> [helm](#module\_helm) | ../helm | |
| <a name="module_iam"></a> [iam](#module\_iam) | ../modules/iam | |
Expand All @@ -32,12 +32,12 @@

| Name | Type |
|------|------|
| [aws_availability_zones.available](https://registry.terraform.io/providers/hashicorp/aws/3.34.0/docs/data-sources/availability_zones) | data source |
| [aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/3.34.0/docs/data-sources/caller_identity) | data source |
| [aws_eks_cluster.cluster](https://registry.terraform.io/providers/hashicorp/aws/3.34.0/docs/data-sources/eks_cluster) | data source |
| [aws_eks_cluster_auth.cluster](https://registry.terraform.io/providers/hashicorp/aws/3.34.0/docs/data-sources/eks_cluster_auth) | data source |
| [aws_region.current](https://registry.terraform.io/providers/hashicorp/aws/3.34.0/docs/data-sources/region) | data source |
| [aws_security_group.default](https://registry.terraform.io/providers/hashicorp/aws/3.34.0/docs/data-sources/security_group) | data source |
| [aws_availability_zones.available](https://registry.terraform.io/providers/hashicorp/aws/3.37.0/docs/data-sources/availability_zones) | data source |
| [aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/3.37.0/docs/data-sources/caller_identity) | data source |
| [aws_eks_cluster.cluster](https://registry.terraform.io/providers/hashicorp/aws/3.37.0/docs/data-sources/eks_cluster) | data source |
| [aws_eks_cluster_auth.cluster](https://registry.terraform.io/providers/hashicorp/aws/3.37.0/docs/data-sources/eks_cluster_auth) | data source |
| [aws_region.current](https://registry.terraform.io/providers/hashicorp/aws/3.37.0/docs/data-sources/region) | data source |
| [aws_security_group.default](https://registry.terraform.io/providers/hashicorp/aws/3.37.0/docs/data-sources/security_group) | data source |

## Inputs

Expand Down
8 changes: 4 additions & 4 deletions source/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
locals {
tags = merge(map("kubernetes.io/cluster/${module.eks-label.id}", "shared"), map("created-by", var.terraform_version))
private_subnet_tags = merge(map("kubernetes.io/cluster/${module.eks-label.id}", "shared"), map("kubernetes.io/role/internal-elb", "1"), map("created-by", var.terraform_version))
public_subnet_tags = merge(map("kubernetes.io/cluster/${module.eks-label.id}", "shared"), map("kubernetes.io/role/elb", "1"), map("created-by", var.terraform_version))
tags = merge(tomap({"kubernetes.io/cluster/${module.eks-label.id}" = "shared"}), tomap({"created-by" = var.terraform_version}))
private_subnet_tags = merge(tomap({"kubernetes.io/cluster/${module.eks-label.id}" = "shared"}), tomap({"kubernetes.io/role/internal-elb" = "1"}), tomap({"created-by" = var.terraform_version}))
public_subnet_tags = merge(tomap({"kubernetes.io/cluster/${module.eks-label.id}" = "shared"}), tomap({"kubernetes.io/role/elb" = "1"}), tomap({"created-by" = var.terraform_version}))
}

locals {
Expand Down Expand Up @@ -173,7 +173,7 @@ module "rbac" {
# ---------------------------------------------------------------------------------------------------------------------
module "eks" {
source = "terraform-aws-modules/eks/aws"
version = "14.0.0"
version = "15.2.0"
vpc_id = var.create_vpc == false ? var.vpc_id : module.vpc.vpc_id
cluster_name = module.eks-label.id
cluster_version = var.kubernetes_version
Expand Down
2 changes: 1 addition & 1 deletion source/providers.tf
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "3.34.0"
version = "3.37.0"
}
kubernetes = {
source = "hashicorp/kubernetes"
Expand Down
2 changes: 1 addition & 1 deletion source/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@
*/

terraform {
required_version = ">= 0.13"
required_version = ">= 1.0.0"
}