-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.tf
134 lines (116 loc) · 4.68 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "5.70.0"
}
pinecone = {
source = "pinecone-io/pinecone"
}
}
}
provider "aws" {
region = var.region
}
provider "pinecone" {
api_key = var.pinecone_api_key
}
module "s3" {
source = "./s3"
lambda_arn = module.lambda.document_ingestion_executor_arn
lambda_zip_file_path = module.lambda.document_ingestion_zip_output_path
lambda_zip_name = module.lambda.document_ingestion_zip_id
}
module "secrets_manager" {
source = "./secrets_manager"
pinecone_api_key = var.pinecone_api_key
kb_name = module.iam.bedrock_kb_role_name
bedrock_user_access_key_id = module.bedrock.bedrock_user_access_key_id
bedrock_user_access_key_secret = module.bedrock.bedrock_user_access_key_secret
anthropic_api_key = var.anthropic_api_key
ecs_execution_role_name = module.ecs.ecs_execution_role_name
ecs_task_role_name = module.ecs.ecs_task_role_name
}
module "iam" {
source = "./iam"
region = var.region
kb_source_bucket_arn = module.s3.kb_bucket_arn
pinecone_secret_arn = module.secrets_manager.pinecone_secret_arn
embeddings_model_arn = module.bedrock.embeddings_model_arn
knowledge_base_arn = module.bedrock.knowledge_base_arn
sns_topic_arn = module.sns.sns_topic_arn
}
module "pinecone" {
source = "./pinecone_vectorDB"
pinecone_environment = var.pinecone_environment
}
module "bedrock" {
source = "./bedrock_knowledge_base"
embeddings_model = var.embeddings_model
knowledge_base_role_arn = module.iam.bedrock_kb_role_arn
pinecone_connection_string = module.pinecone.pinecone_host
pinecone_credential_secret_arn = module.secrets_manager.pinecone_secret_arn
source_bucket_arn = module.s3.kb_bucket_arn
source_bucket_prefix = module.s3.knowledge_files_folder_key
iam_policy_attachment_id = module.iam.iam_policy_attachment_id
region = var.region
}
module "lambda" {
source = "./lambda"
data_source_id = module.bedrock.knowledge_base_data_source_id
knowledge_base_id = module.bedrock.knowledge_base_id
s3_bucket_arn = module.s3.kb_bucket_arn
s3_bucket_id = module.s3.kb_bucket_id
tf_lambda_executor_role = module.iam.lambda_document_ingestion_arn
lambda_results_sns_topic = module.sns.sns_topic_arn
api_gateway_execution_arn = module.api_gateway.api_gateway_execution_arn
aws_access_key_id = module.bedrock.bedrock_user_access_key_id
aws_region = var.region
aws_secret_access_key = module.bedrock.bedrock_user_access_key_secret
kb_request_processor_role = module.iam.lambda_request_processor_arn
}
module "sns" {
source = "./sns"
email_address = var.default_email_address
}
module "github" {
source = "./github"
aws_region = var.region
ecr_repository_arn = module.ecr.ecr_repository_arn
github_token = var.github_token
owner = var.github_repo_owner
knowledge_base_bucket_arn = module.s3.kb_bucket_arn
github_repositories = var.github_repositories
}
module "ecr" {
source = "./ecr"
aws_region = var.region
image_tag = var.aws_environment
}
module "ssm_parameter_store" {
source = "./ssm_parameter_store"
bedrock_kb_id = module.bedrock.knowledge_base_id
bedrock_kb_name = module.bedrock.knowledge_base_name
ecr_registry_id = module.ecr.ecr_registry_id
ecr_repository_name = module.ecr.ecr_repository_name
ecr_repository_arn = module.ecr.ecr_repository_arn
anthropic_api_key = var.anthropic_api_key
bedrock_user_access_key_id = module.bedrock.bedrock_user_access_key_id
bedrock_user_access_key_secret = module.bedrock.bedrock_user_access_key_secret
s3_bucket_name = module.s3.kb_bucket_id
}
module "ecs" {
source = "./ecs"
availability_zone = ["${var.region}a", "${var.region}b", "${var.region}c"]
aws_region = var.region
bedrock_kb_arn = module.bedrock.knowledge_base_arn
cidr_block = "10.0.0.0/16"
ecr_repository_arn = module.ssm_parameter_store.ecr_repository_arn
ecr_repository_name = module.ssm_parameter_store.ecr_repository_name
subnet_cidr_block = ["10.0.1.0/24", "10.0.2.0/24", "10.0.3.0/24"]
bedrock_user = module.bedrock.bedrock_user_arn
}
module "api_gateway" {
source = "./api_gateway"
request_processor_invoke_arn = module.lambda.request_processor_invoke_arn
}