Skip to content

Commit eb350a6

Browse files
authored
feat: Added load balancer log exports. (#10)
1 parent 8db0990 commit eb350a6

File tree

5 files changed

+33
-19
lines changed

5 files changed

+33
-19
lines changed

tofu/config/development/infra/.terraform.lock.hcl

Lines changed: 13 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tofu/config/development/infra/main.tf

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,13 @@ module "app" {
6666
)
6767

6868
# If we're using one of our shared domain, put the application under a
69-
# subdomain of its own.
70-
subdomain = try(each.value.domain, null) != null ? null : each.key
69+
# subdomain of its own unless the subdomain is explicitly set.
70+
subdomain = try(
71+
each.value.subdomain,
72+
try(each.value.domain, null) != null ? null : each.key
73+
)
7174

75+
logging_bucket = module.logging.bucket
7276
logging_key_arn = module.logging.kms_key_arn
7377
vpc_id = module.vpc.vpc_id
7478
private_subnets = module.vpc.private_subnets

tofu/modules/app/local.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ locals {
33
for lambda in data.aws_lambda_functions.all.function_names :
44
lambda if length(regexall("^DatadogIntegration-ForwarderStack-", lambda)) > 0
55
]
6-
domain_prefix = "${var.subdomain == null ? "" : ".${var.subdomain}"}${local.production ? "" : ".${var.environment}"}"
6+
domain_prefix = var.subdomain == null ? "" : var.subdomain
77
log_groups = setunion(
88
data.aws_cloudwatch_log_groups.ecs.log_group_names,
99
data.aws_cloudwatch_log_groups.ecs_insights.log_group_names,

tofu/modules/app/main.tf

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module "secrets" {
2-
source = "github.com/codeforamerica/tofu-modules-aws-secrets?ref=1.0.0"
2+
source = "github.com/codeforamerica/tofu-modules-aws-secrets?ref=secret-name"
33

44
project = var.project
55
environment = var.environment
@@ -33,9 +33,14 @@ module "service" {
3333
service_short = try(each.value.short_name, each.key)
3434
desired_containers = try(each.value.desired_containers, local.production ? 2 : 1)
3535
health_check_path = try(each.value.health_check_path, "/health")
36+
logging_bucket = var.logging_bucket
3637

37-
domain = var.domain
38-
subdomain = "${try(each.value.subdomain, "www")}${local.domain_prefix}"
38+
domain = var.domain
39+
subdomain = join(".", compact([try(each.value.subdomain, null), local.domain_prefix]))
40+
create_repository = try(each.value.image, null) == null
41+
image_url = try(each.value.image, "")
42+
repository_arn = try(each.value.repository_arn, null)
43+
image_tag = try(each.value.image_tag, "latest")
3944
force_delete = !local.production
4045
oidc_settings = local.oidc_settings
4146

tofu/modules/app/variables.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ variable "internal" {
2626
default = true
2727
}
2828

29+
variable "logging_bucket" {
30+
description = "The S3 bucket used for logging."
31+
type = string
32+
}
33+
2934
variable "logging_key_arn" {
3035
description = "The ARN of the KMS key used for logging."
3136
type = string

0 commit comments

Comments
 (0)