Skip to content

Commit

Permalink
apps-devstg/us-east-2/k8s-eks-v1.17 folder renamed + sync changes wit…
Browse files Browse the repository at this point in the history
…h us-east-1 stack
  • Loading branch information
exequielrafaela committed Jun 30, 2022
1 parent 420a85f commit a5fe2e8
Show file tree
Hide file tree
Showing 81 changed files with 517 additions and 114 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
# Providers
#
provider "aws" {
region = var.region_secondary
profile = var.profile
shared_credentials_file = "~/.aws/${var.project}/config"
region = var.region
profile = var.profile
}

provider "kubernetes" {
Expand All @@ -17,15 +16,15 @@ provider "kubernetes" {
# Backend Config (partial)
#
terraform {
required_version = ">= 0.12.28"
required_version = "~> 1.1.3"

required_providers {
aws = "~> 3.28"
kubernetes = "~> 2.0.2"
aws = "~> 4.10"
kubernetes = "~> 2.10"
}

backend "s3" {
key = "apps-devstg/k8s-eks-dr/cluster/terraform.tfstate"
key = "apps-devstg/k8s-eks-v1.17-dr/cluster/terraform.tfstate"
}
}

Expand All @@ -47,7 +46,7 @@ data "terraform_remote_state" "eks-dr-vpc" {
region = var.region
profile = var.profile
bucket = var.bucket
key = "apps-devstg/k8s-eks-dr/network/terraform.tfstate"
key = "apps-devstg/k8s-eks-v1.17-dr/network/terraform.tfstate"
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module "eks" {
source = "github.com/binbashar/terraform-aws-eks.git?ref=v17.20.0"
source = "github.com/binbashar/terraform-aws-eks.git?ref=v17.24.0"

create_eks = true
cluster_name = data.terraform_remote_state.eks-dr-vpc.outputs.cluster_name
Expand Down Expand Up @@ -34,20 +34,28 @@ module "eks" {
#
node_groups_defaults = {
# Managed Nodes cannot specify custom AMIs, only use the ones allowed by EKS
ami_type = "AL2_x86_64"
disk_size = 50
instance_types = ["t2.medium"]
k8s_labels = local.tags
ami_type = "AL2_x86_64"
disk_size = 50
k8s_labels = local.tags
}

#
# List of Managed Node Groups
#
node_groups = {
main = {
on-demand = {
desired_capacity = 1
max_capacity = 1
min_capacity = 1
capacity_type = "ON_DEMAND"
instance_types = ["t2.medium", "t3.medium"]
}
spot = {
desired_capacity = 1
max_capacity = 3
min_capacity = 1
capacity_type = "SPOT"
instance_types = ["t2.medium", "t3.medium"]
}
}

Expand All @@ -73,9 +81,9 @@ module "eks" {
# Auth: aws-iam-authenticator
#
manage_aws_auth = var.manage_aws_auth
map_roles = var.map_roles
map_accounts = var.map_accounts
map_users = var.map_users
map_roles = local.map_roles
map_accounts = local.map_accounts
map_users = local.map_users

#
# Logging: which log types should be enabled and how long they should be kept for
Expand All @@ -93,7 +101,7 @@ module "eks" {
# Tags
#
tags = merge(local.tags,
map("k8s.io/cluster-autoscaler/enabled", "TRUE"),
map("k8s.io/cluster-autoscaler/${data.terraform_remote_state.eks-dr-vpc.outputs.cluster_name}", "owned")
{ "k8s.io/cluster-autoscaler/enabled" = "TRUE" },
{ "k8s.io/cluster-autoscaler/${data.terraform_remote_state.eks-dr-vpc.outputs.cluster_name}" = "owned" }
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,14 @@ locals {
groups = [
"system:masters"]
},
#
# Allow DevOps SSO role to become cluster admins
#
{
rolearn = "arn:aws:iam::${var.appsdevstg_account_id}:role/aws-reserved/sso.amazonaws.com/AWSReservedSSO_DevOps_5e0501636a32f9c4"
username = "DevOps"
groups = [
"system:masters"]
},
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,28 @@
# AWS Provider Settings #
#=============================#
provider "aws" {
region = var.region
profile = var.profile
shared_credentials_file = "~/.aws/${var.project}/config"
region = var.region
profile = var.profile
}

provider "aws" {
alias = "shared"
region = var.region
profile = "${var.project}-shared-devops"
shared_credentials_file = "~/.aws/${var.project}/config"
alias = "shared"
region = var.region
profile = "${var.project}-shared-devops"
}

#=============================#
# Backend Config (partial) #
#=============================#
terraform {
required_version = ">= 0.14.11"
required_version = ">= 1.1.3"

required_providers {
aws = "~> 3.27"
aws = "~> 4.10"
}

backend "s3" {
key = "apps-devstg/k8s-eks-dr/identities/terraform.tfstate"
key = "apps-devstg/k8s-eks-v1.17-dr/identities/terraform.tfstate"
}
}

Expand All @@ -39,7 +37,7 @@ data "terraform_remote_state" "apps-devstg-eks-dr-cluster" {
region = var.region
profile = var.profile
bucket = var.bucket
key = "${var.environment}/k8s-eks-dr/cluster/terraform.tfstate"
key = "${var.environment}/k8s-eks-v1.17-dr/cluster/terraform.tfstate"
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ EOF
}

#
# External DNS policy
# External DNS policy: aws.binbash.com.ar
#
resource "aws_iam_policy" "externaldns_aws_binbash_com_ar" {
provider = aws.shared
name = "${local.prefix}-externaldns-aws.binbash.com.ar"
description = "External DNS permissions on aws.binbash.com.ar"
description = "ExternalDNS permissions on aws.binbash.com.ar"
policy = <<EOF
{
"Version": "2012-10-17",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,6 @@ kubernetes_dashboard_hosts = "kubernetes-dashboard.us-east-2.devstg.aws.
# Demo Apps - ArgoCD
#------------------------------------------------------------------------------
enable_cicd = true
demoapps = {
emojivoto = false
gdm = false
sockshop = true
}

#------------------------------------------------------------------------------
# Backups
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
injector:
externalVaultAddr: ${vaultAddress}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ resource "helm_release" "argocd" {
namespace = kubernetes_namespace.argocd.id
repository = "https://argoproj.github.io/argo-helm"
chart = "argo-cd"
version = "2.17.4"
version = "4.5.7"
values = [file("chart-values/argo-cd.yaml")]
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
# Providers
#
provider "aws" {
region = var.region_secondary
profile = var.profile
shared_credentials_file = "~/.aws/${var.project}/config"
region = var.region
profile = var.profile
}

provider "kubernetes" {
Expand All @@ -25,16 +24,16 @@ provider "helm" {
# Backend Config (partial)
#
terraform {
required_version = ">= 0.13.6"
required_version = ">= 1.1.3"

required_providers {
aws = "~> 3.28"
helm = "~> 2.1.0"
kubernetes = "~> 2.0.2"
aws = "~> 4.10"
helm = "~> 2.5"
kubernetes = "~> 2.10"
}

backend "s3" {
key = "apps-devstg/k8s-eks-dr/k8s-resources/terraform.tfstate"
key = "apps-devstg/k8s-eks-v1.17-dr/k8s-resources/terraform.tfstate"
}
}

Expand Down Expand Up @@ -63,6 +62,6 @@ data "terraform_remote_state" "eks-cluster" {
region = var.region
profile = var.profile
bucket = var.bucket
key = "apps-devstg/k8s-eks-dr/cluster/terraform.tfstate"
key = "apps-devstg/k8s-eks-v1.17-dr/cluster/terraform.tfstate"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,5 @@ resource "helm_release" "emojivoto_imc_endpoint" {
}
)
]
depends_on = [helm_release.ingressmonitorcontroller, helm_release.emojivoto]
depends_on = [helm_release.ingressmonitorcontroller]
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ resource "helm_release" "externaldns_private" {
namespace = kubernetes_namespace.externaldns.id
repository = "https://charts.bitnami.com/bitnami"
chart = "external-dns"
version = "4.6.0"
version = "6.5.3"
values = [
templatefile("chart-values/externaldns-private.yaml", {
roleArn = "arn:aws:iam::${var.shared_account_id}:role/appsdevstg-dr-externaldns-private"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#=============================#
variable "enable_private_ingress" {
type = bool
default = false
default = true
}

variable "enable_public_ingress" {
Expand All @@ -13,7 +13,7 @@ variable "enable_public_ingress" {

variable "enable_private_dns_sync" {
type = bool
default = false
default = true
}

variable "enable_public_dns_sync" {
Expand All @@ -33,7 +33,7 @@ variable "enable_grafana_dependencies" {

variable "enable_certmanager" {
type = bool
default = false
default = true
}

variable "enable_vault" {
Expand All @@ -48,7 +48,7 @@ variable "enable_cicd" {

variable "enable_kubernetes_dashboard" {
type = bool
default = false
default = true
}

variable "enable_hpa_scaling" {
Expand Down Expand Up @@ -106,12 +106,6 @@ variable "enable_backups" {
default = false
}


variable "demoapps" {
type = any
default = {}
}

#==================================#
# Ingress Monitor Controller (IMC) #
#==================================#
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
demoapps = {
emojivoto = true
gdm = false
sockshop = false
}
Loading

0 comments on commit a5fe2e8

Please sign in to comment.