Skip to content

Commit

Permalink
app: Update template-infra:app to version 0.15.1.post5.dev0+c92213c
Browse files Browse the repository at this point in the history
  • Loading branch information
nava-platform-bot committed Jan 17, 2025
1 parent 111d15e commit 7d9f351
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 91 deletions.
2 changes: 1 addition & 1 deletion .template-infra/app-app.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Changes here will be overwritten by Copier
_commit: v0.15.1-4-g7ad8136
_commit: v0.15.1-5-gc92213c
_src_path: ../template-infra
app_has_dev_env_setup: true
app_local_port: 3000
Expand Down
36 changes: 4 additions & 32 deletions infra/app/database/main.tf
Original file line number Diff line number Diff line change
@@ -1,18 +1,3 @@
data "aws_vpc" "network" {
tags = {
project = module.project_config.project_name
network_name = local.environment_config.network_name
}
}

data "aws_subnets" "database" {
tags = {
project = module.project_config.project_name
network_name = local.environment_config.network_name
subnet_type = "database"
}
}

locals {
# The prefix key/value pair is used for Terraform Workspaces, which is useful for projects with multiple infrastructure developers.
# By default, Terraform creates a workspace named “default.” If a non-default workspace is not created this prefix will equal “default”,
Expand All @@ -29,7 +14,6 @@ locals {

environment_config = module.app_config.environment_configs[var.environment_name]
database_config = local.environment_config.database_config
network_config = module.project_config.network_configs[local.environment_config.network_name]
}

terraform {
Expand Down Expand Up @@ -62,18 +46,6 @@ module "app_config" {
source = "../app-config"
}

data "aws_security_groups" "aws_services" {
filter {
name = "group-name"
values = ["${module.project_config.aws_services_security_group_name_prefix}*"]
}

filter {
name = "vpc-id"
values = [data.aws_vpc.network.id]
}
}

module "database" {
source = "../../modules/database"

Expand All @@ -87,9 +59,9 @@ module "database" {
migrator_username = local.database_config.migrator_username
schema_name = local.database_config.schema_name

vpc_id = data.aws_vpc.network.id
database_subnet_group_name = local.network_config.database_subnet_group_name
private_subnet_ids = data.aws_subnets.database.ids
aws_services_security_group_id = data.aws_security_groups.aws_services.ids[0]
vpc_id = module.network.vpc_id
database_subnet_group_name = module.network.database_subnet_group_name
private_subnet_ids = module.network.database_subnet_ids
aws_services_security_group_id = module.network.aws_services_security_group_id
is_temporary = local.is_temporary
}
5 changes: 5 additions & 0 deletions infra/app/database/network.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module "network" {
source = "../../modules/network/data"
project_name = module.project_config.project_name
name = local.environment_config.network_name
}
15 changes: 5 additions & 10 deletions infra/app/service/domain.tf
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
locals {
domain_config = local.environment_config.domain_config

hosted_zone_id = local.domain_config.domain_name != null ? data.aws_route53_zone.zone[0].zone_id : null
certificate_arn = local.domain_config.enable_https ? data.aws_acm_certificate.certificate[0].arn : null
}

data "aws_acm_certificate" "certificate" {
count = local.domain_config.enable_https ? 1 : 0
domain = local.domain_config.domain_name
}
module "domain" {
source = "../../modules/domain/data"

data "aws_route53_zone" "zone" {
count = local.domain_config.domain_name != null ? 1 : 0
name = local.domain_config.hosted_zone
hosted_zone = local.domain_config.hosted_zone
domain_name = local.domain_config.domain_name
enable_https = local.domain_config.enable_https
}
15 changes: 7 additions & 8 deletions infra/app/service/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -63,21 +63,20 @@ module "service" {

image_tag = local.image_tag

vpc_id = data.aws_vpc.network.id
public_subnet_ids = data.aws_subnets.public.ids
private_subnet_ids = data.aws_subnets.private.ids
vpc_id = module.network.vpc_id
public_subnet_ids = module.network.public_subnet_ids
private_subnet_ids = module.network.private_subnet_ids
aws_services_security_group_id = module.network.aws_services_security_group_id

domain_name = local.domain_config.domain_name
hosted_zone_id = local.hosted_zone_id
certificate_arn = local.certificate_arn
domain_name = module.domain.domain_name
hosted_zone_id = module.domain.hosted_zone_id
certificate_arn = module.domain.certificate_arn

cpu = local.service_config.cpu
memory = local.service_config.memory
desired_instance_count = local.service_config.desired_instance_count
enable_command_execution = local.service_config.enable_command_execution

aws_services_security_group_id = data.aws_security_groups.aws_services.ids[0]

file_upload_jobs = local.service_config.file_upload_jobs
scheduled_jobs = local.environment_config.scheduled_jobs

Expand Down
41 changes: 4 additions & 37 deletions infra/app/service/network.tf
Original file line number Diff line number Diff line change
@@ -1,38 +1,5 @@
locals {
network_config = module.project_config.network_configs[local.environment_config.network_name]
}

data "aws_vpc" "network" {
tags = {
project = module.project_config.project_name
network_name = local.environment_config.network_name
}
}

data "aws_subnets" "public" {
tags = {
project = module.project_config.project_name
network_name = local.environment_config.network_name
subnet_type = "public"
}
}

data "aws_subnets" "private" {
tags = {
project = module.project_config.project_name
network_name = local.environment_config.network_name
subnet_type = "private"
}
}

data "aws_security_groups" "aws_services" {
filter {
name = "group-name"
values = ["${module.project_config.aws_services_security_group_name_prefix}*"]
}

filter {
name = "vpc-id"
values = [data.aws_vpc.network.id]
}
module "network" {
source = "../../modules/network/data"
project_name = module.project_config.project_name
name = local.environment_config.network_name
}
6 changes: 3 additions & 3 deletions infra/app/service/notifications.tf
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ module "notifications_email_domain" {
count = local.notifications_config != null && !local.is_temporary ? 1 : 0
source = "../../modules/notifications-email-domain/resources"

domain_name = local.domain_config.domain_name
hosted_zone_id = local.hosted_zone_id
domain_name = module.domain.domain_name
hosted_zone_id = module.domain.hosted_zone_id
}

# If the app has `enable_notifications` set to true AND this *is* a temporary
Expand All @@ -30,7 +30,7 @@ module "existing_notifications_email_domain" {
count = local.notifications_config != null && local.is_temporary ? 1 : 0
source = "../../modules/notifications-email-domain/data"

domain_name = local.domain_config.domain_name
domain_name = module.domain.domain_name
}

# If the app has `enable_notifications` set to true, create a new email notification
Expand Down

0 comments on commit 7d9f351

Please sign in to comment.