-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.tf
More file actions
64 lines (54 loc) · 1.38 KB
/
main.tf
File metadata and controls
64 lines (54 loc) · 1.38 KB
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
terraform {
required_version = ">= 1.0"
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 5.0"
}
}
}
provider "aws" {
region = var.aws_region
default_tags {
tags = local.common_tags
}
}
locals {
common_tags = {
Environment = var.environment
Project = var.project_name
ManagedBy = "Terraform"
CreatedAt = timestamp()
}
}
# DynamoDB Module
module "dynamodb" {
source = "./modules/dynamodb"
environment = var.environment
common_tags = local.common_tags
}
# IAM Module
module "iam" {
source = "./modules/iam"
environment = var.environment
dynamodb_table_arn = module.dynamodb.table_arn
common_tags = local.common_tags
}
# API Gateway Module
module "api_gateway" {
source = "./modules/api-gateway"
environment = var.environment
lambda_invoke_arn = module.lambda.function_invoke_arn
common_tags = local.common_tags
}
# Lambda Module
module "lambda" {
source = "./modules/lambda"
environment = var.environment
lambda_role_arn = module.iam.lambda_role_arn
dynamodb_table_name = module.dynamodb.table_name
api_gateway_execution_arn = module.api_gateway.execution_arn
lambda_funtion_dir = var.lambda_funtion_dir
common_tags = local.common_tags
# depends_on = [module.api_gateway]
}