Skip to content

Commit

Permalink
fix: API Redis URL add protocol and port (#802)
Browse files Browse the repository at this point in the history
Update the API ECS task's REDIS_URL environment variable to
include the protocol and port.
  • Loading branch information
patheard authored Sep 4, 2024
1 parent 0530fe5 commit ab6a87e
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 7 deletions.
2 changes: 1 addition & 1 deletion aws/api/ecs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ locals {
},
{
name = "REDIS_URL"
value = var.redis_url
value = "redis://${var.redis_url}:${var.redis_port}"
}
]

Expand Down
7 changes: 6 additions & 1 deletion aws/api/inputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,13 @@ variable "private_subnet_ids" {
type = list(string)
}

variable "redis_port" {
description = "Redis port used by the ECS task"
type = number
}

variable "redis_url" {
description = "Redis URL used by the ECS task"
description = "Redis URL used by the ECS task. This should not include the protocol or port."
type = string
}

Expand Down
5 changes: 5 additions & 0 deletions aws/redis/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
output "redis_port" {
description = "The Redis port"
value = aws_elasticache_replication_group.redis.port
}

output "redis_url" {
description = "The Redis endpoint URL"
value = aws_elasticache_replication_group.redis.primary_endpoint_address
Expand Down
12 changes: 7 additions & 5 deletions env/cloud/api/terragrunt.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ dependency "redis" {
mock_outputs_merge_strategy_with_state = "shallow"
mock_outputs_allowed_terraform_commands = ["init", "fmt", "validate", "plan", "show"]
mock_outputs = {
redis_url = "mock-redis-url.0001.cache.amazonaws.com"
redis_port = 6379
redis_url = "mock-redis-url.0001.cache.amazonaws.com"
}
}

Expand Down Expand Up @@ -104,11 +105,12 @@ inputs = {
lb_target_group_arn_api_ecs = dependency.load_balancer.outputs.lb_target_group_api_arn
private_subnet_ids = dependency.network.outputs.private_subnet_ids

kms_key_dynamodb_arn = dependency.kms.outputs.kms_key_dynamodb_arn
dynamodb_vault_arn = dependency.dynamodb.outputs.dynamodb_vault_arn
s3_vault_file_storage_arn = dependency.s3.outputs.vault_file_storage_arn
kms_key_dynamodb_arn = dependency.kms.outputs.kms_key_dynamodb_arn
dynamodb_vault_arn = dependency.dynamodb.outputs.dynamodb_vault_arn
s3_vault_file_storage_arn = dependency.s3.outputs.vault_file_storage_arn

redis_url = dependency.redis.outputs.redis_url
redis_port = dependency.redis.outputs.redis_port
redis_url = dependency.redis.outputs.redis_url

zitadel_domain = local.zitadel_domain
zitadel_application_key_secret_arn = dependency.secrets.outputs.zitadel_application_key_secret_arn
Expand Down

0 comments on commit ab6a87e

Please sign in to comment.