Skip to content

Commit 7c8b82e

Browse files
authored
feat(eks-examples): update eks module in EKS access entries module (#574)
1 parent 571544a commit 7c8b82e

File tree

5 files changed

+41
-28
lines changed

5 files changed

+41
-28
lines changed

.github/workflows/examples.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
terraform_validation:
99
strategy:
1010
matrix:
11-
version: [1.3, 1.4, latest]
11+
version: ["1.10", latest]
1212
runs-on: ubuntu-latest
1313

1414
steps:
Lines changed: 32 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,21 @@
11
# 2. Create EKS cluster.
22
module "eks" {
33
source = "terraform-aws-modules/eks/aws"
4-
version = "20.8.3"
4+
version = "21.3.1"
55
putin_khuylo = true
66

7-
cluster_name = var.cluster_name
8-
cluster_version = var.cluster_version
9-
cluster_endpoint_public_access = true
7+
name = var.cluster_name
8+
kubernetes_version = var.cluster_version
9+
endpoint_public_access = true
1010

11-
cluster_addons = {
12-
coredns = {
13-
most_recent = true
14-
}
15-
kube-proxy = {
16-
most_recent = true
11+
addons = {
12+
coredns = {}
13+
eks-pod-identity-agent = {
14+
before_compute = true
1715
}
16+
kube-proxy = {}
1817
vpc-cni = {
19-
most_recent = true
18+
before_compute = true
2019
}
2120
}
2221

@@ -25,29 +24,36 @@ module "eks" {
2524

2625
authentication_mode = "API_AND_CONFIG_MAP"
2726

28-
self_managed_node_groups = {
29-
node_group_1 = {
30-
name = "${var.cluster_name}-ng-1"
31-
instance_type = "m5.large"
32-
max_size = 5
33-
min_size = 2
34-
desired_size = 2
27+
access_entries = {
28+
for key, arn in var.additional_cluster_admin_arns :
29+
key => {
30+
principal_arn = arn
31+
policy_associations = {
32+
admin = {
33+
policy_arn = "arn:aws:eks::aws:cluster-access-policy/AmazonEKSClusterAdminPolicy"
34+
access_scope = {
35+
type = "cluster"
36+
}
37+
}
38+
}
3539
}
3640
}
3741

3842
eks_managed_node_groups = {
39-
node_group_spot = {
40-
name = "${var.cluster_name}-spot"
41-
min_size = 1
43+
node_group = {
44+
name = "${var.cluster_name}"
45+
min_size = 2
4246
max_size = 10
43-
desired_size = 1
47+
desired_size = 2
4448

45-
instance_types = ["t3.large"]
46-
capacity_type = "SPOT"
49+
instance_types = ["m5.large"]
4750

4851
update_config = {
4952
max_unavailable_percentage = 50 # or set `max_unavailable`
5053
}
54+
metadata_options = {
55+
http_put_response_hop_limit = 2
56+
}
5157
}
5258
}
5359
}
@@ -71,4 +77,5 @@ resource "aws_eks_access_entry" "access_entry" {
7177
cluster_name = var.cluster_name
7278
principal_arn = module.castai-eks-role-iam.instance_profile_role_arn
7379
type = "EC2_LINUX"
74-
}
80+
}
81+

examples/eks/eks_cluster_access_entries/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,9 @@ variable "tags" {
4444
description = "Optional tags for new cluster nodes. This parameter applies only to new nodes - tags for old nodes are not reconciled."
4545
default = {}
4646
}
47+
48+
variable "additional_cluster_admin_arns" {
49+
type = map(string)
50+
description = "Map of additional IAM user or role ARNs to be granted admin access to the EKS cluster."
51+
default = {}
52+
}

examples/eks/eks_cluster_access_entries/versions.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ terraform {
1212
}
1313
aws = {
1414
source = "hashicorp/aws"
15-
version = "~> 5.0"
15+
version = "~> 6.0"
1616
}
1717
}
1818
required_version = ">= 1.3.2"

examples/eks/eks_cluster_access_entries/vpc.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ data "aws_availability_zones" "available" {}
33

44
module "vpc" {
55
source = "terraform-aws-modules/vpc/aws"
6-
version = "5.0.0"
6+
version = "6.4.0"
77

88
name = var.cluster_name
99
cidr = "10.0.0.0/16"

0 commit comments

Comments
 (0)