Skip to content

Commit b0f51fd

Browse files
authored
feat: Add permissions boundary to fargate execution IAM role (#1108)
1 parent ea2f698 commit b0f51fd

File tree

4 files changed

+14
-5
lines changed

4 files changed

+14
-5
lines changed

fargate.tf

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ module "fargate" {
55
create_fargate_pod_execution_role = var.create_fargate_pod_execution_role
66
fargate_pod_execution_role_name = var.fargate_pod_execution_role_name
77
fargate_profiles = var.fargate_profiles
8+
permissions_boundary = var.permissions_boundary
89
iam_path = var.iam_path
910
iam_policy_arn_prefix = local.policy_arn_prefix
1011
subnets = var.subnets

modules/fargate/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ No requirements.
3838
| fargate\_profiles | Fargate profiles to create. See `fargate_profile` keys section in README.md for more details | `any` | `{}` | no |
3939
| iam\_path | IAM roles will be created on this path. | `string` | `"/"` | no |
4040
| iam\_policy\_arn\_prefix | IAM policy prefix with the correct AWS partition. | `string` | n/a | yes |
41+
| permissions\_boundary | If provided, all IAM roles will be created with this permissions boundary attached. | `string` | `null` | no |
4142
| subnets | A list of subnets for the EKS Fargate profiles. | `list(string)` | `[]` | no |
4243
| tags | A map of tags to add to all resources. | `map(string)` | `{}` | no |
4344

modules/fargate/fargate.tf

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
resource "aws_iam_role" "eks_fargate_pod" {
2-
count = local.create_eks && var.create_fargate_pod_execution_role ? 1 : 0
3-
name_prefix = format("%s-fargate", var.cluster_name)
4-
assume_role_policy = data.aws_iam_policy_document.eks_fargate_pod_assume_role[0].json
5-
tags = var.tags
6-
path = var.iam_path
2+
count = local.create_eks && var.create_fargate_pod_execution_role ? 1 : 0
3+
name_prefix = format("%s-fargate", var.cluster_name)
4+
assume_role_policy = data.aws_iam_policy_document.eks_fargate_pod_assume_role[0].json
5+
permissions_boundary = var.permissions_boundary
6+
tags = var.tags
7+
path = var.iam_path
78
}
89

910
resource "aws_iam_role_policy_attachment" "eks_fargate_pod" {

modules/fargate/variables.tf

+6
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@ variable "fargate_profiles" {
3838
default = {}
3939
}
4040

41+
variable "permissions_boundary" {
42+
description = "If provided, all IAM roles will be created with this permissions boundary attached."
43+
type = string
44+
default = null
45+
}
46+
4147
variable "subnets" {
4248
description = "A list of subnets for the EKS Fargate profiles."
4349
type = list(string)

0 commit comments

Comments
 (0)