Skip to content

Commit

Permalink
Redefine variables
Browse files Browse the repository at this point in the history
  • Loading branch information
jeff-pedro committed Mar 9, 2024
1 parent 264d9b4 commit faba932
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 13 deletions.
16 changes: 8 additions & 8 deletions env/prod/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,18 @@ data "aws_ecr_repository" "repository" {
locals {
app_name = "aluraflix"
# VPC
vpc_id = module.vpc.vpc_id
vpc_cidr = "10.0.0.0/16"
vpc_subnets = module.vpc.subnets
vpc_azs = slice(data.aws_availability_zones.available.names, 0, 2)
vpc_id = module.vpc.vpc_id
vpc_cidr = "10.0.0.0/16"
vpc_subnets = module.vpc.subnets
vpc_azs = slice(data.aws_availability_zones.available.names, 0, 2)

# Security Groups
sg_allow_http = module.vpc.sg_allow_http_id
sg_dafault = module.vpc.sg_default_id

# Auto Scalling
asg_arn = module.ec2.asg_arn
asg_arn = module.ec2.asg_arn

# Load Balancer
lb_target_group = module.ec2.lb_target_group
}
Expand Down
4 changes: 2 additions & 2 deletions infra/ecs/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ resource "aws_ecs_cluster" "cluster" {
}

resource "aws_ecs_capacity_provider" "capacity_provider" {
name = "capacity-provider-${var.name}"
name = var.capacity_name

auto_scaling_group_provider {
auto_scaling_group_arn = var.asg_arn
Expand Down Expand Up @@ -76,7 +76,7 @@ resource "aws_ecs_task_definition" "ecs_task_definition" {
}

resource "aws_ecs_service" "service" {
name = "service-${var.name}"
name = var.service_name
cluster = aws_ecs_cluster.cluster.id
task_definition = aws_ecs_task_definition.ecs_task_definition.arn
desired_count = 2
Expand Down
15 changes: 12 additions & 3 deletions infra/ecs/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,18 @@ variable "container_name" {
type = string
}

variable "cluster_name" {
type = string
}

variable "capacity_name" {
type = string
}

variable "service_name" {
type = string
}

variable "asg_arn" {
type = string
}
Expand All @@ -29,6 +41,3 @@ variable "subnets" {
default = null
}

variable "cluster_name" {
type = string
}

0 comments on commit faba932

Please sign in to comment.