Skip to content

Commit 7cb63db

Browse files
committed
Support assumable_roles for eks-irsa (#3)
1 parent 31ebac1 commit 7cb63db

File tree

8 files changed

+33
-17
lines changed

8 files changed

+33
-17
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.14.0
1+
0.15.0

modules/eks-cluster/README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,16 @@ This module creates following resources.
2525

2626
| Name | Version |
2727
|------|---------|
28-
| <a name="provider_aws"></a> [aws](#provider\_aws) | 3.63.0 |
28+
| <a name="provider_aws"></a> [aws](#provider\_aws) | 3.71.0 |
2929
| <a name="provider_tls"></a> [tls](#provider\_tls) | 3.1.0 |
3030

3131
## Modules
3232

3333
| Name | Source | Version |
3434
|------|--------|---------|
35-
| <a name="module_role__control_plane"></a> [role\_\_control\_plane](#module\_role\_\_control\_plane) | tedilabs/account/aws//modules/iam-role | 0.16.1 |
36-
| <a name="module_role__fargate_profile"></a> [role\_\_fargate\_profile](#module\_role\_\_fargate\_profile) | tedilabs/account/aws//modules/iam-role | 0.16.1 |
37-
| <a name="module_role__node"></a> [role\_\_node](#module\_role\_\_node) | tedilabs/account/aws//modules/iam-role | 0.16.1 |
35+
| <a name="module_role__control_plane"></a> [role\_\_control\_plane](#module\_role\_\_control\_plane) | tedilabs/account/aws//modules/iam-role | 0.19.0 |
36+
| <a name="module_role__fargate_profile"></a> [role\_\_fargate\_profile](#module\_role\_\_fargate\_profile) | tedilabs/account/aws//modules/iam-role | 0.19.0 |
37+
| <a name="module_role__node"></a> [role\_\_node](#module\_role\_\_node) | tedilabs/account/aws//modules/iam-role | 0.19.0 |
3838
| <a name="module_security_group__control_plane"></a> [security\_group\_\_control\_plane](#module\_security\_group\_\_control\_plane) | tedilabs/network/aws//modules/security-group | 0.24.0 |
3939
| <a name="module_security_group__node"></a> [security\_group\_\_node](#module\_security\_group\_\_node) | tedilabs/network/aws//modules/security-group | 0.24.0 |
4040
| <a name="module_security_group__pod"></a> [security\_group\_\_pod](#module\_security\_group\_\_pod) | tedilabs/network/aws//modules/security-group | 0.24.0 |
@@ -47,6 +47,8 @@ This module creates following resources.
4747
| [aws_eks_cluster.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/eks_cluster) | resource |
4848
| [aws_iam_openid_connect_provider.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_openid_connect_provider) | resource |
4949
| [aws_resourcegroups_group.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/resourcegroups_group) | resource |
50+
| [aws_security_group_rule.node](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group_rule) | resource |
51+
| [aws_security_group_rule.pod](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group_rule) | resource |
5052
| [aws_subnet.selected](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/subnet) | data source |
5153
| [tls_certificate.this](https://registry.terraform.io/providers/hashicorp/tls/latest/docs/data-sources/certificate) | data source |
5254

modules/eks-cluster/iam.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ resource "aws_iam_openid_connect_provider" "this" {
2828

2929
module "role__control_plane" {
3030
source = "tedilabs/account/aws//modules/iam-role"
31-
version = "0.16.1"
31+
version = "0.19.0"
3232

3333
name = "eks-${local.metadata.name}-control-plane"
3434
path = "/"
@@ -57,7 +57,7 @@ module "role__control_plane" {
5757

5858
module "role__node" {
5959
source = "tedilabs/account/aws//modules/iam-role"
60-
version = "0.16.1"
60+
version = "0.19.0"
6161

6262
name = "eks-${local.metadata.name}-node"
6363
path = "/"
@@ -90,7 +90,7 @@ module "role__node" {
9090

9191
module "role__fargate_profile" {
9292
source = "tedilabs/account/aws//modules/iam-role"
93-
version = "0.16.1"
93+
version = "0.19.0"
9494

9595
name = "eks-${local.metadata.name}-fargate-profile"
9696
path = "/"

modules/eks-cluster/security-groups.tf

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ resource "aws_security_group_rule" "node" {
1616
type = "ingress"
1717
description = "Allow nodes to communicate to the cluster security group(for fargate pods)."
1818

19-
protocol = "-1"
20-
from_port = 0
21-
to_port = 0
19+
protocol = "-1"
20+
from_port = 0
21+
to_port = 0
2222

2323
source_security_group_id = module.security_group__node.id
2424
}
@@ -28,9 +28,9 @@ resource "aws_security_group_rule" "pod" {
2828
type = "ingress"
2929
description = "Allow pods to communicate to the cluster security group(for fargate pods)."
3030

31-
protocol = "-1"
32-
from_port = 0
33-
to_port = 0
31+
protocol = "-1"
32+
from_port = 0
33+
to_port = 0
3434

3535
source_security_group_id = module.security_group__pod.id
3636
}

modules/eks-irsa/README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ This module creates following resources.
1818

1919
| Name | Version |
2020
|------|---------|
21-
| <a name="provider_aws"></a> [aws](#provider\_aws) | 3.63.0 |
21+
| <a name="provider_aws"></a> [aws](#provider\_aws) | 3.71.0 |
2222

2323
## Modules
2424

2525
| Name | Source | Version |
2626
|------|--------|---------|
27-
| <a name="module_this"></a> [this](#module\_this) | tedilabs/account/aws//modules/iam-role | 0.16.1 |
27+
| <a name="module_this"></a> [this](#module\_this) | tedilabs/account/aws//modules/iam-role | 0.19.0 |
2828

2929
## Resources
3030

@@ -38,6 +38,7 @@ This module creates following resources.
3838
|------|-------------|------|---------|:--------:|
3939
| <a name="input_name"></a> [name](#input\_name) | Desired name of the IAM role for EKS service accounts. | `string` | n/a | yes |
4040
| <a name="input_oidc_provider_urls"></a> [oidc\_provider\_urls](#input\_oidc\_provider\_urls) | A list of URLs of OIDC identity providers. | `list(string)` | n/a | yes |
41+
| <a name="input_assumable_roles"></a> [assumable\_roles](#input\_assumable\_roles) | List of IAM roles ARNs which can be assumed by the role. | `list(string)` | `[]` | no |
4142
| <a name="input_conditions"></a> [conditions](#input\_conditions) | Required conditions to assume the role. | <pre>list(object({<br> key = string<br> condition = string<br> values = list(string)<br> }))</pre> | `[]` | no |
4243
| <a name="input_description"></a> [description](#input\_description) | The description of the role. | `string` | `""` | no |
4344
| <a name="input_effective_date"></a> [effective\_date](#input\_effective\_date) | Allow to assume IAM role only after a specific date and time. | `string` | `null` | no |
@@ -66,6 +67,7 @@ This module creates following resources.
6667
| Name | Description |
6768
|------|-------------|
6869
| <a name="output_arn"></a> [arn](#output\_arn) | The ARN assigned by AWS for this role. |
70+
| <a name="output_assumable_roles"></a> [assumable\_roles](#output\_assumable\_roles) | List of ARNs of IAM roles which members of IAM role can assume. |
6971
| <a name="output_description"></a> [description](#output\_description) | The description of the role. |
7072
| <a name="output_effective_date"></a> [effective\_date](#output\_effective\_date) | Allow to assume IAM role only after this date and time. |
7173
| <a name="output_expiration_date"></a> [expiration\_date](#output\_expiration\_date) | Allow to assume IAM role only before this date and time. |

modules/eks-irsa/main.tf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ locals {
4343

4444
module "this" {
4545
source = "tedilabs/account/aws//modules/iam-role"
46-
version = "0.16.1"
46+
version = "0.19.0"
4747

4848
name = local.metadata.name
4949
path = var.path
@@ -69,6 +69,7 @@ module "this" {
6969
source_ip_whitelist = var.source_ip_whitelist
7070
source_ip_blacklist = var.source_ip_blacklist
7171

72+
assumable_roles = var.assumable_roles
7273
policies = var.policies
7374
inline_policies = var.inline_policies
7475

modules/eks-irsa/outputs.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@ output "source_ip_blacklist" {
4848
value = var.source_ip_blacklist
4949
}
5050

51+
output "assumable_roles" {
52+
description = "List of ARNs of IAM roles which members of IAM role can assume."
53+
value = var.assumable_roles
54+
}
55+
5156
output "policies" {
5257
description = "List of ARNs of IAM policies which are atached to IAM role."
5358
value = var.policies

modules/eks-irsa/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,12 @@ variable "source_ip_blacklist" {
118118
default = []
119119
}
120120

121+
variable "assumable_roles" {
122+
description = "List of IAM roles ARNs which can be assumed by the role."
123+
type = list(string)
124+
default = []
125+
}
126+
121127
variable "policies" {
122128
description = "List of IAM policies ARNs to attach to IAM role."
123129
type = list(string)

0 commit comments

Comments
 (0)