Skip to content

Commit 6513287

Browse files
committed
Remove all dependency on tfvars.
1 parent 9532edc commit 6513287

File tree

11 files changed

+338
-365
lines changed

11 files changed

+338
-365
lines changed

terraform/main.tf

Lines changed: 13 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
data "aws_caller_identity" "identity" {}
2+
13
terraform {
24
backend "s3" {
35
bucket = "${var.project_name}-${var.environment}-tfstate"
@@ -26,10 +28,7 @@ module "networking" {
2628

2729
project_name = var.project_name
2830
environment = var.environment
29-
vpc_cidr = var.vpc_cidr
3031
availability_zones = ["us-east-1a", "us-east-1b"]
31-
public_subnet_cidrs = var.public_subnet_cidrs
32-
private_subnet_cidrs = var.private_subnet_cidrs
3332
logging_key_id = module.logging.kms_key_arn
3433
}
3534

@@ -41,10 +40,6 @@ module "database" {
4140
environment = var.environment
4241
subnet_ids = module.networking.private_subnet_ids
4342
security_group_id = module.networking.rds_security_group_id
44-
instance_class = var.db_instance_class
45-
allocated_storage = var.db_allocated_storage
46-
db_name = var.db_name
47-
db_username = var.db_username
4843
}
4944

5045
# Redis for Sidekiq
@@ -55,8 +50,6 @@ module "cache" {
5550
environment = var.environment
5651
subnet_ids = module.networking.private_subnet_ids
5752
security_group_id = module.networking.redis_security_group_id
58-
node_type = var.redis_node_type
59-
port = var.redis_port
6053
}
6154

6255
# Deployment resources (ECR, GitHub Actions, Secrets)
@@ -65,22 +58,10 @@ module "deployment" {
6558

6659
project_name = var.project_name
6760
environment = var.environment
68-
github_repository = var.github_repository
6961

70-
db_username = var.db_username
7162
db_password_secret_arn = module.database.db_password_secret_arn
72-
db_endpoint = module.database.db_instance_endpoint
73-
db_name = var.db_name
74-
rails_master_key = var.rails_master_key
75-
aws_account_id = var.aws_account_id
63+
aws_account_id = data.aws_caller_identity.identity.account_id
7664
backend_kms_arn = module.backend.kms_key
77-
redis_url = format("redis://%s:%s",
78-
module.cache.redis_endpoint,
79-
module.cache.redis_port
80-
)
81-
secret_key_base = var.secret_key_base
82-
google_ai_key = var.google_ai_key
83-
anthropic_key = var.anthropic_key
8465
document_inference_lambda_arn = module.lambda.document_inference_lambda_arn
8566
document_inference_evaluation_lambda_arn = module.lambda.document_inference_evaluation_lambda_arn
8667
evaluation_lambda_arn = module.lambda.evaluation_lambda_arn
@@ -118,6 +99,14 @@ module "secrets" {
11899
secret_key = ""
119100
})
120101
}
102+
google = {
103+
description = "The Rails master key."
104+
name = "/asap-pdf/production/GOOGLE_AI_KEY"
105+
}
106+
anthropic = {
107+
description = "The Rails master key."
108+
name = "/asap-pdf/production/ANTHROPIC_KEY"
109+
}
121110
}
122111
}
123112

@@ -162,8 +151,8 @@ module "lambda" {
162151
document_inference_ecr_repository_url = module.deployment.document_inference_ecr_repository_url
163152
evaluation_ecr_repository_url = module.deployment.evaluation_ecr_repository_url
164153
document_inference_evaluation_ecr_repository_url = module.deployment.document_inference_evaluation_ecr_repository_url
165-
secret_google_ai_key_arn = module.deployment.gemini_key_secret_arn
166-
secret_anthropic_key_arn = module.deployment.anthropic_key_secret_arn
154+
secret_google_ai_key_arn = module.secrets.secrets["google"].secret_arn
155+
secret_anthropic_key_arn = module.secrets.secrets["anthropic"].secret_arn
167156
s3_document_bucket_arn = aws_s3_bucket.documents.arn
168157
}
169158

terraform/modules/cache/main.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ resource "aws_elasticache_parameter_group" "main" {
2929
resource "aws_elasticache_cluster" "main" {
3030
cluster_id = "${var.project_name}-${var.environment}"
3131
engine = "redis"
32-
node_type = var.node_type
32+
node_type = "cache.t3.micro"
3333
num_cache_nodes = 1
3434
parameter_group_name = aws_elasticache_parameter_group.main.name
35-
port = var.port
35+
port = 6379
3636
subnet_group_name = aws_elasticache_subnet_group.main.name
3737
security_group_ids = [var.security_group_id]
3838

terraform/modules/cache/variables.tf

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ variable "security_group_id" {
1818
type = string
1919
}
2020

21-
variable "node_type" {
22-
description = "ElastiCache node type"
23-
type = string
24-
}
25-
26-
variable "port" {
27-
description = "Port number for Redis"
28-
type = number
29-
default = 6379
30-
}
21+
# variable "node_type" {
22+
# description = "ElastiCache node type"
23+
# type = string
24+
# }
25+
#
26+
# variable "port" {
27+
# description = "Port number for Redis"
28+
# type = number
29+
# default = 6379
30+
# }

terraform/modules/database/main.tf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,11 @@ resource "aws_db_instance" "main" {
5151
identifier = "${var.project_name}-${var.environment}"
5252
engine = "postgres"
5353
engine_version = "14"
54-
instance_class = var.instance_class
55-
allocated_storage = var.allocated_storage
54+
instance_class = "db.t3.small"
55+
allocated_storage = 20
5656

57-
db_name = var.db_name
58-
username = var.db_username
57+
db_name = "access_pdf_production"
58+
username = "asap_pdf"
5959
password = random_password.db_password.result
6060

6161
db_subnet_group_name = aws_db_subnet_group.main.name

terraform/modules/database/variables.tf

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,22 @@ variable "security_group_id" {
1818
type = string
1919
}
2020

21-
variable "instance_class" {
22-
description = "RDS instance class"
23-
type = string
24-
}
21+
# variable "instance_class" {
22+
# description = "RDS instance class"
23+
# type = string
24+
# }
2525

26-
variable "allocated_storage" {
27-
description = "Allocated storage for RDS instance in GB"
28-
type = number
29-
}
26+
# variable "allocated_storage" {
27+
# description = "Allocated storage for RDS instance in GB"
28+
# type = number
29+
# }
3030

31-
variable "db_name" {
32-
description = "Name of the database"
33-
type = string
34-
}
31+
# variable "db_name" {
32+
# description = "Name of the database"
33+
# type = string
34+
# }
3535

36-
variable "db_username" {
37-
description = "Master username for the RDS instance"
38-
type = string
39-
}
36+
# variable "db_username" {
37+
# description = "Master username for the RDS instance"
38+
# type = string
39+
# }

0 commit comments

Comments
 (0)