Skip to content
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

Merged
merged 2 commits into from
Oct 30, 2024
Merged

Conversation

golfdish
Copy link
Contributor

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.

},
{
"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)
Copy link
Contributor

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?

Copy link
Contributor Author

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
Copy link
Contributor

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
Copy link
Contributor

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."
Copy link
Contributor

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?

Copy link
Contributor Author

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.

@@ -14,6 +14,8 @@ locals {
}
]

service_discovery_namespace = format("%s%s", replace(var.deployment_name, "-", ""), "svc")
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants