Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add permissions boundary to fargate execution IAM role #1108

Merged
merged 4 commits into from
Dec 22, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions fargate.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ module "fargate" {
create_fargate_pod_execution_role = var.create_fargate_pod_execution_role
fargate_pod_execution_role_name = var.fargate_pod_execution_role_name
fargate_profiles = var.fargate_profiles
permissions_boundary = var.permissions_boundary
iam_path = var.iam_path
iam_policy_arn_prefix = local.policy_arn_prefix
subnets = var.subnets
Expand Down
1 change: 1 addition & 0 deletions modules/fargate/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ No requirements.
| fargate\_profiles | Fargate profiles to create. See `fargate_profile` keys section in README.md for more details | `any` | `{}` | no |
| iam\_path | IAM roles will be created on this path. | `string` | `"/"` | no |
| iam\_policy\_arn\_prefix | IAM policy prefix with the correct AWS partition. | `string` | n/a | yes |
| permissions\_boundary | If provided, all IAM roles will be created with this permissions boundary attached. | `string` | `null` | no |
| subnets | A list of subnets for the EKS Fargate profiles. | `list(string)` | `[]` | no |
| tags | A map of tags to add to all resources. | `map(string)` | `{}` | no |

Expand Down
11 changes: 6 additions & 5 deletions modules/fargate/fargate.tf
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
resource "aws_iam_role" "eks_fargate_pod" {
count = local.create_eks && var.create_fargate_pod_execution_role ? 1 : 0
name_prefix = format("%s-fargate", var.cluster_name)
assume_role_policy = data.aws_iam_policy_document.eks_fargate_pod_assume_role[0].json
tags = var.tags
path = var.iam_path
count = local.create_eks && var.create_fargate_pod_execution_role ? 1 : 0
name_prefix = format("%s-fargate", var.cluster_name)
assume_role_policy = data.aws_iam_policy_document.eks_fargate_pod_assume_role[0].json
permissions_boundary = var.permissions_boundary
tags = var.tags
path = var.iam_path
}

resource "aws_iam_role_policy_attachment" "eks_fargate_pod" {
Expand Down
6 changes: 6 additions & 0 deletions modules/fargate/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ variable "fargate_profiles" {
default = {}
}

variable "permissions_boundary" {
description = "If provided, all IAM roles will be created with this permissions boundary attached."
type = string
default = null
}

variable "subnets" {
description = "A list of subnets for the EKS Fargate profiles."
type = list(string)
Expand Down