From 317416b31637dcf6cd9186d7bfa381f17e524dbf Mon Sep 17 00:00:00 2001 From: Ben Drucker Date: Wed, 29 Apr 2020 20:41:08 -0700 Subject: [PATCH] Use Terraform element wrap-around for AWS controllers subnet_id (#714) * Fix Terraform plan error when controller_count exceeds available AWS zones (e.g. 5 controllers) --- aws/container-linux/kubernetes/controllers.tf | 2 +- aws/fedora-coreos/kubernetes/controllers.tf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/aws/container-linux/kubernetes/controllers.tf b/aws/container-linux/kubernetes/controllers.tf index cd02024e..66a0a9bc 100644 --- a/aws/container-linux/kubernetes/controllers.tf +++ b/aws/container-linux/kubernetes/controllers.tf @@ -36,7 +36,7 @@ resource "aws_instance" "controllers" { # network associate_public_ip_address = true - subnet_id = aws_subnet.public.*.id[count.index] + subnet_id = element(aws_subnet.public.*.id, count.index) vpc_security_group_ids = [aws_security_group.controller.id] lifecycle { diff --git a/aws/fedora-coreos/kubernetes/controllers.tf b/aws/fedora-coreos/kubernetes/controllers.tf index e4bd9ddb..2fd253db 100644 --- a/aws/fedora-coreos/kubernetes/controllers.tf +++ b/aws/fedora-coreos/kubernetes/controllers.tf @@ -36,7 +36,7 @@ resource "aws_instance" "controllers" { # network associate_public_ip_address = true - subnet_id = aws_subnet.public.*.id[count.index] + subnet_id = element(aws_subnet.public.*.id, count.index) vpc_security_group_ids = [aws_security_group.controller.id] lifecycle {