Skip to content

Commit

Permalink
[examples/aws] update aws provider version && vpc module version
Browse files Browse the repository at this point in the history
  • Loading branch information
Z4ck404 committed Nov 30, 2023
1 parent 7d1fc45 commit 2d04cf0
Show file tree
Hide file tree
Showing 13 changed files with 109 additions and 67 deletions.
24 changes: 12 additions & 12 deletions examples/from-private-vpc/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -95,26 +95,26 @@ data "aws_eks_addon_version" "core-dns" {
}

resource "aws_eks_addon" "vpc-cni" {
cluster_name = data.aws_eks_cluster.this.id
addon_name = "vpc-cni"
addon_version = data.aws_eks_addon_version.vpc-cni.version
resolve_conflicts = "OVERWRITE"
cluster_name = data.aws_eks_cluster.this.id
addon_name = "vpc-cni"
addon_version = data.aws_eks_addon_version.vpc-cni.version
resolve_conflicts_on_update = "OVERWRITE"

service_account_role_arn = module.vpc_cni_ipv4_irsa_role.iam_role_arn
}

resource "aws_eks_addon" "core-dns" {
cluster_name = module.eks.cluster_id
addon_name = "coredns"
addon_version = data.aws_eks_addon_version.core-dns.version
resolve_conflicts = "OVERWRITE"
cluster_name = module.eks.cluster_id
addon_name = "coredns"
addon_version = data.aws_eks_addon_version.core-dns.version
resolve_conflicts_on_update = "OVERWRITE"
}

resource "aws_eks_addon" "kube-proxy" {
cluster_name = module.eks.cluster_id
addon_name = "kube-proxy"
addon_version = data.aws_eks_addon_version.kube-proxy.version
resolve_conflicts = "OVERWRITE"
cluster_name = module.eks.cluster_id
addon_name = "kube-proxy"
addon_version = data.aws_eks_addon_version.kube-proxy.version
resolve_conflicts_on_update = "OVERWRITE"
}

