-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.tf
68 lines (56 loc) · 1.43 KB
/
main.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
terraform {
backend "s3" {
bucket = "terra-form"
dynamodb_table = "terra-form"
key = "shopit"
region = "ap-south-1"
}
}
provider "aws" {
access_key = var.AWS_ACCESS_KEY_ID
secret_key = var.AWS_SECRET_ACCESS_KEY
region = var.AWS_REGION
}
data "aws_vpc" "default_vpc" {
default = true
}
locals {
default_vpc_id = data.aws_vpc.default_vpc.id
}
module "s3" {
source = "./tfmodules/s3"
envs = {
"AWS_REGION" = var.AWS_REGION
}
}
module "dynamodb" {
source = "./tfmodules/dynamodb"
}
module "ecr" {
source = "./tfmodules/ecr"
others = {
"shopit_bucket_url" = module.s3.shopit_bucket_url
"default_item_image_name" = module.s3.default_item_image_name
}
envs = {
"AWS_REGION" = var.AWS_REGION
"ENV" = var.ENV
}
}
module "ecs" {
source = "./tfmodules/ecs"
others = {
"default_vpc_id" = local.default_vpc_id
"shopit_image_url" = module.ecr.shopit_image_url
}
envs = {
"AWS_ACCESS_KEY_ID" = var.AWS_ACCESS_KEY_ID
"AWS_SECRET_ACCESS_KEY" = var.AWS_SECRET_ACCESS_KEY
"AWS_REGION" = var.AWS_REGION
"ENV" = var.ENV
"PORT" = module.s3.shopit_port
"DEFAULT_ITEM_IMAGE_NAME" = module.s3.default_item_image_name
"AWS_S3_BUCKET" = module.s3.shopit_bucket_name
"AWS_DYNAMO_DB_ITEM_TABLE" = module.dynamodb.shopit_item_table_name
}
}