Skip to content

Commit 4a7678d

Browse files
authored
feat: Added ability to pass different subnets for fargate and the cluster (#1527)
1 parent 7f8232c commit 4a7678d

File tree

4 files changed

+10
-2
lines changed

4 files changed

+10
-2
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ Apache 2 Licensed. See [LICENSE](https://github.com/terraform-aws-modules/terraf
247247
| <a name="input_enable_irsa"></a> [enable\_irsa](#input\_enable\_irsa) | Whether to create OpenID Connect Provider for EKS to enable IRSA | `bool` | `false` | no |
248248
| <a name="input_fargate_pod_execution_role_name"></a> [fargate\_pod\_execution\_role\_name](#input\_fargate\_pod\_execution\_role\_name) | The IAM Role that provides permissions for the EKS Fargate Profile. | `string` | `null` | no |
249249
| <a name="input_fargate_profiles"></a> [fargate\_profiles](#input\_fargate\_profiles) | Fargate profiles to create. See `fargate_profile` keys section in fargate submodule's README.md for more details | `any` | `{}` | no |
250+
| <a name="input_fargate_subnets"></a> [fargate\_subnets](#input\_fargate\_subnets) | A list of subnets to place fargate workers within (if different from subnets). | `list(string)` | `[]` | no |
250251
| <a name="input_iam_path"></a> [iam\_path](#input\_iam\_path) | If provided, all IAM roles will be created on this path. | `string` | `"/"` | no |
251252
| <a name="input_kubeconfig_aws_authenticator_additional_args"></a> [kubeconfig\_aws\_authenticator\_additional\_args](#input\_kubeconfig\_aws\_authenticator\_additional\_args) | Any additional arguments to pass to the authenticator such as the role to assume. e.g. ["-r", "MyEksRole"]. | `list(string)` | `[]` | no |
252253
| <a name="input_kubeconfig_aws_authenticator_command"></a> [kubeconfig\_aws\_authenticator\_command](#input\_kubeconfig\_aws\_authenticator\_command) | Command to use to fetch AWS EKS credentials. | `string` | `"aws-iam-authenticator"` | no |

examples/fargate/main.tf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ module "eks" {
6161
source = "../.."
6262
cluster_name = local.cluster_name
6363
cluster_version = "1.20"
64-
subnets = module.vpc.private_subnets
64+
subnets = [module.vpc.private_subnets[0], module.vpc.public_subnets[1]]
65+
fargate_subnets = [module.vpc.private_subnets[2]]
6566

6667
tags = {
6768
Environment = "test"

fargate.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ module "fargate" {
88
permissions_boundary = var.permissions_boundary
99
iam_path = var.iam_path
1010
iam_policy_arn_prefix = local.policy_arn_prefix
11-
subnets = var.subnets
11+
subnets = coalescelist(var.fargate_subnets, var.subnets)
1212
tags = var.tags
1313

1414
# Hack to ensure ordering of resource creation.

variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,12 @@ variable "map_users" {
8787
default = []
8888
}
8989

90+
variable "fargate_subnets" {
91+
description = "A list of subnets to place fargate workers within (if different from subnets)."
92+
type = list(string)
93+
default = []
94+
}
95+
9096
variable "subnets" {
9197
description = "A list of subnets to place the EKS cluster and workers within."
9298
type = list(string)

0 commit comments

Comments
 (0)