Skip to content

Commit

Permalink
feat: add tag variables to modules
Browse files Browse the repository at this point in the history
  • Loading branch information
LukaK committed Oct 24, 2024
1 parent 510279d commit b8d4d5e
Show file tree
Hide file tree
Showing 14 changed files with 43 additions and 0 deletions.
5 changes: 5 additions & 0 deletions infrastructure/modules/addons/1-variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,8 @@ variable "argocd_chart_version" {
description = "Helm chart version for argocd"
default = "7.6.12"
}

variable "tags" {
type = map(string)
default = {}
}
2 changes: 2 additions & 0 deletions infrastructure/modules/addons/4-pod-identity.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@ resource "aws_eks_addon" "pod_identity" {
cluster_name = var.cluster_name
addon_name = "eks-pod-identity-agent"
addon_version = var.pod_identity_version

tags = var.tags
}
4 changes: 4 additions & 0 deletions infrastructure/modules/addons/5-cluster-autoscaller.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ resource "aws_iam_role" "cluster_autoscaler" {
},
]
})

tags = var.tags
}

resource "aws_iam_policy" "cluster_autoscaler" {
Expand Down Expand Up @@ -50,6 +52,8 @@ resource "aws_iam_policy" "cluster_autoscaler" {
},
]
})

tags = var.tags
}

resource "aws_iam_role_policy_attachment" "cluster_autoscaler" {
Expand Down
6 changes: 6 additions & 0 deletions infrastructure/modules/addons/6-ebs-csi-driver.tf
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ resource "aws_iam_role" "ebs_csi_driver" {
]
})

tags = var.tags

}

resource "aws_iam_role_policy_attachment" "ebs_csi_driver" {
Expand All @@ -41,6 +43,8 @@ resource "aws_iam_policy" "ebs_csi_driver_encryption" {
},
]
})

tags = var.tags
}

resource "aws_iam_role_policy_attachment" "ebs_csi_driver_encryption" {
Expand All @@ -60,4 +64,6 @@ resource "aws_eks_addon" "ebs_csi_driver" {
addon_name = "aws-ebs-csi-driver"
addon_version = var.ebs_csi_driver_version
service_account_role_arn = aws_iam_role.ebs_csi_driver.arn

tags = var.tags
}
1 change: 1 addition & 0 deletions infrastructure/modules/addons/7-efs-csi.tf
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ resource "aws_iam_role" "efs_csi_driver" {
]
})

tags = var.tags
}

resource "aws_iam_role_policy_attachment" "efs_csi_driver" {
Expand Down
4 changes: 4 additions & 0 deletions infrastructure/modules/addons/8-lbc.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,15 @@ resource "aws_iam_role" "aws_lbc" {
},
]
})

tags = var.tags
}

resource "aws_iam_policy" "aws_lbc" {
policy = file("./iam/lbc-policy.json")
name = "AWSLoadBalancerController"

tags = var.tags
}

resource "aws_iam_role_policy_attachment" "aws_lbc" {
Expand Down
1 change: 1 addition & 0 deletions infrastructure/modules/addons/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ No modules.
| <a name="input_metric_server_chart_version"></a> [metric\_server\_chart\_version](#input\_metric\_server\_chart\_version) | Helm chart version for metric server | `string` | `"3.12.1"` | no |
| <a name="input_pod_identity_version"></a> [pod\_identity\_version](#input\_pod\_identity\_version) | Version of the pod identity agent | `string` | `"v1.3.2-eksbuild.2"` | no |
| <a name="input_region"></a> [region](#input\_region) | Aws region | `string` | `"eu-west-1"` | no |
| <a name="input_tags"></a> [tags](#input\_tags) | n/a | `map(string)` | `{}` | no |

## Outputs

Expand Down
1 change: 1 addition & 0 deletions infrastructure/modules/storage/1-variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ variable "cluster_name" {
type = string
description = "Eks cluster name"
}

variable "efs_storage_configuration" {
description = "Efs storage configuration"
type = object({
Expand Down
2 changes: 2 additions & 0 deletions infrastructure/modules/storage/3-eft.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ resource "aws_efs_file_system" "this" {
performance_mode = "generalPurpose"
throughput_mode = "bursting"
encrypted = true

tags = var.tags
}

resource "aws_efs_mount_target" "zone" {
Expand Down
5 changes: 5 additions & 0 deletions infrastructure/modules/users-iam/1-variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,8 @@ variable "viewer_rbac_group_name" {
description = "Kubernetes RBAC viewer group"
default = "viewer"
}

variable "tags" {
type = map(string)
default = {}
}
6 changes: 6 additions & 0 deletions infrastructure/modules/users-iam/4-admin-iam.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ resource "aws_iam_role" "eks_admin" {
},
]
})

tags = var.tags

}

resource "aws_iam_policy" "eks_admin" {
Expand Down Expand Up @@ -43,6 +46,9 @@ resource "aws_iam_policy" "eks_admin" {
},
]
})

tags = var.tags

}

# attach admin policy to the admin role
Expand Down
3 changes: 3 additions & 0 deletions infrastructure/modules/users-iam/5-viewer-iam.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ resource "aws_iam_role" "eks_viewer" {
},
]
})

tags = var.tags
}

resource "aws_iam_policy" "eks_viewer" {
Expand Down Expand Up @@ -44,6 +46,7 @@ resource "aws_iam_policy" "eks_viewer" {
},
]
})
tags = var.tags
}

# attach viewer policy to the viewer role
Expand Down
2 changes: 2 additions & 0 deletions infrastructure/modules/users-iam/6-iam-groups.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ resource "aws_iam_policy" "eks_admin_group" {
},
]
})
tags = var.tags
}

# attach the policy to the eks admins group
Expand Down Expand Up @@ -49,6 +50,7 @@ resource "aws_iam_policy" "eks_viewer_group" {
},
]
})
tags = var.tags
}

# attach the policy to the eks viewers group
Expand Down
1 change: 1 addition & 0 deletions infrastructure/modules/users-iam/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ No modules.
|------|-------------|------|---------|:--------:|
| <a name="input_admin_rbac_group_name"></a> [admin\_rbac\_group\_name](#input\_admin\_rbac\_group\_name) | Kubernetes RBAC admin group | `string` | `"admin"` | no |
| <a name="input_cluster_name"></a> [cluster\_name](#input\_cluster\_name) | Eks cluster name | `string` | n/a | yes |
| <a name="input_tags"></a> [tags](#input\_tags) | n/a | `map(string)` | `{}` | no |
| <a name="input_viewer_rbac_group_name"></a> [viewer\_rbac\_group\_name](#input\_viewer\_rbac\_group\_name) | Kubernetes RBAC viewer group | `string` | `"viewer"` | no |

## Outputs
Expand Down

0 comments on commit b8d4d5e

Please sign in to comment.