Skip to content

Commit 6c26f9f

Browse files
committed
Merge branch 'vnext'
2 parents 257b30a + 0143fc0 commit 6c26f9f

File tree

10 files changed

+85
-17
lines changed

10 files changed

+85
-17
lines changed

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,10 @@ The `terraform-docs` utility is used to generate this README. Follow the below s
7777
| <a name="input_ebs_csi_kms_cmk_ids"></a> [ebs\_csi\_kms\_cmk\_ids](#input\_ebs\_csi\_kms\_cmk\_ids) | List of KMS CMKs to allow EBS CSI to manage encrypted volumes. This is required if EBS encryption is set at the account level with a default KMS CMK. | `list(string)` | `[]` | no |
7878
| <a name="input_eks_aws_auth_roles"></a> [eks\_aws\_auth\_roles](#input\_eks\_aws\_auth\_roles) | List of IAM Role maps to add to the aws-auth configmap. This is required if you use a different IAM Role for Terraform Plan actions. | <pre>list(object({<br> rolearn = string<br> username = string<br> groups = list(string)<br> }))</pre> | `[]` | no |
7979
| <a name="input_eks_ng_capacity_type"></a> [eks\_ng\_capacity\_type](#input\_eks\_ng\_capacity\_type) | The capacity type to use for the EKS managed node group. | `string` | `"ON_DEMAND"` | no |
80-
| <a name="input_eks_ng_desired_size"></a> [eks\_ng\_desired\_size](#input\_eks\_ng\_desired\_size) | The desired size to use for the EKS managed node group. | `number` | `2` | no |
80+
| <a name="input_eks_ng_desired_size"></a> [eks\_ng\_desired\_size](#input\_eks\_ng\_desired\_size) | The desired size to use for the EKS managed node group. | `number` | `1` | no |
8181
| <a name="input_eks_ng_instance_types"></a> [eks\_ng\_instance\_types](#input\_eks\_ng\_instance\_types) | The instance types to use for the EKS managed node group. | `list(string)` | <pre>[<br> "t3.xlarge"<br>]</pre> | no |
82-
| <a name="input_eks_ng_minimum_size"></a> [eks\_ng\_minimum\_size](#input\_eks\_ng\_minimum\_size) | The minimum size to use for the EKS managed node group. | `number` | `2` | no |
82+
| <a name="input_eks_ng_maximum_size"></a> [eks\_ng\_maximum\_size](#input\_eks\_ng\_maximum\_size) | The maximum size to use for the EKS managed node group. | `number` | `10` | no |
83+
| <a name="input_eks_ng_minimum_size"></a> [eks\_ng\_minimum\_size](#input\_eks\_ng\_minimum\_size) | The minimum size to use for the EKS managed node group. | `number` | `1` | no |
8384
| <a name="input_enable_k8s_resources"></a> [enable\_k8s\_resources](#input\_enable\_k8s\_resources) | Whether to enable the creation of Kubernetes resources for Wayfinder (helm and kubectl manifest deployments). | `bool` | `true` | no |
8485
| <a name="input_enable_wf_cloudaccess"></a> [enable\_wf\_cloudaccess](#input\_enable\_wf\_cloudaccess) | Whether to configure CloudIdentity resource in Wayfinder for the configured AWS IRSA identity once installed (requires enable\_k8s\_resources) | `bool` | `true` | no |
8586
| <a name="input_enable_wf_costestimates"></a> [enable\_wf\_costestimates](#input\_enable\_wf\_costestimates) | Whether to configure admin CloudAccessConfig for cost estimates in the account Wayfinder is installed in once installed (requires enable\_k8s\_resources and enable\_wf\_cloudaccess) | `bool` | `true` | no |
@@ -88,7 +89,7 @@ The `terraform-docs` utility is used to generate this README. Follow the below s
8889
| <a name="input_kms_key_administrators"></a> [kms\_key\_administrators](#input\_kms\_key\_administrators) | A list of IAM ARNs for EKS key administrators. If no value is provided, the current caller identity is used to ensure at least one key admin is available. | `list(string)` | `[]` | no |
8990
| <a name="input_kube_proxy_addon_version"></a> [kube\_proxy\_addon\_version](#input\_kube\_proxy\_addon\_version) | Kube Proxy Addon version to use. | `string` | `"v1.27.8-eksbuild.4"` | no |
9091
| <a name="input_node_security_group_additional_rules"></a> [node\_security\_group\_additional\_rules](#input\_node\_security\_group\_additional\_rules) | List of additional security group rules to add to the node security group created. Set `source_cluster_security_group = true` inside rules to set the `cluster_security_group` as source. | `any` | `{}` | no |
91-
| <a name="input_subnet_ids"></a> [subnet\_ids](#input\_subnet\_ids) | A list of private Subnet IDs to launch the Wayfinder EKS Nodes onto. | `list(string)` | n/a | yes |
92+
| <a name="input_subnet_ids_by_az"></a> [subnet\_ids\_by\_az](#input\_subnet\_ids\_by\_az) | A map of subnet IDs by availability zone. | `map(list(string))` | `{}` | no |
9293
| <a name="input_tags"></a> [tags](#input\_tags) | A map of tags to add to all resources created. | `map(string)` | `{}` | no |
9394
| <a name="input_vpc_id"></a> [vpc\_id](#input\_vpc\_id) | The VPC ID for the Wayfinder EKS Cluster to be built within. | `string` | n/a | yes |
9495
| <a name="input_wayfinder_domain_name_api"></a> [wayfinder\_domain\_name\_api](#input\_wayfinder\_domain\_name\_api) | The domain name to use for the Wayfinder API (e.g. api.wayfinder.example.com). | `string` | n/a | yes |

eks.tf

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ module "eks" {
1111
cluster_endpoint_public_access = !var.disable_internet_access
1212
cluster_endpoint_public_access_cidrs = var.cluster_endpoint_public_access_cidrs
1313
kms_key_administrators = var.kms_key_administrators
14-
subnet_ids = var.subnet_ids
14+
subnet_ids = distinct(flatten(values(var.subnet_ids_by_az)))
1515
vpc_id = var.vpc_id
1616

1717
cluster_addons = {
@@ -57,12 +57,15 @@ module "eks" {
5757
}
5858

5959
eks_managed_node_groups = {
60-
compute = {
61-
capacity_type = var.eks_ng_capacity_type
62-
instance_types = var.eks_ng_instance_types
63-
desired_size = var.eks_ng_desired_size
64-
max_size = 10
65-
min_size = var.eks_ng_minimum_size
60+
for az, subnet_ids in var.subnet_ids_by_az : az => {
61+
name = "compute-${az}"
62+
capacity_type = var.eks_ng_capacity_type
63+
desired_size = var.eks_ng_desired_size
64+
instance_types = var.eks_ng_instance_types
65+
launch_template_name = "compute-${az}"
66+
max_size = var.eks_ng_maximum_size
67+
min_size = var.eks_ng_minimum_size
68+
subnet_ids = subnet_ids
6669
}
6770
}
6871

examples/complete/data.tf

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,26 @@ data "aws_secretsmanager_secret" "wayfinder" {
1111
data "aws_secretsmanager_secret_version" "wayfinder" {
1212
secret_id = data.aws_secretsmanager_secret.wayfinder.id
1313
}
14+
15+
data "aws_subnets" "private_subnets_by_az" {
16+
for_each = toset(var.availability_zones)
17+
filter {
18+
name = "vpc-id"
19+
values = [module.vpc.vpc_id]
20+
}
21+
filter {
22+
name = "availability-zone"
23+
values = [each.key]
24+
}
25+
tags = {
26+
Tier = "Private"
27+
}
28+
29+
depends_on = [module.vpc]
30+
}
31+
32+
locals {
33+
private_subnets_by_az = {
34+
for az, subnet in data.aws_subnets.private_subnets_by_az : az => subnet.ids
35+
}
36+
}

examples/complete/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ module "wayfinder" {
88
dns_zone_arn = data.aws_route53_zone.selected.arn
99
environment = var.environment
1010
kms_key_administrators = ["arn:aws:iam::${data.aws_caller_identity.current.account_id}:root"]
11-
subnet_ids = module.vpc.private_subnets
11+
subnet_ids_by_az = local.private_subnets_by_az
1212
tags = var.tags
1313
vpc_id = module.vpc.vpc_id
1414
wayfinder_domain_name_api = "api.${var.dns_zone_name}"

examples/complete/vpc.tf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,11 @@ module "vpc" {
1717

1818
public_subnet_tags = merge({
1919
"kubernetes.io/role/elb" = 1
20+
Tier = "Public"
2021
}, var.tags)
2122

2223
private_subnet_tags = merge({
2324
"kubernetes.io/role/internal-elb" = 1
25+
Tier = "Private"
2426
}, var.tags)
2527
}

examples/quickstart/data.tf

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,26 @@ data "aws_caller_identity" "current" {}
33
data "aws_route53_zone" "selected" {
44
name = var.dns_zone_name
55
}
6+
7+
data "aws_subnets" "private_subnets_by_az" {
8+
for_each = toset(var.availability_zones)
9+
filter {
10+
name = "vpc-id"
11+
values = [module.vpc.vpc_id]
12+
}
13+
filter {
14+
name = "availability-zone"
15+
values = [each.key]
16+
}
17+
tags = {
18+
Tier = "Private"
19+
}
20+
21+
depends_on = [module.vpc]
22+
}
23+
24+
locals {
25+
private_subnets_by_az = {
26+
for az, subnet in data.aws_subnets.private_subnets_by_az : az => subnet.ids
27+
}
28+
}

examples/quickstart/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ module "wayfinder" {
77
dns_zone_arn = data.aws_route53_zone.selected.arn
88
environment = var.environment
99
kms_key_administrators = ["arn:aws:iam::${data.aws_caller_identity.current.account_id}:root"]
10-
subnet_ids = module.vpc.private_subnets
10+
subnet_ids_by_az = local.private_subnets_by_az
1111
tags = var.tags
1212
vpc_id = module.vpc.vpc_id
1313
wayfinder_domain_name_api = "api.${var.dns_zone_name}"

examples/quickstart/vpc.tf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,11 @@ module "vpc" {
1717

1818
public_subnet_tags = merge({
1919
"kubernetes.io/role/elb" = 1
20+
Tier = "Public"
2021
}, var.tags)
2122

2223
private_subnet_tags = merge({
2324
"kubernetes.io/role/internal-elb" = 1
25+
Tier = "Private"
2426
}, var.tags)
2527
}

modules/cloudaccess/wf_dns_zone_manager_policy.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,13 @@
4141
],
4242
"Effect": "Allow",
4343
"Resource": "*"
44+
},
45+
{
46+
"Action": [
47+
"ec2:DescribeVpcs"
48+
],
49+
"Effect": "Allow",
50+
"Resource": "*"
4451
}
4552
]
4653
}

variables.tf

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ variable "eks_ng_capacity_type" {
6969
variable "eks_ng_desired_size" {
7070
description = "The desired size to use for the EKS managed node group."
7171
type = number
72-
default = 2
72+
default = 1
7373
}
7474

7575
variable "eks_ng_instance_types" {
@@ -78,10 +78,16 @@ variable "eks_ng_instance_types" {
7878
default = ["t3.xlarge"]
7979
}
8080

81+
variable "eks_ng_maximum_size" {
82+
description = "The maximum size to use for the EKS managed node group."
83+
type = number
84+
default = 10
85+
}
86+
8187
variable "eks_ng_minimum_size" {
8288
description = "The minimum size to use for the EKS managed node group."
8389
type = number
84-
default = 2
90+
default = 1
8591
}
8692

8793
variable "enable_k8s_resources" {
@@ -126,9 +132,10 @@ variable "node_security_group_additional_rules" {
126132
default = {}
127133
}
128134

129-
variable "subnet_ids" {
130-
description = "A list of private Subnet IDs to launch the Wayfinder EKS Nodes onto."
131-
type = list(string)
135+
variable "subnet_ids_by_az" {
136+
description = "A map of subnet IDs by availability zone."
137+
type = map(list(string))
138+
default = {}
132139
}
133140

134141
variable "tags" {

0 commit comments

Comments
 (0)