cloudposse / terraform-aws-ecs-container-definition

Terraform module to generate well-formed JSON documents (container definitions) that are passed to the aws_ecs_task_definition Terraform resource
https://cloudposse.com/accelerate
Apache License 2.0
340 stars 245 forks source link

container depends_on cannot be unmarshalled into go struct #53

Closed julian-ott-emnify closed 4 years ago

julian-ott-emnify commented 4 years ago

prior to the refactoring to support terraform 0.12 native types the container_depends_on has been a "list" which got a list of maps. now it has the type list(string) which does not accept the map anymore.

is this intended?

julian-ott-emnify commented 4 years ago

here is the patch for the proposed change:

From 0c417255a4c6623db403d9977d49e71437fe9ba8 Mon Sep 17 00:00:00 2001
From: Julian Ott <julian.ott@emnify.com>
Date: Mon, 25 Nov 2019 11:36:45 +0100
Subject: [PATCH] Fix containerDependsOn complex type

* added possibility to specify containername and condition
---
 variables.tf | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/variables.tf b/variables.tf
index 28cb0cd..b809b46 100644
--- a/variables.tf
+++ b/variables.tf
@@ -183,7 +183,10 @@ variable "user" {
 }

 variable "container_depends_on" {
-  type        = list(string)
+  type        = list(object({
+    containerName = string
+    condition     = string
+  }))
   description = "The dependencies defined for container startup and shutdown. A container can contain multiple dependencies. When a dependency is defined for container startup, for container shutdown it is reversed"
   default     = null
 }
-- 
2.20.1 (Apple Git-117)
aknysh commented 4 years ago

@julian-ott-emnify thanks for reporting. This is a bug introduced by the TF 0.12 upgrader that was not caught. Needs to be fixed

niallgc commented 4 years ago

Just became a blocker for me too, fix would be much appreciated 👍 (Keep up the good work BTW - very useful TF modules!)

aknysh commented 4 years ago

addressed in https://github.com/cloudposse/terraform-aws-ecs-container-definition/releases/tag/0.22.0