mirror of
https://github.com/ysoftdevs/terraform-aws-eks.git
synced 2026-03-27 03:41:05 +01:00
feat: Add multiple selectors on the creation of Fargate profile (#1378)
BREAKING CHANGES: To support multiple selectors for Fargate profiles, we introduced the `selectors` argument which is a list of map. This will break previous configuration with a single selector `namespace` and `labels`. You'll need to rewrite your configuration to use the `selectors` argument. See [examples](https://github.com/terraform-aws-modules/terraform-aws-eks/blob/master/examples/fargate/main.tf) dans [docs](https://github.com/terraform-aws-modules/terraform-aws-eks/blob/master/modules/fargate/README.md) for details. Co-authored-by: Lena <lena.mantziou@nationwide.co.uk>
This commit is contained in:
committed by
GitHub
parent
8765362093
commit
4818043617
@@ -72,15 +72,25 @@ module "eks" {
|
|||||||
vpc_id = module.vpc.vpc_id
|
vpc_id = module.vpc.vpc_id
|
||||||
|
|
||||||
fargate_profiles = {
|
fargate_profiles = {
|
||||||
example = {
|
default = {
|
||||||
namespace = "default"
|
name = "default"
|
||||||
|
selectors = [
|
||||||
# Kubernetes labels for selection
|
{
|
||||||
# labels = {
|
namespace = "kube-system"
|
||||||
# Environment = "test"
|
labels = {
|
||||||
# GithubRepo = "terraform-aws-eks"
|
k8s-app = "kube-dns"
|
||||||
# GithubOrg = "terraform-aws-modules"
|
}
|
||||||
# }
|
},
|
||||||
|
{
|
||||||
|
namespace = "default"
|
||||||
|
# Kubernetes labels for selection
|
||||||
|
# labels = {
|
||||||
|
# Environment = "test"
|
||||||
|
# GithubRepo = "terraform-aws-eks"
|
||||||
|
# GithubOrg = "terraform-aws-modules"
|
||||||
|
# }
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
# using specific subnets instead of all the ones configured in eks
|
# using specific subnets instead of all the ones configured in eks
|
||||||
# subnets = ["subnet-0ca3e3d1234a56c78"]
|
# subnets = ["subnet-0ca3e3d1234a56c78"]
|
||||||
|
|||||||
@@ -11,10 +11,9 @@ Helper submodule to create and manage resources related to `aws_eks_fargate_prof
|
|||||||
| Name | Description | Type | Default | Required |
|
| Name | Description | Type | Default | Required |
|
||||||
|------|-------------|------|---------|:--------:|
|
|------|-------------|------|---------|:--------:|
|
||||||
| name | Fargate profile name | `string` | Auto generated in the following format `[cluster_name]-fargate-[fargate_profile_map_key]`| no |
|
| name | Fargate profile name | `string` | Auto generated in the following format `[cluster_name]-fargate-[fargate_profile_map_key]`| no |
|
||||||
| namespace | Kubernetes namespace for selection | `string` | n/a | yes |
|
| selectors | A list of Kubernetes selectors. See examples/fargate/main.tf for example format. | <pre>list(map({<br>namespace = string<br>labels = map(string)<br>}))</pre>| `[]` | no |
|
||||||
| labels | Key-value map of Kubernetes labels for selection | `map(string)` | `{}` | no |
|
|
||||||
| tags | Key-value map of resource tags. Will be merged with root module tags. | `map(string)` | `var.tags` | no |
|
|
||||||
| subnets | List of subnet IDs. Will replace the root module subnets. | `list(string)` | `var.subnets` | no |
|
| subnets | List of subnet IDs. Will replace the root module subnets. | `list(string)` | `var.subnets` | no |
|
||||||
|
| tags | Key-value map of resource tags. Will be merged with root module tags. | `map(string)` | `var.tags` | no |
|
||||||
|
|
||||||
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
|
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
|
||||||
## Requirements
|
## Requirements
|
||||||
|
|||||||
@@ -20,9 +20,13 @@ resource "aws_eks_fargate_profile" "this" {
|
|||||||
pod_execution_role_arn = local.pod_execution_role_arn
|
pod_execution_role_arn = local.pod_execution_role_arn
|
||||||
subnet_ids = lookup(each.value, "subnets", var.subnets)
|
subnet_ids = lookup(each.value, "subnets", var.subnets)
|
||||||
tags = each.value.tags
|
tags = each.value.tags
|
||||||
selector {
|
|
||||||
namespace = each.value.namespace
|
dynamic "selector" {
|
||||||
labels = lookup(each.value, "labels", null)
|
for_each = each.value.selectors
|
||||||
|
content {
|
||||||
|
namespace = selector.value["namespace"]
|
||||||
|
labels = lookup(selector.value, "labels", {})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
depends_on = [var.eks_depends_on]
|
depends_on = [var.eks_depends_on]
|
||||||
|
|||||||
Reference in New Issue
Block a user