I am not able to add multiple subnets using helm_release provider. I have eks deployed and I want to use eks private subnets to add Internal NLB but I can only able to add the single subnet. If i add count and element it only picking the single subnet id and it rotate the helm_release. I just want to add the my eks subnets using set.
Below are the code snippet
resource “helm_release” “isnp_stg” {
name = var.name
chart = “nginx-ingress”
namespace = var.namespace
repository = “https://helm.nginx.com/stable”
create_namespace = true
values = [templatefile(“${path.module}/ingress-nginx-values.yaml”, {
})]
depends_on = [
aws_eks_cluster.isnp-cpg
]
set {
name = “cluster.enabled”
value = “true”
}
set {
name = “metrics.enabled”
value = “true”
}
set {
name = “controller.service.annotations.service\.beta\.kubernetes\.io/aws-load-balancer-cross-zone-load-balancing-enabled”
value = “true”
type = “string”
}
set {
name = "controller.service.annotations.service\\.beta\\.kubernetes\\.io/aws-load-balancer-subnets"
type = "auto"
value = "${aws_subnet.isnp_stg_private_subnet.*.id}"
}
}
variable “name” {
type = string
description = “Name of helm release”
default = “ingress-nginx”
}
variable “namespace” {
type = string
description = “Name of namespace where nginx controller should be deployed”
default = “isnp”
}
variable “chart_version” {
type = string
description = “HELM Chart Version for nginx controller”
default = “4.0.19”
}
// Create Private Subnets
resource “aws_subnet” “isnp_stg_private_subnet” {
count = length(var.private_cidrs)
vpc_id = data.aws_vpc.selected.id
cidr_block = var.private_cidrs[count.index]
availability_zone = var.azs[count.index]
tags = {
Name = “{var.private_subnet_names}-{count.index + 1}”
}
}