-
Notifications
You must be signed in to change notification settings - Fork 45
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
Parameterize service discovery namespace #62
Conversation
}, | ||
{ | ||
"name" : "WORKFLOW_TEMPORAL_CLUSTER_NAMESPACE", | ||
"value" : var.temporal_cluster_config.namespace | ||
}, | ||
{ | ||
"name" : "WORKFLOW_TEMPORAL_CLUSTER_FRONTEND_HOST", | ||
"value" : var.temporal_cluster_config.host | ||
"value" : format("%s.%s", var.temporal_cluster_config.hostname, local.service_discovery_namespace) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did host
become hostname
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because Terraform only supports constants in defaults, and the original default value of temporal.retoolsvc
doesn't make sense anymore with the DNS name being dynamic.
count = var.workflows_enabled ? 1 : 0 | ||
name = "retoolsvc" | ||
resource "aws_service_discovery_private_dns_namespace" "retool_namespace" { | ||
count = (var.code_executor_enabled || var.workflows_enabled) ? 1 : 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice catch!
@@ -1,13 +1,13 @@ | |||
# namescape: temporal namespace to use for Retool Workflows. We recommend this is only used by Retool. | |||
# host: hostname for Temporal Frontend service | |||
# hostname: hostname for Temporal Frontend service |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah ok, answered my own question from before.
@@ -206,3 +206,7 @@ variable "task_propagate_tags" { | |||
default = "TASK_DEFINITION" | |||
} | |||
|
|||
variable "service_discovery_namespace" { | |||
type = string | |||
description = "Service discovery namespace DNS name for Retool ECS cluster." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this have a default?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be passed in from the calling module (aws_ecs), where it's computed as a local value.
modules/aws_ecs/locals.tf
Outdated
@@ -14,6 +14,8 @@ locals { | |||
} | |||
] | |||
|
|||
service_discovery_namespace = format("%s%s", replace(var.deployment_name, "-", ""), "svc") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should the default for this be var.service_discovery_namespace
?
Solves the issue of the service discovery namespace conflicting in the event you want to bring up more than one cluster in the same account using this module.