From 88732f0cb151c05bdd9e3ce259ecbb58f5f223d2 Mon Sep 17 00:00:00 2001 From: ehabshaaban Date: Fri, 20 May 2022 16:54:42 +0200 Subject: [PATCH] chore --- nginx.tf | 2 +- variables.tf | 12 ++++++++++++ vpc.tf | 10 +++++++--- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/nginx.tf b/nginx.tf index cdad170..159376b 100644 --- a/nginx.tf +++ b/nginx.tf @@ -9,7 +9,7 @@ resource "helm_release" "nginx" { set { name = "replicaCount" - value = "3" + value = var.replica } depends_on = [ diff --git a/variables.tf b/variables.tf index 9495b5b..0f900c4 100644 --- a/variables.tf +++ b/variables.tf @@ -11,6 +11,12 @@ variable "namespace" { description = "kubernetes namespace" } +variable "tag" { + type = string + default = "terraform-eks-cluster" + description = "tag for aws resources" +} + variable "kubernetes_version" { type = string default = "1.22" @@ -40,3 +46,9 @@ variable "nginx_version" { default = "4.1.0" description = "nginx chart version" } + +variable "replica" { + type = string + default = "3" + description = "number of nginx replica" +} diff --git a/vpc.tf b/vpc.tf index 1822410..a30df4a 100644 --- a/vpc.tf +++ b/vpc.tf @@ -8,12 +8,16 @@ data "aws_region" "current" { data "aws_availability_zones" "available" { } +locals { + tag = var.tag +} + resource "aws_vpc" "this" { cidr_block = "10.0.0.0/16" enable_dns_support = true enable_dns_hostnames = true tags = { - "Name" = "terraform-eks-cluster" + Name = local.tag } } @@ -26,7 +30,7 @@ resource "aws_subnet" "this" { map_public_ip_on_launch = true tags = { - "Name" = "terraform-eks-cluster" + Name = local.tag } } @@ -34,7 +38,7 @@ resource "aws_internet_gateway" "this" { vpc_id = aws_vpc.this.id tags = { - Name = "terraform-eks-cluster" + Name = local.tag } }