Skip to content

Commit 61a5dbe

Browse files
feat: Added variable load_balancer_controller_targetgroup_arns in iam-role-for-service-accounts-eks module (#402)
Co-authored-by: Anton Babenko <[email protected]>
1 parent f537b20 commit 61a5dbe

File tree

4 files changed

+16
-1
lines changed

4 files changed

+16
-1
lines changed

modules/iam-role-for-service-accounts-eks/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ No modules.
221221
| <a name="input_karpenter_sqs_queue_arn"></a> [karpenter\_sqs\_queue\_arn](#input\_karpenter\_sqs\_queue\_arn) | (Optional) ARN of SQS used by Karpenter when native node termination handling is enabled | `string` | `null` | no |
222222
| <a name="input_karpenter_subnet_account_id"></a> [karpenter\_subnet\_account\_id](#input\_karpenter\_subnet\_account\_id) | Account ID of where the subnets Karpenter will utilize resides. Used when subnets are shared from another account | `string` | `""` | no |
223223
| <a name="input_karpenter_tag_key"></a> [karpenter\_tag\_key](#input\_karpenter\_tag\_key) | Tag key (`{key = value}`) applied to resources launched by Karpenter through the Karpenter provisioner | `string` | `"karpenter.sh/discovery"` | no |
224+
| <a name="input_load_balancer_controller_targetgroup_arns"></a> [load\_balancer\_controller\_targetgroup\_arns](#input\_load\_balancer\_controller\_targetgroup\_arns) | List of Target groups ARNs using Load Balancer Controller | `list(string)` | <pre>[<br> "arn:aws:elasticloadbalancing:*:*:targetgroup/*/*"<br>]</pre> | no |
224225
| <a name="input_max_session_duration"></a> [max\_session\_duration](#input\_max\_session\_duration) | Maximum CLI/API session duration in seconds between 3600 and 43200 | `number` | `null` | no |
225226
| <a name="input_node_termination_handler_sqs_queue_arns"></a> [node\_termination\_handler\_sqs\_queue\_arns](#input\_node\_termination\_handler\_sqs\_queue\_arns) | List of SQS ARNs that contain node termination events | `list(string)` | <pre>[<br> "*"<br>]</pre> | no |
226227
| <a name="input_oidc_providers"></a> [oidc\_providers](#input\_oidc\_providers) | Map of OIDC providers where each provider map should contain the `provider`, `provider_arn`, and `namespace_service_accounts` | `any` | `{}` | no |

modules/iam-role-for-service-accounts-eks/policies.tf

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1003,13 +1003,20 @@ data "aws_iam_policy_document" "load_balancer_controller_targetgroup_only" {
10031003
"ec2:RevokeSecurityGroupIngress",
10041004
"elasticloadbalancing:DescribeTargetGroups",
10051005
"elasticloadbalancing:DescribeTargetHealth",
1006+
]
1007+
1008+
resources = ["*"]
1009+
}
1010+
1011+
statement {
1012+
actions = [
10061013
"elasticloadbalancing:ModifyTargetGroup",
10071014
"elasticloadbalancing:ModifyTargetGroupAttributes",
10081015
"elasticloadbalancing:RegisterTargets",
10091016
"elasticloadbalancing:DeregisterTargets",
10101017
]
10111018

1012-
resources = ["*"]
1019+
resources = var.load_balancer_controller_targetgroup_arns
10131020
}
10141021
}
10151022

modules/iam-role-for-service-accounts-eks/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,12 @@ variable "attach_load_balancer_controller_targetgroup_binding_only_policy" {
261261
default = false
262262
}
263263

264+
variable "load_balancer_controller_targetgroup_arns" {
265+
description = "List of Target groups ARNs using Load Balancer Controller"
266+
type = list(string)
267+
default = ["arn:aws:elasticloadbalancing:*:*:targetgroup/*/*"]
268+
}
269+
264270
# AWS Appmesh Controller
265271
variable "attach_appmesh_controller_policy" {
266272
description = "Determines whether to attach the Appmesh Controller policy to the role"

wrappers/iam-role-for-service-accounts-eks/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ module "wrapper" {
4444
karpenter_sqs_queue_arn = try(each.value.karpenter_sqs_queue_arn, var.defaults.karpenter_sqs_queue_arn, null)
4545
attach_load_balancer_controller_policy = try(each.value.attach_load_balancer_controller_policy, var.defaults.attach_load_balancer_controller_policy, false)
4646
attach_load_balancer_controller_targetgroup_binding_only_policy = try(each.value.attach_load_balancer_controller_targetgroup_binding_only_policy, var.defaults.attach_load_balancer_controller_targetgroup_binding_only_policy, false)
47+
load_balancer_controller_targetgroup_arns = try(each.value.load_balancer_controller_targetgroup_arns, var.defaults.load_balancer_controller_targetgroup_arns, ["arn:aws:elasticloadbalancing:*:*:targetgroup/*/*"])
4748
attach_appmesh_controller_policy = try(each.value.attach_appmesh_controller_policy, var.defaults.attach_appmesh_controller_policy, false)
4849
attach_appmesh_envoy_proxy_policy = try(each.value.attach_appmesh_envoy_proxy_policy, var.defaults.attach_appmesh_envoy_proxy_policy, false)
4950
attach_amazon_managed_service_prometheus_policy = try(each.value.attach_amazon_managed_service_prometheus_policy, var.defaults.attach_amazon_managed_service_prometheus_policy, false)

0 commit comments

Comments
 (0)