Skip to content

Commit

Permalink
multiple minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jdbass committed May 12, 2024
1 parent 8a6b29e commit d73dcaf
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 31 deletions.
24 changes: 12 additions & 12 deletions tofu/environments/stage/data-store/cache/.terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion tofu/environments/stage/data-store/database/terragrunt.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ dependency "vpc" {
mock_outputs = {
vpc_id = "mock_vpc_id"
database_subnet_group = "mock_subnet_group"
database_subnets = []

}
}
Expand Down Expand Up @@ -56,7 +57,8 @@ inputs = {
name_prefix = local.name_prefix
region = local.region
vpc = dependency.vpc.outputs.vpc_id
subnet_group = dependency.vpc.outputs.database_subnet_group
subnet_group = local.name_prefix //dependency.vpc.outputs.database_subnet_group
database_subnets = dependency.vpc.outputs.database_subnets
elasticache_security_group = dependency.cache.outputs.security_group_id
backend_security_group = dependency.backend.outputs.security_group_id
database_secret = "arn:aws:secretsmanager:us-east-1:768512802988:secret:tb-apmt-stage-db-secret-V0syHj"
Expand Down
24 changes: 12 additions & 12 deletions tofu/environments/stage/services/frontend/.terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions tofu/modules/data-store/database/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ module "db" {

enabled_cloudwatch_logs_exports = ["audit", "error", "general", "slowquery"]

create_db_subnet_group = true
subnet_ids = var.database_subnets

# DB parameter group
family = "mysql8.0"

Expand Down
5 changes: 5 additions & 0 deletions tofu/modules/data-store/database/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ variable "subnet_group" {
type = string
}

variable "database_subnets" {
description = "DB subnets ids"
type = list
}

variable "elasticache_security_group" {
description = "Elasticache security group"
type = string
Expand Down
2 changes: 1 addition & 1 deletion tofu/modules/network/vpc/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module "vpc" {
public_subnets = [for k, v in local.azs : cidrsubnet("${var.vpc_cidr}", 8, k + 254)]
database_subnets = [for k, v in local.azs : cidrsubnet("${var.vpc_cidr}", 8, k + 2)]

create_database_subnet_group = true
create_database_subnet_group = false
manage_default_network_acl = false
manage_default_route_table = false
manage_default_security_group = false
Expand Down
10 changes: 5 additions & 5 deletions tofu/modules/services/frontend/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ resource "aws_cloudfront_distribution" "appointment" {

function_association {
event_type = "viewer-request"
function_arn = aws_cloudfront_function.rewrite_api.arn
function_arn = aws_cloudfront_function.rewrite.arn
}

viewer_protocol_policy = "redirect-to-https"
Expand All @@ -146,7 +146,7 @@ resource "aws_cloudfront_distribution" "appointment" {

function_association {
event_type = "viewer-request"
function_arn = aws_cloudfront_function.rewrite_api.arn
function_arn = aws_cloudfront_function.rewrite.arn
}

viewer_protocol_policy = "redirect-to-https"
Expand All @@ -164,7 +164,7 @@ resource "aws_cloudfront_distribution" "appointment" {

function_association {
event_type = "viewer-request"
function_arn = aws_cloudfront_function.rewrite_api.arn
function_arn = aws_cloudfront_function.rewrite.arn
}

viewer_protocol_policy = "redirect-to-https"
Expand Down Expand Up @@ -192,8 +192,8 @@ resource "aws_cloudfront_origin_access_control" "oac" {
signing_protocol = "sigv4"
}

resource "aws_cloudfront_function" "rewrite_api" {
name = "${var.name_prefix}-rewrite-api"
resource "aws_cloudfront_function" "rewrite" {
name = "${var.name_prefix}-rewrite"
runtime = "cloudfront-js-2.0"
code = <<EOT
async function handler(event) {
Expand Down

0 comments on commit d73dcaf

Please sign in to comment.