From e4e00da34e6038719911586d23bae7af3eb56aeb Mon Sep 17 00:00:00 2001 From: Leo J <153937047+leiicamundi@users.noreply.github.com> Date: Fri, 17 Jan 2025 15:46:30 +0100 Subject: [PATCH] coun --- modules/eks-cluster/{get_vpc_data.sh => get_vpc_count.sh} | 4 +++- modules/eks-cluster/vpc.tf | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) rename modules/eks-cluster/{get_vpc_data.sh => get_vpc_count.sh} (88%) diff --git a/modules/eks-cluster/get_vpc_data.sh b/modules/eks-cluster/get_vpc_count.sh similarity index 88% rename from modules/eks-cluster/get_vpc_data.sh rename to modules/eks-cluster/get_vpc_count.sh index b6390c3..53c8620 100755 --- a/modules/eks-cluster/get_vpc_data.sh +++ b/modules/eks-cluster/get_vpc_count.sh @@ -2,6 +2,8 @@ set -euo pipefail +# Count the number of VPCs matching a query name + # Check if a region argument is provided if [ -z "$1" ]; then echo "Error: No region specified." @@ -29,4 +31,4 @@ fi vpc_count=$(echo "$vpcs" | jq length) # Return the VPC data in a format Terraform's external data source expects -echo "{\"vpc_count\": \"$vpc_count\", \"vpcs\": $vpcs}" +echo "{\"vpc_count\": \"$vpc_count\"}" diff --git a/modules/eks-cluster/vpc.tf b/modules/eks-cluster/vpc.tf index 9e1bea1..3cecbdc 100644 --- a/modules/eks-cluster/vpc.tf +++ b/modules/eks-cluster/vpc.tf @@ -29,7 +29,7 @@ data "external" "elastic_ips_count" { # Data source to check if the VPC exists data "external" "vpc_data" { - program = ["bash", "./get_vpc_data.sh", var.region, local.vpc_name] + program = ["bash", "./get_vpc_count.sh", var.region, local.vpc_name] }