Giter VIP home page Giter VIP logo

[Bug]: ECS Task Definition container_definitions is invalid: decoding JSON: json: cannot unmarshal string into Go struct field PortMapping.PortMappings.ContainerPort of type int64 about terraform-provider-aws HOT 4 CLOSED

tdupoiron avatar tdupoiron commented on September 27, 2024 1
[Bug]: ECS Task Definition container_definitions is invalid: decoding JSON: json: cannot unmarshal string into Go struct field PortMapping.PortMappings.ContainerPort of type int64

from terraform-provider-aws.

Comments (4)

trevorrea avatar trevorrea commented on September 27, 2024 1

Hi there,

I can't comment on your particular bug but it would be easier to accomplish what you're doing by using jsonencode for the container defintion rather than a templatefile

e.g.

container_definitions = jsonencode([
  {
    name      = var.webapp_name,
    image     = var.webapp_image
    essential = true
    environment = [
      {
        name  = "VARIABLE"
        value = var.variable_value
      }
    ]
    linuxParameters = {
      initProcessEnabled = true
    }
    logConfiguration = {
      logDriver = "awslogs"
      options = {
        awslogs-group         = "${local.resource_prefix}-${var.webapp_name}"
        awslogs-region        = data.aws_region.current.name
        awslogs-stream-prefix = var.webapp_name
      }
    }
    portMappings = [
      {
        containerPort = var.webapp_port
        protocol      = "tcp"
      }
    ]
    ulimits = [
      {
        softLimit = 32768,
        hardLimit = 32768,
        name      = "nofile"
      }
    ]
  }
])

from terraform-provider-aws.

github-actions avatar github-actions commented on September 27, 2024

Community Note

Voting for Prioritization

  • Please vote on this issue by adding a 👍 reaction to the original post to help the community and maintainers prioritize this request.
  • Please see our prioritization guide for information on how we prioritize.
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.

Volunteering to Work on This Issue

  • If you are interested in working on this issue, please leave a comment.
  • If this would be your first contribution, please review the contribution guide.

from terraform-provider-aws.

justinretzolk avatar justinretzolk commented on September 27, 2024

Hey @tdupoiron 👋 Thank you for taking the time to raise this! In this case, I'd definitely recommend using jsonencode(), as mentioned above. Outside of that, this looks like an error related to the configuration / template rather than a bug with the provider. If you'd like to troubleshoot the templatefile() method further, you'd be better served at the AWS Provider forum, where there's a network of people willing to help. With that in mind, I'm going to close this issue.

from terraform-provider-aws.

github-actions avatar github-actions commented on September 27, 2024

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

from terraform-provider-aws.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.