Add dynamic resources naming and tfvars example

This commit is contained in:
mr-vercetti
2022-08-26 15:16:02 +02:00
parent ffdb539b4d
commit 86fa35e0a5
11 changed files with 59 additions and 47 deletions

View File

@ -1,5 +1,5 @@
resource "aws_security_group" "this" {
name = "demo-app-alb-sg"
name = "${var.PROJECT_NAME}-alb-sg"
vpc_id = var.VPC_ID
@ -20,20 +20,16 @@ resource "aws_security_group" "this" {
}
resource "aws_lb" "this" {
name = "demo-app-alb"
name = "${var.PROJECT_NAME}-alb"
internal = false
load_balancer_type = "application"
security_groups = [aws_security_group.this.id]
subnets = var.ALB_SUBNETS_IDS
tags = {
Project = var.PROJECT_TAG
}
}
resource "aws_lb_target_group" "this" {
name = "demo-app-alb-tg"
name = "${var.PROJECT_NAME}-alb-tg"
port = 80
protocol = "HTTP"
vpc_id = var.VPC_ID

View File

@ -1,8 +1,8 @@
variable "VPC_ID" {
variable "PROJECT_NAME" {
type = string
}
variable "PROJECT_TAG" {
variable "VPC_ID" {
type = string
}