Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add terraform specs for the service deployment
- Loading branch information
1 parent
6652c05
commit 1c91302
Showing
8 changed files
with
136 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
*.zip | ||
|
||
# Terraform | ||
**/.terraform/* | ||
.terraform.* | ||
*.tfstate | ||
*.tfstate.* | ||
crash.log | ||
variables.tfvars | ||
override.tf | ||
override.tf.json | ||
*_override.tf | ||
*_override.tf.json | ||
*terraform.tfvars | ||
.terraform.lock.hcl | ||
*plan.json | ||
**/.terraform.lock.hcl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
env = "staging" | ||
|
||
# Allow to replicate app docker images to these accounts | ||
ecr_replication_targets = [ | ||
{ | ||
"account_id" = "274425519734", | ||
"region" = "eu-central-1" | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
env = "prod" | ||
|
||
# Allow to replicate app docker images from this account | ||
ecr_replication_origin = "244531986313" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
module "ecs-service" { | ||
source = "s3::https://s3-eu-central-1.amazonaws.com/terraform-modules-9d7e951c290ec5bbe6506e0ddb064808764bc636/terraform-modules.zip//ecs-service/v1" | ||
service_name = var.service_name | ||
TAGGED_IMAGE = var.TAGGED_IMAGE | ||
enable_execute_command = "true" | ||
app_port = var.app_port | ||
cpu_limit = var.cpu_limit | ||
mem_reservation = var.mem_reservation | ||
mem_limit = var.mem_limit | ||
app_env_vars = local.app_env_vars | ||
ecr_replication_targets = var.ecr_replication_targets | ||
ecr_replication_origin = var.ecr_replication_origin | ||
tags = module.tags.result | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
locals { | ||
app_env_vars = [ | ||
for key, value in var.app_env_vars : { | ||
name = key | ||
value = value | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
terraform { | ||
backend "s3" {} | ||
} | ||
|
||
provider "aws" { | ||
alias = "eu-central-1" | ||
region = "eu-central-1" | ||
} | ||
|
||
module "tags" { | ||
source = "fivexl/tag-generator/aws" | ||
version = "2.0.0" | ||
prefix = "merkely" | ||
terraform_managed = "1" | ||
environment_name = var.env | ||
data_owner = "merkely" | ||
data_pci = "0" | ||
data_phi = "0" | ||
data_pii = "0" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
variable "service_name" { | ||
type = string | ||
default = "languages-start-points" | ||
} | ||
|
||
variable "env" { | ||
type = string | ||
} | ||
|
||
variable "app_port" { | ||
type = number | ||
default = 4524 | ||
} | ||
|
||
variable "cpu_limit" { | ||
type = number | ||
default = 20 | ||
} | ||
|
||
variable "mem_limit" { | ||
type = number | ||
default = 64 | ||
} | ||
|
||
variable "mem_reservation" { | ||
type = number | ||
default = 32 | ||
} | ||
|
||
variable "TAGGED_IMAGE" { | ||
type = string | ||
} | ||
|
||
# App variables | ||
variable "app_env_vars" { | ||
type = map(any) | ||
default = { | ||
CYBER_DOJO_PROMETHEUS = "false" | ||
CYBER_DOJO_LANGUAGES_START_POINTS_PORT = "4524" | ||
} | ||
} | ||
|
||
variable "ecr_replication_targets" { | ||
type = list(map(string)) | ||
default = [] | ||
} | ||
|
||
variable "ecr_replication_origin" { | ||
type = string | ||
default = "" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
terraform { | ||
required_version = ">= 0.14" | ||
required_providers { | ||
aws = { | ||
source = "hashicorp/aws" | ||
version = "~> 4.16.0" | ||
} | ||
random = { | ||
source = "hashicorp/random" | ||
version = "3.3.1" | ||
} | ||
} | ||
} |