Skip to content

Commit

Permalink
using s3 provider and team creation
Browse files Browse the repository at this point in the history
Signed-off-by: Luiz Oliveira <ziuloliveira@gmail.com>
  • Loading branch information
Ziul committed Sep 28, 2023
1 parent c316092 commit 57d46ac
Show file tree
Hide file tree
Showing 6 changed files with 196 additions and 6 deletions.
142 changes: 142 additions & 0 deletions deploy/kubernetes/terraform/.terraform.lock.hcl

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

25 changes: 25 additions & 0 deletions deploy/kubernetes/terraform/addons.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ data "aws_acm_certificate" "kubeshark_crt" {
most_recent = true
}

data "aws_caller_identity" "current" {}

module "eks_blueprints_addons" {
source = "aws-ia/eks-blueprints-addons/aws"
version = "~> 1.0" #ensure to update this to the latest/desired version
Expand Down Expand Up @@ -47,11 +49,34 @@ module "eks_blueprints_addons" {
]
}

aws_cloudwatch_metrics = {
max_history = 1
}

tags = {
Environment = "dev"
}
}

module "admin_team" {
source = "aws-ia/eks-blueprints-teams/aws"

name = "admin-team"

# Enables elevated, admin privileges for this team
enable_admin = true
users = [
# "arn:aws:iam::${data.aws_caller_identity.current.account_id}:role/${var.role_name}",
"arn:aws:iam::${data.aws_caller_identity.current.account_id}:user/alongir",
"arn:aws:iam::${data.aws_caller_identity.current.account_id}:user/Mert",
]
cluster_arn = module.eks.cluster_arn

tags = {
team = "admin"
}
}

resource "helm_release" "kubeshark" {
name = "kubeshark"
repository = "https://helm.kubeshark.co"
Expand Down
7 changes: 7 additions & 0 deletions deploy/kubernetes/terraform/eks.tf
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ module "eks" {
}
}

cloudwatch_log_group_retention_in_days = 1

eks_managed_node_groups = {
managed = {
iam_role_name = "${local.name}-managed" # Backwards compat
Expand Down Expand Up @@ -91,6 +93,11 @@ module "eks" {
}
}

manage_aws_auth_configmap = true
aws_auth_roles = flatten([
module.admin_team.aws_auth_configmap_role,
])

tags = local.tags
}

Expand Down
13 changes: 9 additions & 4 deletions deploy/kubernetes/terraform/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@ output "region" {
value = var.region
}

# output "configure_kubectl" {
# description = "Configure kubectl: make sure you're logged in with the correct AWS profile and run the following command to update your kubeconfig"
# value = module.eks_blueprints.configure_kubectl
# }
output "cluster_name" {
description = "Cluster name"
value = local.name
}

output "configure_kubectl" {
description = "Configure kubectl: make sure you're logged in with the correct AWS profile and run the following command to update your kubeconfig"
value = "aws eks update-kubeconfig --name ${local.name} --kubeconfig <config_file>"
}
5 changes: 5 additions & 0 deletions deploy/kubernetes/terraform/provider.tf
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ terraform {
# backend "local" {
# path = "relative/path/to/terraform.tfstate"
# }
backend "s3" {
bucket = "dko-6"
key = "eks-demo"
region = "us-east-1"
}

required_version = "~> 1.3"
}
10 changes: 8 additions & 2 deletions deploy/kubernetes/terraform/variables.tf
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
variable "env_name" {
default = "development"
default = "dko-6"
}

variable "region" {
description = "AWS region"
type = string
default = "us-east-2"
default = "us-east-1"
}

variable "enable_kubeshark" {
Expand Down Expand Up @@ -38,3 +38,9 @@ variable "enable_ingress_nginx" {
default = false
}

variable "role_name" {
description = "Default role name"
type = string
default = "AWSReservedSSO_AdministratorAccess_4ad944a45478ee7e"
}

0 comments on commit 57d46ac

Please sign in to comment.