Skip to content

Commit 9762c61

Browse files
committed
add fargate_subnets variable
The EKS cluster can be provisioned with both private and public subnets. But Fargate only accepts private ones. This new variable allows to override the subnets to explicitly pass the private subnets to Fargate and work around that issue.
1 parent e4520d2 commit 9762c61

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

fargate.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ module "fargate" {
77
fargate_profiles = var.fargate_profiles
88
iam_path = var.iam_path
99
iam_policy_arn_prefix = local.policy_arn_prefix
10-
subnets = var.subnets
10+
subnets = length(var.fargate_subnets) > 0 ? var.fargate_subnets : var.subnets
1111
tags = var.tags
1212

1313
# Hack to ensure ordering of resource creation.

variables.tf

+6
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,12 @@ variable "fargate_profiles" {
356356
default = {}
357357
}
358358

359+
variable "fargate_subnets" {
360+
description = "A list of private subnets to use for Fargate. Defaults to the subnets var if empty."
361+
type = list(string)
362+
default = []
363+
}
364+
359365
variable "create_fargate_pod_execution_role" {
360366
description = "Controls if the EKS Fargate pod execution IAM role should be created."
361367
type = bool

0 commit comments

Comments
 (0)