Skip to content

Commit

Permalink
Merge pull request #12: Chores: unique name for instance profile in b…
Browse files Browse the repository at this point in the history
…oth environments

Chores: unique name for instance profile in both environments
  • Loading branch information
IrezD authored Jan 8, 2024
2 parents 4e96e7a + b4e46b0 commit 0fe098b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
6 changes: 3 additions & 3 deletions terraform/ecs_capacity_provider.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
resource "aws_ecs_capacity_provider" "customProvider" {
name = "CustomEC2Provider"
name = var.capacity_provider_name

auto_scaling_group_provider {
auto_scaling_group_arn = aws_autoscaling_group.ASG_config.arn
Expand All @@ -15,12 +15,12 @@ resource "aws_ecs_capacity_provider" "customProvider" {
resource "aws_ecs_cluster_capacity_providers" "Provider_config" {
cluster_name = aws_ecs_cluster.fastapi-cluster.name

capacity_providers = ["CustomEC2Provider"]
capacity_providers = [var.capacity_provider_name]

default_capacity_provider_strategy {
base = 1
weight = 100
capacity_provider = "CustomEC2Provider"
capacity_provider = var.capacity_provider_name
}
}

Expand Down
3 changes: 2 additions & 1 deletion terraform/env/dev.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ secondary_region = "us-east-1"
env = "dev"
repo_name = "dev/irezd/fastapi"
ecs_service_name = "dev-fastapi-service"
fqdn = "test.fastapi.dennisowie.com"
fqdn = "test.fastapi.dennisowie.com"
capacity_provider_name = "CustomEC2Provider"
3 changes: 2 additions & 1 deletion terraform/env/prod.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ secondary_region = "us-east-1"
env = "prod"
repo_name = "irezd/fastapi"
ecs_service_name = "fastapi-service"
fqdn = "fastapi.dennisowie.com"
fqdn = "fastapi.dennisowie.com"
capacity_provider_name = "EC2Provider"
4 changes: 4 additions & 0 deletions terraform/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,8 @@ variable "ami_id" {
variable "instance_type" {
description = "Instance type for EC2"
default = "t2.micro"
}

variable "capacity_provider_name" {
description = "Name of EC2 capacity provider for ECS container"
}

0 comments on commit 0fe098b

Please sign in to comment.