Skip to content

Commit

Permalink
add Environment tag to all tagged resources
Browse files Browse the repository at this point in the history
  • Loading branch information
dadamsncsa committed Jun 24, 2023
1 parent 3018d24 commit 3f3d5f0
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 0 deletions.
3 changes: 3 additions & 0 deletions instance/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,13 @@ resource "aws_instance" "web" {

tags = {
Name = "${var.name}_${var.env}_web_instance"
Environment = var.env
}

volume_tags = {
Name = "${var.name}_${var.env}_web_instance"
Environment = var.env

}

}
Expand Down
2 changes: 2 additions & 0 deletions network/sg.tf
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ resource "aws_security_group" "web_sg" {
# Assigns tags to the security group, which can be useful for organization and tracking costs.
tags = {
Name = "${var.name}_${var.env}_web_sg"
Environment = var.env
}
}

Expand Down Expand Up @@ -54,6 +55,7 @@ resource "aws_security_group" "alb_sg" {

tags = {
Name = "${var.name}_${var.env}_alb_sg"
Environment = var.env
}
}

Expand Down
5 changes: 5 additions & 0 deletions network/subnets.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ resource "aws_subnet" "public_subnet" {
availability_zone = element(reverse(data.aws_availability_zones.available.names), count.index)
tags = {
Name = "${var.name}_${var.env}_public-subnet-${count.index}"
Environment = var.env
}
}

Expand All @@ -35,6 +36,7 @@ resource "aws_subnet" "private_subnet" {

tags = {
Name = "${var.name}_${var.env}_private_subnet"
Environment = var.env
}
}

Expand All @@ -45,6 +47,7 @@ resource "aws_eip" "nat_eip" {

tags = {
Name = "${var.name}_${var.env}_nat_eip"
Environment = var.env
}
}

Expand All @@ -57,6 +60,7 @@ resource "aws_nat_gateway" "nat" {

tags = {
Name = "${var.name}_${var.env}_nat"
Environment = var.env
}
}

Expand All @@ -73,6 +77,7 @@ resource "aws_route_table" "private_rt" {

tags = {
Name = "${var.name}_${var.env}_private_rt"
Environment = var.env
}
}

Expand Down
3 changes: 3 additions & 0 deletions network/vpc.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ resource "aws_vpc" "app_vpc" {

tags = {
Name = "${var.name}_${var.env}_app-vpc"
Environment = var.env
}
}

Expand All @@ -13,6 +14,7 @@ resource "aws_internet_gateway" "igw" {

tags = {
Name = "${var.name}_${var.env}_vpc_igw"
Environment = var.env
}
}

Expand All @@ -29,6 +31,7 @@ resource "aws_route_table" "public_rt" {

tags = {
Name = "${var.name}_${var.env}_public_rt"
Environment = var.env
}
}

0 comments on commit 3f3d5f0

Please sign in to comment.