Skip to content

Commit bb9c1b0

Browse files
Merge pull request #284 from tekn0ir/iam_path
Add optional iam_path
2 parents 9fe2cfd + 3728299 commit bb9c1b0

File tree

6 files changed

+17
-0
lines changed

6 files changed

+17
-0
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@ project adheres to [Semantic Versioning](http://semver.org/).
2121

2222
# History
2323

24+
## [[v2.2.2](https://github.com/terraform-aws-modules/terraform-aws-eks/compare/v2.2.1...v2.2.2)] - 2019-02-25]
25+
26+
### Added
27+
28+
- Ability to specify a path for IAM roles (by @tekn0ir)
29+
2430
## [[v2.2.1](https://github.com/terraform-aws-modules/terraform-aws-eks/compare/v2.2.0...v2.2.1)] - 2019-02-18]
2531

2632
## [[v2.2.0](https://github.com/terraform-aws-modules/terraform-aws-eks/compare/v2.1.0...v2.2.0)] - 2019-02-07]

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ MIT Licensed. See [LICENSE](https://github.com/terraform-aws-modules/terraform-a
149149
| workers\_group\_launch\_template\_defaults | Override default values for target groups. See workers_group_defaults_defaults in local.tf for valid keys. | map | `{}` | no |
150150
| write\_aws\_auth\_config | Whether to write the aws-auth configmap file. | string | `"true"` | no |
151151
| write\_kubeconfig | Whether to write a Kubectl config file containing the cluster configuration. Saved to `config_output_path`. | string | `"true"` | no |
152+
| iam\_path | If provided, all IAM roles will be created with path. | string | `"/"` | no |
152153
153154
## Outputs
154155

cluster.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ resource "aws_iam_role" "cluster" {
5353
name_prefix = "${var.cluster_name}"
5454
assume_role_policy = "${data.aws_iam_policy_document.cluster_assume_role_policy.json}"
5555
permissions_boundary = "${var.permissions_boundary}"
56+
path = "${var.iam_path}"
5657
force_detach_policies = true
5758
}
5859

variables.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,3 +226,8 @@ variable "permissions_boundary" {
226226
description = "If provided, all IAM roles will be created with this permissions boundary attached."
227227
default = ""
228228
}
229+
230+
variable "iam_path" {
231+
description = "If provided, all IAM roles will be created on this path."
232+
default = "/"
233+
}

workers.tf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,13 +115,15 @@ resource "aws_iam_role" "workers" {
115115
name_prefix = "${aws_eks_cluster.this.name}"
116116
assume_role_policy = "${data.aws_iam_policy_document.workers_assume_role_policy.json}"
117117
permissions_boundary = "${var.permissions_boundary}"
118+
path = "${var.iam_path}"
118119
force_detach_policies = true
119120
}
120121

121122
resource "aws_iam_instance_profile" "workers" {
122123
name_prefix = "${aws_eks_cluster.this.name}"
123124
role = "${lookup(var.worker_groups[count.index], "iam_role_id", lookup(local.workers_group_defaults, "iam_role_id"))}"
124125
count = "${var.worker_group_count}"
126+
path = "${var.iam_path}"
125127
}
126128

127129
resource "aws_iam_role_policy_attachment" "workers_AmazonEKSWorkerNodePolicy" {
@@ -158,6 +160,7 @@ resource "aws_iam_policy" "worker_autoscaling" {
158160
name_prefix = "eks-worker-autoscaling-${aws_eks_cluster.this.name}"
159161
description = "EKS worker node autoscaling policy for cluster ${aws_eks_cluster.this.name}"
160162
policy = "${data.aws_iam_policy_document.worker_autoscaling.json}"
163+
path = "${var.iam_path}"
161164
}
162165

163166
data "aws_iam_policy_document" "worker_autoscaling" {

workers_launch_template.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,4 +105,5 @@ resource "aws_iam_instance_profile" "workers_launch_template" {
105105
name_prefix = "${aws_eks_cluster.this.name}"
106106
role = "${lookup(var.worker_groups_launch_template[count.index], "iam_role_id", lookup(local.workers_group_launch_template_defaults, "iam_role_id"))}"
107107
count = "${var.worker_group_launch_template_count}"
108+
path = "${var.iam_path}"
108109
}

0 commit comments

Comments
 (0)