Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: dev env #26

Merged
merged 2 commits into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 23 additions & 7 deletions aws/dev/backend/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,17 @@ data "aws_route53_zone" "hearchco_route53" {
## Lambda
### Random string for proxy salt
module "salt" {
source = "../../modules/backend/random"
source = "../../modules/universal/random"
}

### Random suffix for S3 source code name
module "s3_source_code_suffix" {
source = "../../modules/universal/random"

min_chars = 6
max_chars = 10
upper = false
special = false
}

### IAM for lambda execution and logging
Expand All @@ -35,6 +45,12 @@ module "lambda_iam" {
policy_name = "hearchco_api_logging"
}

### Archived source code for Lambda
module "hearchco_archiver" {
source = "../../modules/universal/archive_source_code"
filename = "bootstrap"
}

## Cloudfront
### us-east-1 region required for Cloudfront's certificate
provider "aws" {
Expand Down Expand Up @@ -65,14 +81,14 @@ module "hearchco_cloudfront" {

paths_cache = {
"/search" = {
min_ttl = 60 // 1 minute
default_ttl = 600 // 10 minutes
max_ttl = 3600 // 1 hour
min_ttl = 5 // 5 seconds
default_ttl = 300 // 5 minutes
max_ttl = 300 // 5 minutes
},
"/proxy" = {
min_ttl = 3600 // 1 hour
default_ttl = 86400 // 1 day
max_ttl = 259200 // 3 days
min_ttl = 300 // 5 minutes
default_ttl = 3600 // 15 days
max_ttl = 3600 // 1 hour
},
"/healthz" = {
min_ttl = 0
Expand Down
9 changes: 6 additions & 3 deletions aws/dev/backend/region_eu_central_1.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@ provider "aws" {
}

module "hearchco_s3_eu_central_1" {
source = "../../modules/universal/s3_source_code"
filename = "bootstrap"
bucket_name = "hearchco-api-binary"
source = "../../modules/universal/s3_source_code"
bucket_name = "hearchco-api-binary"
bucket_name_suffix = module.s3_source_code_suffix.string
filename = module.hearchco_archiver.filename
archive_path = module.hearchco_archiver.output_path
archive_base64sha256 = module.hearchco_archiver.output_base64sha256

providers = {
aws = aws.eu-central-1
Expand Down
6 changes: 3 additions & 3 deletions aws/dev/frontend/cloudfront.tf
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ module "hearchco_cloudfront" {

paths_cache = {
"/search" = {
min_ttl = 60 // 1 minute
default_ttl = 600 // 10 minutes
max_ttl = 3600 // 1 hour
min_ttl = 5 // 5 seconds
default_ttl = 300 // 5 minutes
max_ttl = 300 // 5 minutes
},
"/healthz" = {
min_ttl = 0
Expand Down
10 changes: 10 additions & 0 deletions aws/dev/frontend/lambda.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
module "s3_source_code_suffix" {
source = "../../modules/universal/random"

min_chars = 6
max_chars = 10
upper = false
special = false
}

module "hearchco_env_injection" {
source = "../../modules/frontend/env_injection"
environment = local.environment
Expand All @@ -13,6 +22,7 @@ module "hearchco_archiver" {
module "hearchco_s3_source_code" {
source = "../../modules/universal/s3_source_code"
bucket_name = "hearchco-ssr-function"
bucket_name_suffix = module.s3_source_code_suffix.string
filename = module.hearchco_archiver.filename
archive_path = module.hearchco_archiver.output_path
archive_base64sha256 = module.hearchco_archiver.output_base64sha256
Expand Down
14 changes: 12 additions & 2 deletions aws/dev/frontend/s3.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
module "s3_assets_suffix" {
source = "../../modules/universal/random"

min_chars = 6
max_chars = 10
upper = false
special = false
}

module "hearchco_s3_assets" {
source = "../../modules/frontend/s3_assets"
bucket_name = "hearchco-assets"
source = "../../modules/frontend/s3_assets"
bucket_name = "hearchco-assets"
bucket_name_suffix = module.s3_assets_suffix.string

providers = {
aws = aws.us-east-1-cdn
Expand Down
Loading