Skip to content

Commit df2656b

Browse files
zoispagbryantbiggs
andauthored
feat!: Update Terraform and AWS provider versions to 1.5.7 and 6.2 respectively (#40)
Co-authored-by: Bryant Biggs <[email protected]>
1 parent 9478c49 commit df2656b

File tree

10 files changed

+139
-63
lines changed

10 files changed

+139
-63
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/antonbabenko/pre-commit-terraform
3-
rev: v1.96.1
3+
rev: v1.99.5
44
hooks:
55
- id: terraform_fmt
66
- id: terraform_wrapper_module_for_each

README.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -407,14 +407,14 @@ Examples codified under the [`examples`](https://github.com/terraform-aws-module
407407

408408
| Name | Version |
409409
|------|---------|
410-
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.3.2 |
411-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.30 |
410+
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.5.7 |
411+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 6.2 |
412412

413413
## Providers
414414

415415
| Name | Version |
416416
|------|---------|
417-
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.30 |
417+
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 6.2 |
418418

419419
## Modules
420420

@@ -497,8 +497,8 @@ No modules.
497497
| <a name="input_amazon_managed_service_prometheus_workspace_arns"></a> [amazon\_managed\_service\_prometheus\_workspace\_arns](#input\_amazon\_managed\_service\_prometheus\_workspace\_arns) | List of AMP Workspace ARNs to read and write metrics | `list(string)` | `[]` | no |
498498
| <a name="input_appmesh_controller_policy_name"></a> [appmesh\_controller\_policy\_name](#input\_appmesh\_controller\_policy\_name) | Custom name of the AppMesh Controller IAM policy | `string` | `null` | no |
499499
| <a name="input_appmesh_envoy_proxy_policy_name"></a> [appmesh\_envoy\_proxy\_policy\_name](#input\_appmesh\_envoy\_proxy\_policy\_name) | Custom name of the AppMesh Envoy Proxy IAM policy | `string` | `null` | no |
500-
| <a name="input_association_defaults"></a> [association\_defaults](#input\_association\_defaults) | Default values used across all Pod Identity associations created unless a more specific value is provided | `any` | `{}` | no |
501-
| <a name="input_associations"></a> [associations](#input\_associations) | Map of Pod Identity associations to be created (map of maps) | `any` | `{}` | no |
500+
| <a name="input_association_defaults"></a> [association\_defaults](#input\_association\_defaults) | Default values used across all Pod Identity associations created unless a more specific value is provided | <pre>object({<br/> cluster_name = optional(string)<br/> disable_session_tags = optional(bool)<br/> namespace = optional(string)<br/> service_account = optional(string)<br/> role_arn = optional(string)<br/> target_role_arn = optional(string)<br/> tags = optional(map(string), {})<br/> })</pre> | `{}` | no |
501+
| <a name="input_associations"></a> [associations](#input\_associations) | Map of Pod Identity associations to be created (map of maps) | <pre>map(object({<br/> cluster_name = optional(string)<br/> disable_session_tags = optional(bool)<br/> namespace = optional(string)<br/> service_account = optional(string)<br/> role_arn = optional(string)<br/> target_role_arn = optional(string)<br/> tags = optional(map(string), {})<br/> }))</pre> | `{}` | no |
502502
| <a name="input_attach_amazon_managed_service_prometheus_policy"></a> [attach\_amazon\_managed\_service\_prometheus\_policy](#input\_attach\_amazon\_managed\_service\_prometheus\_policy) | Determines whether to attach the Amazon Managed Service for Prometheus IAM policy to the role | `bool` | `false` | no |
503503
| <a name="input_attach_aws_appmesh_controller_policy"></a> [attach\_aws\_appmesh\_controller\_policy](#input\_attach\_aws\_appmesh\_controller\_policy) | Determines whether to attach the AppMesh Controller policy to the role | `bool` | `false` | no |
504504
| <a name="input_attach_aws_appmesh_envoy_proxy_policy"></a> [attach\_aws\_appmesh\_envoy\_proxy\_policy](#input\_attach\_aws\_appmesh\_envoy\_proxy\_policy) | Determines whether to attach the AppMesh Envoy Proxy policy to the role | `bool` | `false` | no |
@@ -559,11 +559,12 @@ No modules.
559559
| <a name="input_path"></a> [path](#input\_path) | Path of IAM role | `string` | `"/"` | no |
560560
| <a name="input_permissions_boundary_arn"></a> [permissions\_boundary\_arn](#input\_permissions\_boundary\_arn) | Permissions boundary ARN to use for IAM role | `string` | `null` | no |
561561
| <a name="input_policy_name_prefix"></a> [policy\_name\_prefix](#input\_policy\_name\_prefix) | IAM policy name prefix | `string` | `"AmazonEKS_"` | no |
562-
| <a name="input_policy_statements"></a> [policy\_statements](#input\_policy\_statements) | A list of IAM policy [statements](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document#statement) for custom permission usage | `any` | `[]` | no |
562+
| <a name="input_policy_statements"></a> [policy\_statements](#input\_policy\_statements) | A list of IAM policy [statements](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document#statement) for custom permission usage | <pre>list(object({<br/> sid = optional(string)<br/> actions = optional(list(string))<br/> not_actions = optional(list(string))<br/> effect = optional(string)<br/> resources = optional(list(string))<br/> not_resources = optional(list(string))<br/> principals = optional(list(object({<br/> type = string<br/> identifiers = list(string)<br/> })))<br/> not_principals = optional(list(object({<br/> type = string<br/> identifiers = list(string)<br/> })))<br/> condition = optional(list(object({<br/> test = string<br/> values = list(string)<br/> variable = string<br/> })))<br/> }))</pre> | `null` | no |
563+
| <a name="input_region"></a> [region](#input\_region) | Region where the resource(s) will be managed. Defaults to the Region set in the provider configuration | `string` | `null` | no |
563564
| <a name="input_source_policy_documents"></a> [source\_policy\_documents](#input\_source\_policy\_documents) | List of IAM policy documents that are merged together into the exported document | `list(string)` | `[]` | no |
564565
| <a name="input_tags"></a> [tags](#input\_tags) | A map of tags to add to all resources | `map(string)` | `{}` | no |
565-
| <a name="input_trust_policy_conditions"></a> [trust\_policy\_conditions](#input\_trust\_policy\_conditions) | A list of conditions to add to the role trust policy | `any` | `[]` | no |
566-
| <a name="input_trust_policy_statements"></a> [trust\_policy\_statements](#input\_trust\_policy\_statements) | A list of IAM policy [statements](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document#statement) for the role trust policy | `any` | `[]` | no |
566+
| <a name="input_trust_policy_conditions"></a> [trust\_policy\_conditions](#input\_trust\_policy\_conditions) | A list of conditions to add to the role trust policy | <pre>list(object({<br/> test = string<br/> values = list(string)<br/> variable = string<br/> }))</pre> | `[]` | no |
567+
| <a name="input_trust_policy_statements"></a> [trust\_policy\_statements](#input\_trust\_policy\_statements) | A list of IAM policy [statements](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document#statement) for the role trust policy | <pre>list(object({<br/> sid = optional(string)<br/> actions = optional(list(string))<br/> not_actions = optional(list(string))<br/> effect = optional(string)<br/> resources = optional(list(string))<br/> not_resources = optional(list(string))<br/> principals = optional(list(object({<br/> type = string<br/> identifiers = list(string)<br/> })))<br/> not_principals = optional(list(object({<br/> type = string<br/> identifiers = list(string)<br/> })))<br/> condition = optional(list(object({<br/> test = string<br/> values = list(string)<br/> variable = string<br/> })))<br/> }))</pre> | `null` | no |
567568
| <a name="input_use_name_prefix"></a> [use\_name\_prefix](#input\_use\_name\_prefix) | Determines whether the role name and policy name(s) are used as a prefix | `string` | `true` | no |
568569
| <a name="input_velero_policy_name"></a> [velero\_policy\_name](#input\_velero\_policy\_name) | Custom name of the Velero IAM policy | `string` | `null` | no |
569570
| <a name="input_velero_s3_bucket_arns"></a> [velero\_s3\_bucket\_arns](#input\_velero\_s3\_bucket\_arns) | List of S3 Bucket ARNs that Velero needs access to list | `list(string)` | `[]` | no |

examples/complete/README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ Note that this example may create resources which will incur monetary charges on
1919

2020
| Name | Version |
2121
|------|---------|
22-
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.3.2 |
23-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.30 |
22+
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.5.7 |
23+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 6.2 |
2424

2525
## Providers
2626

2727
| Name | Version |
2828
|------|---------|
29-
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.30 |
29+
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 6.2 |
3030

3131
## Modules
3232

@@ -50,13 +50,13 @@ Note that this example may create resources which will incur monetary charges on
5050
| <a name="module_cluster_autoscaler_pod_identity"></a> [cluster\_autoscaler\_pod\_identity](#module\_cluster\_autoscaler\_pod\_identity) | ../../ | n/a |
5151
| <a name="module_custom_pod_identity"></a> [custom\_pod\_identity](#module\_custom\_pod\_identity) | ../../ | n/a |
5252
| <a name="module_disabled"></a> [disabled](#module\_disabled) | ../../ | n/a |
53-
| <a name="module_eks_one"></a> [eks\_one](#module\_eks\_one) | terraform-aws-modules/eks/aws | ~> 20.0 |
54-
| <a name="module_eks_two"></a> [eks\_two](#module\_eks\_two) | terraform-aws-modules/eks/aws | ~> 20.0 |
53+
| <a name="module_eks_one"></a> [eks\_one](#module\_eks\_one) | terraform-aws-modules/eks/aws | ~> 21.0 |
54+
| <a name="module_eks_two"></a> [eks\_two](#module\_eks\_two) | terraform-aws-modules/eks/aws | ~> 21.0 |
5555
| <a name="module_external_dns_pod_identity"></a> [external\_dns\_pod\_identity](#module\_external\_dns\_pod\_identity) | ../../ | n/a |
5656
| <a name="module_external_secrets_pod_identity"></a> [external\_secrets\_pod\_identity](#module\_external\_secrets\_pod\_identity) | ../../ | n/a |
5757
| <a name="module_mountpoint_s3_csi_pod_identity"></a> [mountpoint\_s3\_csi\_pod\_identity](#module\_mountpoint\_s3\_csi\_pod\_identity) | ../../ | n/a |
5858
| <a name="module_velero_pod_identity"></a> [velero\_pod\_identity](#module\_velero\_pod\_identity) | ../../ | n/a |
59-
| <a name="module_vpc"></a> [vpc](#module\_vpc) | terraform-aws-modules/vpc/aws | ~> 5.0 |
59+
| <a name="module_vpc"></a> [vpc](#module\_vpc) | terraform-aws-modules/vpc/aws | ~> 6.0 |
6060

6161
## Resources
6262

examples/complete/main.tf

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -628,9 +628,9 @@ data "aws_iam_policy_document" "override" {
628628

629629
module "eks_one" {
630630
source = "terraform-aws-modules/eks/aws"
631-
version = "~> 20.0"
631+
version = "~> 21.0"
632632

633-
cluster_name = "${local.name}-one"
633+
name = "${local.name}-one"
634634

635635
vpc_id = module.vpc.vpc_id
636636
subnet_ids = module.vpc.private_subnets
@@ -640,9 +640,9 @@ module "eks_one" {
640640

641641
module "eks_two" {
642642
source = "terraform-aws-modules/eks/aws"
643-
version = "~> 20.0"
643+
version = "~> 21.0"
644644

645-
cluster_name = "${local.name}-two"
645+
name = "${local.name}-two"
646646

647647
vpc_id = module.vpc.vpc_id
648648
subnet_ids = module.vpc.private_subnets
@@ -652,7 +652,7 @@ module "eks_two" {
652652

653653
module "vpc" {
654654
source = "terraform-aws-modules/vpc/aws"
655-
version = "~> 5.0"
655+
version = "~> 6.0"
656656

657657
name = local.name
658658
cidr = local.vpc_cidr

examples/complete/versions.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
terraform {
2-
required_version = ">= 1.3.2"
2+
required_version = ">= 1.5.7"
33

44
required_providers {
55
aws = {
66
source = "hashicorp/aws"
7-
version = ">= 5.30"
7+
version = ">= 6.2"
88
}
99
}
1010
}

main.tf

Lines changed: 33 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,18 @@ data "aws_iam_policy_document" "assume" {
3535
}
3636

3737
dynamic "statement" {
38-
for_each = var.trust_policy_statements
38+
for_each = var.trust_policy_statements != null ? var.trust_policy_statements : []
3939

4040
content {
41-
sid = try(statement.value.sid, null)
42-
actions = try(statement.value.actions, null)
43-
not_actions = try(statement.value.not_actions, null)
44-
effect = try(statement.value.effect, null)
45-
resources = try(statement.value.resources, null)
46-
not_resources = try(statement.value.not_resources, null)
41+
sid = statement.value.sid
42+
actions = statement.value.actions
43+
not_actions = statement.value.not_actions
44+
effect = statement.value.effect
45+
resources = statement.value.resources
46+
not_resources = statement.value.not_resources
4747

4848
dynamic "principals" {
49-
for_each = try(statement.value.principals, [])
49+
for_each = statement.value.principals != null ? statement.value.principals : []
5050

5151
content {
5252
type = principals.value.type
@@ -55,7 +55,7 @@ data "aws_iam_policy_document" "assume" {
5555
}
5656

5757
dynamic "not_principals" {
58-
for_each = try(statement.value.not_principals, [])
58+
for_each = statement.value.not_principals != null ? statement.value.not_principals : []
5959

6060
content {
6161
type = not_principals.value.type
@@ -64,7 +64,7 @@ data "aws_iam_policy_document" "assume" {
6464
}
6565

6666
dynamic "condition" {
67-
for_each = try(statement.value.conditions, [])
67+
for_each = statement.value.condition != null ? statement.value.condition : []
6868

6969
content {
7070
test = condition.value.test
@@ -116,18 +116,18 @@ data "aws_iam_policy_document" "base" {
116116
override_policy_documents = var.attach_custom_policy ? var.override_policy_documents : []
117117

118118
dynamic "statement" {
119-
for_each = var.policy_statements
119+
for_each = var.policy_statements != null ? var.policy_statements : []
120120

121121
content {
122-
sid = try(statement.value.sid, null)
123-
actions = try(statement.value.actions, null)
124-
not_actions = try(statement.value.not_actions, null)
125-
effect = try(statement.value.effect, null)
126-
resources = try(statement.value.resources, null)
127-
not_resources = try(statement.value.not_resources, null)
122+
sid = statement.value.sid
123+
actions = statement.value.actions
124+
not_actions = statement.value.not_actions
125+
effect = statement.value.effect
126+
resources = statement.value.resources
127+
not_resources = statement.value.not_resources
128128

129129
dynamic "principals" {
130-
for_each = try(statement.value.principals, [])
130+
for_each = statement.value.principals != null ? statement.value.principals : []
131131

132132
content {
133133
type = principals.value.type
@@ -136,7 +136,7 @@ data "aws_iam_policy_document" "base" {
136136
}
137137

138138
dynamic "not_principals" {
139-
for_each = try(statement.value.not_principals, [])
139+
for_each = statement.value.not_principals != null ? statement.value.not_principals : []
140140

141141
content {
142142
type = not_principals.value.type
@@ -145,7 +145,7 @@ data "aws_iam_policy_document" "base" {
145145
}
146146

147147
dynamic "condition" {
148-
for_each = try(statement.value.conditions, [])
148+
for_each = statement.value.condition != null ? statement.value.condition : []
149149

150150
content {
151151
test = condition.value.test
@@ -187,10 +187,18 @@ resource "aws_iam_role_policy_attachment" "custom" {
187187
resource "aws_eks_pod_identity_association" "this" {
188188
for_each = { for k, v in var.associations : k => v if var.create }
189189

190-
cluster_name = try(each.value.cluster_name, var.association_defaults.cluster_name)
191-
namespace = try(each.value.namespace, var.association_defaults.namespace)
192-
service_account = try(each.value.service_account, var.association_defaults.service_account)
193-
role_arn = aws_iam_role.this[0].arn
190+
region = var.region
194191

195-
tags = merge(var.tags, try(each.value.tags, var.association_defaults.tags, {}))
192+
cluster_name = try(coalesce(each.value.cluster_name, var.association_defaults.cluster_name))
193+
disable_session_tags = try(coalesce(each.value.disable_session_tags, var.association_defaults.disable_session_tags), null)
194+
namespace = try(coalesce(each.value.namespace, var.association_defaults.namespace))
195+
role_arn = aws_iam_role.this[0].arn
196+
service_account = try(coalesce(each.value.service_account, var.association_defaults.service_account))
197+
target_role_arn = try(coalesce(each.value.target_role_arn, var.association_defaults.target_role_arn), null)
198+
199+
tags = merge(
200+
var.tags,
201+
each.value.tags,
202+
var.association_defaults.tags,
203+
)
196204
}

0 commit comments

Comments
 (0)