Closed malparty closed 11 months ago
I like this clean up ๐งน
The question is why we need namespace
at all? I found only one usage at the moment: "name": "${namespace}",
, and probably this usage was missed during refactoring and it should be "name": "${env_namespace}",
in service.json.tfpl
.
Nice catch @Nihisil ๐
a89a771 โ
As for the question do we need it at all?
, I agree we could remove it:
locals {
namespace = "app-name"
env_namespace = "${namespace}-${var.environment}"
}`;
locals {
env_namespace = "app-name-${var.environment}"
}`;
I've done it in 3aee9bd but feel free to let me know which way you prefer (it's quick to rollback that small change ๐). Thanks ๐
Updated way looks great for me, I have only one remained thing. It looks like our security group is broken, it tries to read env namespace from local
, but it should be var
. It applies only to /modules/security_group/main.tf
file and all other places looks good.
Nice catch!! ๐คฏ Thanks, I've found that multiple security groups were actually declared in this file, this 107494d should fix them all ๐
Great work ๐ , but I brought you something new (pls don't hate me):
$ terraform validate
โท
โ Error: Invalid function argument
โ
โ on ../modules/ecs/main.tf line 35, in locals:
โ 35: container_definitions = templatefile("${path.module}/service.json.tftpl", local.container_vars)
โ โโโโโโโโโโโโโโโโโ
โ โ while calling templatefile(path, vars)
โ โ local.container_vars is object with 13 attributes
โ
โ Invalid value for "vars" parameter: vars map does not contain key "namespace", referenced at
โ ../modules/ecs/service.json.tftpl:19,37-46.
Great work ๐ , but I brought you something new (pls don't hate me):
$ terraform validate โท โ Error: Invalid function argument โ โ on ../modules/ecs/main.tf line 35, in locals: โ 35: container_definitions = templatefile("${path.module}/service.json.tftpl", local.container_vars) โ โโโโโโโโโโโโโโโโโ โ โ while calling templatefile(path, vars) โ โ local.container_vars is object with 13 attributes โ โ Invalid value for "vars" parameter: vars map does not contain key "namespace", referenced at โ ../modules/ecs/service.json.tftpl:19,37-46.
@malparty This might be the last place that we need to change ๐ https://github.com/nimblehq/infrastructure-templates/blob/develop/templates/addons/aws/modules/ecs/service.json.tftpl#L19
What happened ๐
namespace
to a local without the environmentenv_namespace
local that includes the environmentInsight ๐
I'm not sure about how could we add tests for this change, feel free to suggest anything ๐
Proof Of Work ๐น