Clone this repo
git clone https://github.com/chnacib/terraform_module_ecs_fargate
cd terraform_module_ecs_fargate/module
Edit terrafile.tf
and replace variables in module
module "ecs_fargate" {
source = "../"
fargate_cpu = 512
fargate_memory = 1024
proj_name = "exemplo"
ecs_service_name = "svc-exemplo"
service_desired_count = 1
ecs_cluster_name = "cluster-exemplo"
task_name = "task-exemplo"
container_name = "container-exemplo"
container_port = 80
ecr_name = "repository-exemplo"
vpc_cidr = "10.0.0.0/16"
log_retention_days = 7
public_subnet_1_cidr = "10.0.1.0/24"
public_subnet_2_cidr = "10.0.2.0/24"
public_subnet_3_cidr = "10.0.3.0/24"
private_subnet_1_cidr = "10.0.11.0/24"
private_subnet_2_cidr = "10.0.22.0/24"
private_subnet_3_cidr = "10.0.33.0/24"
environment = [
{
"name" : "EXEMPLO1",
"value" : "exemplo1"
},
{
"name" : "EXEMPLO2",
"value" : "b"
}#Adicionar variáveis adicionando vírgula e chaves
]
}
Deploy terraform module
terraform init
terraform plan
terraform apply -auto-approve
Name | Version |
---|---|
aws | n/a |
Name | Source | Version |
---|---|---|
ecs_fargate | ../ | n/a |
Name | Description | Type | Default | Required |
---|---|---|---|---|
container_name | Container name | string |
n/a | yes |
container_port | Container port | number |
n/a | yes |
ecr_name | ECR repository name | string |
n/a | yes |
ecs_cluster_name | ECS Cluster name | string |
n/a | yes |
ecs_service_name | ECS service name | string |
n/a | yes |
environment | Container environment variable | any |
n/a | yes |
fargate_cpu | Task definition CPU | number |
n/a | yes |
fargate_memory | Task definition Memory | number |
n/a | yes |
log_retention_days | Cloudwatch logs retention days | number |
7 |
no |
private_subnet_1_cidr | Private subnet az1 CIDR | string |
n/a | yes |
private_subnet_2_cidr | Private subnet az2 CIDR | string |
n/a | yes |
private_subnet_3_cidr | Private subnet az3 CIDR | string |
n/a | yes |
proj_name | Project name | string |
n/a | yes |
public_subnet_1_cidr | Public subnet az1 CIDR | string |
n/a | yes |
public_subnet_2_cidr | Public subnet az2 CIDR | string |
n/a | yes |
public_subnet_3_cidr | Public subnet az3 CIDR | string |
n/a | yes |
region | AWS Region | string |
"us-east-1" |
no |
service_desired_count | Service desired count | number |
n/a | yes |
task_name | ECS Task definition name | string |
n/a | yes |
vpc_cidr | VPC CIDR | string |
n/a | yes |