################################################################################
Expand Down
2 changes: 1 addition & 1 deletion examples/from-private-vpc/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ terraform {
}
aws = {
source = "hashicorp/aws"
version = "~> 3.75"
version = "~> 5.28"
}
}
}
2 changes: 1 addition & 1 deletion examples/from-private-vpc/vpc/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ locals {

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

create_vpc = true
name = var.vpc_name
Expand Down
2 changes: 1 addition & 1 deletion examples/from-scratch-eks-blueprint/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ provider "aws" {

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

create_vpc = true
name = var.vpc_name
Expand Down
50 changes: 32 additions & 18 deletions examples/from-scratch-with-eks-addon/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ locals {

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

create_vpc = true
name = var.vpc_name
Expand All @@ -30,7 +30,6 @@ module "vpc" {
single_nat_gateway = true
enable_dns_hostnames = true
enable_dns_support = true
enable_s3_endpoint = true

tags = {
"kubernetes.io/cluster/${var.cluster_name}" = "shared",
Expand All @@ -47,6 +46,21 @@ module "vpc" {
}
}

module "vpc_endpoints" {
source = "terraform-aws-modules/vpc/aws//modules/vpc-endpoints"
version = "~> 5.2.0"

vpc_id = module.vpc.vpc_id

endpoints = {
s3 = {
service = "s3"
service_type = "Gateway"
tags = { Name = "s3-vpc-endpoint" }
},
}
}

################################################################################
# Create EKS cluster
################################################################################
Expand Down Expand Up @@ -161,34 +175,34 @@ data "aws_eks_addon_version" "core-dns" {
}

resource "aws_eks_addon" "ebs_csi" {
cluster_name = data.aws_eks_cluster.this.id
addon_name = "aws-ebs-csi-driver"
addon_version = data.aws_eks_addon_version.ebs_csi.version
resolve_conflicts = "OVERWRITE"
cluster_name = module.eks.cluster_id
addon_name = "aws-ebs-csi-driver"
addon_version = data.aws_eks_addon_version.ebs_csi.version
resolve_conflicts_on_update = "OVERWRITE"

service_account_role_arn = module.ebs_csi_irsa_role.iam_role_arn
}
resource "aws_eks_addon" "vpc-cni" {
cluster_name = data.aws_eks_cluster.this.id
addon_name = "vpc-cni"
addon_version = data.aws_eks_addon_version.vpc-cni.version
resolve_conflicts = "OVERWRITE"
cluster_name = module.eks.cluster_id
addon_name = "vpc-cni"
addon_version = data.aws_eks_addon_version.vpc-cni.version
resolve_conflicts_on_update = "OVERWRITE"

service_account_role_arn = module.vpc_cni_ipv4_irsa_role.iam_role_arn
}

resource "aws_eks_addon" "core-dns" {
cluster_name = module.eks.cluster_id
addon_name = "coredns"
addon_version = data.aws_eks_addon_version.core-dns.version
resolve_conflicts = "OVERWRITE"
cluster_name = module.eks.cluster_id
addon_name = "coredns"
addon_version = data.aws_eks_addon_version.core-dns.version
resolve_conflicts_on_update = "OVERWRITE"
}

resource "aws_eks_addon" "kube-proxy" {
cluster_name = module.eks.cluster_id
addon_name = "kube-proxy"
addon_version = data.aws_eks_addon_version.kube-proxy.version
resolve_conflicts = "OVERWRITE"
cluster_name = module.eks.cluster_id
addon_name = "kube-proxy"
addon_version = data.aws_eks_addon_version.kube-proxy.version
resolve_conflicts_on_update = "OVERWRITE"
}

################################################################################
Expand Down
2 changes: 1 addition & 1 deletion examples/from-scratch-with-eks-addon/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ terraform {
}
aws = {
source = "hashicorp/aws"
version = "~> 3.75"
version = "~> 5.28"
}
}
}
42 changes: 28 additions & 14 deletions examples/from-scratch-with-private-link/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ locals {

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

create_vpc = true
name = var.vpc_name
Expand All @@ -30,7 +30,6 @@ module "vpc" {
single_nat_gateway = true
enable_dns_hostnames = true
enable_dns_support = true
enable_s3_endpoint = true

tags = {
"kubernetes.io/cluster/${var.cluster_name}" = "shared",
Expand All @@ -47,6 +46,21 @@ module "vpc" {
}
}

module "vpc_endpoints" {
source = "terraform-aws-modules/vpc/aws//modules/vpc-endpoints"
version = "~> 5.2.0"

vpc_id = module.vpc.vpc_id

endpoints = {
s3 = {
service = "s3"
service_type = "Gateway"
tags = { Name = "s3-vpc-endpoint" }
},
}
}

################################################################################
# Create the privatelink resources (NLB, TargetGroup)
################################################################################
Expand Down Expand Up @@ -232,26 +246,26 @@ data "aws_eks_addon_version" "core-dns" {
}

resource "aws_eks_addon" "vpc-cni" {
cluster_name = data.aws_eks_cluster.this.id
addon_name = "vpc-cni"
addon_version = data.aws_eks_addon_version.vpc-cni.version
resolve_conflicts = "OVERWRITE"
cluster_name = module.eks.cluster_id
addon_name = "vpc-cni"
addon_version = data.aws_eks_addon_version.vpc-cni.version
resolve_conflicts_on_update_on_update = "OVERWRITE"

service_account_role_arn = module.vpc_cni_ipv4_irsa_role.iam_role_arn
}

resource "aws_eks_addon" "core-dns" {
cluster_name = module.eks.cluster_id
addon_name = "coredns"
addon_version = data.aws_eks_addon_version.core-dns.version
resolve_conflicts = "OVERWRITE"
cluster_name = module.eks.cluster_id
addon_name = "coredns"
addon_version = data.aws_eks_addon_version.core-dns.version
resolve_conflicts_on_update_on_update = "OVERWRITE"
}

resource "aws_eks_addon" "kube-proxy" {
cluster_name = module.eks.cluster_id
addon_name = "kube-proxy"
addon_version = data.aws_eks_addon_version.kube-proxy.version
resolve_conflicts = "OVERWRITE"
cluster_name = module.eks.cluster_id
addon_name = "kube-proxy"
addon_version = data.aws_eks_addon_version.kube-proxy.version
resolve_conflicts_on_update_on_update = "OVERWRITE"
}

################################################################################
Expand Down
2 changes: 1 addition & 1 deletion examples/from-scratch-with-private-link/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ terraform {
}
aws = {
source = "hashicorp/aws"
version = "~> 3.75"
version = "~> 5.28"
}
}
}
42 changes: 28 additions & 14 deletions examples/from-scratch/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ locals {

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

create_vpc = true
name = var.vpc_name
Expand All @@ -30,7 +30,6 @@ module "vpc" {
single_nat_gateway = true
enable_dns_hostnames = true
enable_dns_support = true
enable_s3_endpoint = true

tags = {
"kubernetes.io/cluster/${var.cluster_name}" = "shared",
Expand All @@ -47,6 +46,21 @@ module "vpc" {
}
}

module "vpc_endpoints" {
source = "terraform-aws-modules/vpc/aws//modules/vpc-endpoints"
version = "~> 5.2.0"

vpc_id = module.vpc.vpc_id

endpoints = {
s3 = {
service = "s3"
service_type = "Gateway"
tags = { Name = "s3-vpc-endpoint" }
},
}
}

################################################################################
# Create EKS cluster
################################################################################
Expand Down Expand Up @@ -233,26 +247,26 @@ data "aws_eks_addon_version" "core-dns" {
}

resource "aws_eks_addon" "vpc-cni" {
cluster_name = data.aws_eks_cluster.this.id
addon_name = "vpc-cni"
addon_version = data.aws_eks_addon_version.vpc-cni.version
resolve_conflicts = "OVERWRITE"
cluster_name = module.eks.cluster_id
addon_name = "vpc-cni"
addon_version = data.aws_eks_addon_version.vpc-cni.version
resolve_conflicts_on_update = "OVERWRITE"

service_account_role_arn = module.vpc_cni_ipv4_irsa_role.iam_role_arn
}

resource "aws_eks_addon" "core-dns" {
cluster_name = module.eks.cluster_id
addon_name = "coredns"
addon_version = data.aws_eks_addon_version.core-dns.version
resolve_conflicts = "OVERWRITE"
cluster_name = module.eks.cluster_id
addon_name = "coredns"
addon_version = data.aws_eks_addon_version.core-dns.version
resolve_conflicts_on_update = "OVERWRITE"
}

resource "aws_eks_addon" "kube-proxy" {
cluster_name = module.eks.cluster_id
addon_name = "kube-proxy"
addon_version = data.aws_eks_addon_version.kube-proxy.version
resolve_conflicts = "OVERWRITE"
cluster_name = module.eks.cluster_id
addon_name = "kube-proxy"
addon_version = data.aws_eks_addon_version.kube-proxy.version
resolve_conflicts_on_update = "OVERWRITE"
}

################################################################################
Expand Down
2 changes: 1 addition & 1 deletion examples/from-scratch/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ terraform {
}
aws = {
source = "hashicorp/aws"
version = "~> 3.75"
version = "~> 5.28"
}
}
}
2 changes: 1 addition & 1 deletion examples/import-eks-cluster/eks-cluster/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ locals {

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

create_vpc = true
name = var.vpc_name
Expand Down
2 changes: 1 addition & 1 deletion examples/import-eks-cluster/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ terraform {
}
aws = {
source = "hashicorp/aws"
version = "~> 3.75"
version = "~> 5.28"
}
}
}
2 changes: 1 addition & 1 deletion examples/import-ocean-cluster/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ terraform {
}
aws = {
source = "hashicorp/aws"
version = "~> 3.75"
version = "~> 5.28"
}
}
}

0 comments on commit 2d04cf0

Please sign in to comment.