Eiara / terraform_container_definitions

Module to provide a JSON-generator for AWS ECS container definitions in Terraform
MIT License
28 stars 7 forks source link

Terraform cannot convert object into []*ecs.ContainerDefinitions #1

Open eahrend opened 6 years ago

eahrend commented 6 years ago

Hey,

So I'm building out this container definition using your module

module "ecs_container_definition" {
  source                = "github.com/eiara/terraform_container_definitions"
  name                  = "${var.container_name}"
  image                 = "${local.container_image_url}"
  memory                = "${var.container_memory}"
  cpu                   = "${var.container_cpu}"
  port_mappings         = "${var.port_mappings}"
}

And the error I get with this is :

Go cannot deserialize object into []*ecs.ContainerDefinitions.

Terraform version : Terraform v0.11.7

I was able to mitigate this issue by changing main.tf

Original:

data "template_file" "_final" {
  template = <<JSON
  {
    $${val}
  }
JSON

Fixed:

data "template_file" "_final" {
  template = <<JSON
  [{
    $${val}
  }]
JSON
mig5 commented 6 years ago

Thanks, I confirm this worked for me too.