-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.tf
77 lines (64 loc) · 3.33 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
69
70
71
72
73
74
75
76
77
module "config" {
source = "[email protected]:GirishCodeAlchemy/terraform-config.git"
}
module "lambda" {
source = "[email protected]:GirishCodeAlchemy/terraform-lambda-module.git"
for_each = module.config.lambda_configmap
resource_name_prefix = local.resource_name_prefix
image_uri = try(each.value.image_uri, null)
package_type = try(each.value.package_type, "Image")
vpc_id = each.value.vpc_id
environment_variables = try(each.value.environment_variables, null)
lambda_name = each.key
lambda_handler = each.value.lambda_handler
lambda_description = each.value.lambda_description
managed_policy_arns = each.value.managed_policy_arns
lambda_has_inline_policy = try(each.value.lambda_has_inline_policy, false)
lambda_inline_policy = try(each.value.lambda_inline_policy, null)
schedule_time_trigger = try(each.value.schedule_time_trigger, null)
aws_lambda_permission = try(each.value.aws_lambda_permission, [])
lambda_assume_role_policy = try(each.value.lambda_assume_role_policy, null)
timeout = try(each.value.timeout, 3)
memory_size = try(each.value.memory_size, 128)
source_path = try(each.value.source_path, null)
runtime = try(each.value.runtime, "python3.10")
auto_update_function_image = try(each.value.auto_update_function_image, false)
tags = try(each.value.tags, {})
architectures = try(each.value.architectures, ["x86_64"])
sg_rules = try(each.value.sg_rules, [])
}
module "ec2" {
source = "[email protected]:GirishCodeAlchemy/terraform-ec2-module.git"
for_each = module.config.ec2_configmap
resource_name_prefix = local.resource_name_prefix
ami = each.value.ami
instance_type = each.value.instance_type
key_name = each.value.key_name
subnet_id = each.value.subnet_id
vpc_id = each.value.vpc_id
ec2_name = each.key
sg_rules = each.value.sg_rules
user_data_path = try(each.value.user_data_path, null)
ebs_size = try(each.value.ebs_size, null)
root_volume_size = try(each.value.root_volume_size, null)
}
module "api_gateway" {
source = "[email protected]:GirishCodeAlchemy/terraform-apigateway-module.git"
for_each = module.config.apigateway_configmap
resource_name_prefix = local.resource_name_prefix
api_name = each.key
managed_policy_arns = each.value.managed_policy_arns
api_gateway_inline_policy = try(each.value.api_gateway_inline_policy, null)
uri = each.value.uri
path_part = each.value.path_part
region = each.value.region
account_id = each.value.account_id
integration_type = each.value.integration_type
lambda_function = each.value.lambda_function
gateway_method = each.value.gateway_method
stage_name = module.config.environment_config_map.environment
request_parameters = try(each.value.request_parameters, null)
request_templates = try(each.value.request_templates, null)
passthrough_behavior = each.value.passthrough_behavior
depends_on = [module.lambda]
}