generated from aws-ia/terraform-repo-template
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor
patterns/multiple-app-teams
- Loading branch information
1 parent
861b955
commit c4d8f26
Showing
6 changed files
with
134 additions
and
113 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
################################################################################ | ||
# Supporting Resources | ||
################################################################################ | ||
# EKS Cluster | ||
################################################################################ | ||
|
||
module "eks" { | ||
source = "terraform-aws-modules/eks/aws" | ||
version = "~> 19.13" | ||
|
||
cluster_name = local.name | ||
cluster_version = "1.27" | ||
cluster_endpoint_public_access = true | ||
|
||
vpc_id = module.vpc.vpc_id | ||
subnet_ids = module.vpc.private_subnets | ||
|
||
eks_managed_node_groups = { | ||
initial = { | ||
instance_types = ["m5.large"] | ||
|
||
min_size = 1 | ||
max_size = 5 | ||
desired_size = 2 | ||
} | ||
} | ||
|
||
manage_aws_auth_configmap = true | ||
aws_auth_roles = flatten( | ||
[ | ||
[for team in module.application_teams : team.aws_auth_configmap_role], | ||
] | ||
) | ||
|
||
tags = local.tags | ||
} | ||
|
||
################################################################################ | ||
# VPC | ||
################################################################################ | ||
module "vpc" { | ||
source = "terraform-aws-modules/vpc/aws" | ||
version = "~> 5.0" | ||
|
||
name = local.name | ||
cidr = local.vpc_cidr | ||
|
||
azs = local.azs | ||
private_subnets = [for k, v in local.azs : cidrsubnet(local.vpc_cidr, 4, k)] | ||
public_subnets = [for k, v in local.azs : cidrsubnet(local.vpc_cidr, 8, k + 48)] | ||
|
||
enable_nat_gateway = true | ||
single_nat_gateway = true | ||
|
||
public_subnet_tags = { | ||
"kubernetes.io/role/elb" = 1 | ||
} | ||
|
||
private_subnet_tags = { | ||
"kubernetes.io/role/internal-elb" = 1 | ||
} | ||
|
||
tags = local.tags | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
################################################################################ | ||
# EKS Blueprints Teams Module - Multiple Application Teams | ||
################################################################################ | ||
|
||
module "application_teams" { | ||
source = "../.." | ||
|
||
for_each = { | ||
one = {} | ||
two = {} | ||
} | ||
name = "app-team-${each.key}" | ||
|
||
users = [data.aws_caller_identity.current.arn] | ||
cluster_arn = module.eks.cluster_arn | ||
oidc_provider_arn = module.eks.oidc_provider_arn | ||
|
||
namespaces = { | ||
"app-${each.key}" = { | ||
labels = { | ||
teamName = "${each.key}-team", | ||
projectName = "${each.key}-project", | ||
} | ||
|
||
resource_quota = { | ||
hard = { | ||
"requests.cpu" = "2000m", | ||
"requests.memory" = "4Gi", | ||
"limits.cpu" = "4000m", | ||
"limits.memory" = "16Gi", | ||
"pods" = "20", | ||
"secrets" = "20", | ||
"services" = "20" | ||
} | ||
} | ||
} | ||
} | ||
|
||
tags = local.tags | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters