Code Monkey home page Code Monkey logo

Comments (13)

chris-edwards-pub avatar chris-edwards-pub commented on July 17, 2024 1

Keep up the excellent work! :)

I'll remember the snake case form from now on.

from terraform-aws-ecs.

bryantbiggs avatar bryantbiggs commented on July 17, 2024

we will need a reproduction in order to help troubleshoot or fix

from terraform-aws-ecs.

chris-edwards-pub avatar chris-edwards-pub commented on July 17, 2024

Sure.. You'll have to supply your own subnet....

terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = ">= 4.66.1"
    }
  }
}

module "ecs_cluster" {
  source  = "terraform-aws-modules/ecs/aws"
  version = "5.11.0"

  cluster_name = "ecs-fargate-cluster-test"

  # Capacity provider
  fargate_capacity_providers = {
    FARGATE = {
      default_capacity_provider_strategy = {
        weight = 100
        base   = 1
      }
    }
  }

  services = {
    nginx-service = {
      cpu    = 512
      memory = 1024

      desired_count = 1

      enable_execute_command = true

      # Container definition(s)
      container_definitions = {

        nginx-1 = {
          cpu       = 256
          memory    = 512
          essential = true
          image     = "nginx:latest"

          readonly_root_filesystem = false

          memory_reservation = 100
        }

        nginx-2 = {
          cpu       = 256
          memory    = 512
          essential = true
          image     = "nginx:latest"

          volumesFrom = ["nginx-1"]

          readonly_root_filesystem = false

          memory_reservation = 100
        }

      }
      subnet_ids = ["subnet-XXXXXX"]
    }
  }
}

from terraform-aws-ecs.

bryantbiggs avatar bryantbiggs commented on July 17, 2024

don't you need more details than what you are providing in your config per the API spec https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_VolumeFrom.html ?

from terraform-aws-ecs.

chris-edwards-pub avatar chris-edwards-pub commented on July 17, 2024

from terraform-aws-ecs.

bryantbiggs avatar bryantbiggs commented on July 17, 2024

why are you specifiying this

volumesFrom = ["nginx-1"]

When your screen show shows it should look like this

volumesFrom = [{
  sourceContainer = "nginx-1"
  readOnly = false
}]

from terraform-aws-ecs.

chris-edwards-pub avatar chris-edwards-pub commented on July 17, 2024

I tried both and neither worked, i was just guessing at this point.

from terraform-aws-ecs.

chris-edwards-pub avatar chris-edwards-pub commented on July 17, 2024

I added the code exactly like you stated above and this was the terraform apply output and volumesFrom = []

+ resource "aws_ecs_task_definition" "this" {
      + arn                      = (known after apply)
      + arn_without_revision     = (known after apply)
      + container_definitions    = jsonencode(
            [
              + {
                  + cpu                    = 256
                  + environment            = []
                  + essential              = true
                  + image                  = "nginx:latest"
                  + interactive            = false
                  + linuxParameters        = {
                      + initProcessEnabled = true
                    }
                  + logConfiguration       = {
                      + logDriver = "awslogs"
                      + options   = {
                          + awslogs-group         = "/aws/ecs/nginx-service/nginx-1"
                          + awslogs-region        = "us-east-1"
                          + awslogs-stream-prefix = "ecs"
                        }
                    }
                  + memory                 = 512
                  + memoryReservation      = 100
                  + mountPoints            = []
                  + name                   = "nginx-1"
                  + portMappings           = []
                  + privileged             = false
                  + pseudoTerminal         = false
                  + readonlyRootFilesystem = false
                  + startTimeout           = 30
                  + stopTimeout            = 120
                  + systemControls         = []
                  + user                   = "0"
                  + volumesFrom            = []
                },
              + {
                  + cpu                    = 256
                  + environment            = []
                  + essential              = true
                  + image                  = "nginx:latest"
                  + interactive            = false
                  + linuxParameters        = {
                      + initProcessEnabled = true
                    }
                  + logConfiguration       = {
                      + logDriver = "awslogs"
                      + options   = {
                          + awslogs-group         = "/aws/ecs/nginx-service/nginx-2"
                          + awslogs-region        = "us-east-1"
                          + awslogs-stream-prefix = "ecs"
                        }
                    }
                  + memory                 = 512
                  + memoryReservation      = 100
                  + mountPoints            = []
                  + name                   = "nginx-2"
                  + portMappings           = []
                  + privileged             = false
                  + pseudoTerminal         = false
                  + readonlyRootFilesystem = false
                  + startTimeout           = 30
                  + stopTimeout            = 120
                  + systemControls         = []
                  + user                   = "0"
                  + volumesFrom            = []
                },
            ]
        )

from terraform-aws-ecs.

bryantbiggs avatar bryantbiggs commented on July 17, 2024

this is the correct syntax for your example:

volumes_from = [{
  sourceContainer = "nginx-1"
  readOnly = false
}]

from terraform-aws-ecs.

chris-edwards-pub avatar chris-edwards-pub commented on July 17, 2024

I swear I read the documentation here. I've spent two days on this. Your my hero today. Im sorry to have wasted your time.

Thanks,

Chris

from terraform-aws-ecs.

bryantbiggs avatar bryantbiggs commented on July 17, 2024

you're not wasting anyones time 😅 - which is why I added it to the examples. Its not great, but its something. This is an unfortunate side effect of not having the container definition fully in Terraform hashicorp/terraform-provider-aws#17988

The container definition is just a json blob sent to ECS, and thats why you see the camel casing. But Terraform uses the snake case form, and without the container definition fully defined in Terraform natively, we have that weird edge case where the two casings meet and its a confusing pain point for a lot of folks unfortunately

from terraform-aws-ecs.

antonbabenko avatar antonbabenko commented on July 17, 2024

This issue has been resolved in version 5.11.1 🎉

from terraform-aws-ecs.

github-actions avatar github-actions commented on July 17, 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-aws-ecs.

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.