Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: ECS Docker volume support #5523

Closed
russmac opened this issue Aug 12, 2018 · 9 comments · Fixed by #5727
Closed

Feature request: ECS Docker volume support #5523

russmac opened this issue Aug 12, 2018 · 9 comments · Fixed by #5727
Labels
enhancement Requests to existing resources that expand the functionality or scope. service/ecs Issues and PRs that pertain to the ecs service.
Milestone

Comments

@russmac
Copy link

russmac commented Aug 12, 2018

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

AWS has added support for docker volumes to be generated by task definition configuration on 09/08/2018: https://aws.amazon.com/about-aws/whats-new/2018/08/amazon-ecs-now-supports-docker-volume-and-volume-plugins/
Parameter details are here: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/docker-volumes.html

This expands the possible parameters in a volumes array to this:

"volumes": [
        {
            "name": "string",
            "host": {
                "sourcePath": "string"
            },
            "dockerVolumeConfiguration": {
                "scope": "string",
                "autoprovision": boolean,
                "driver": "string",
                "driverOpts": {
                    "key": "value"
                },
                "labels": {
                    "key": "value"
                }
            }
        }
    ]

This greatly streamlines provisioning of docker volumes in a Terraform ECS deployment.

New or Affected Resource(s)

  • aws_ecs_task_definition

Potential Terraform Configuration

resource "aws_ecs_task_definition" "service" {
  family                = "service"
  container_definitions = "${file("task-definitions/service.json")}"

  volume {
    name      = "service-storage"
    host_path = "/ecs/service-storage"
    docker_volume_configuration {
                driver              = "local"
                scope             = "shared"
                autoprovision = true,
                labels {
                    name = "service-storage"
                }
    }
  }
}

References

https://docs.aws.amazon.com/AmazonECS/latest/developerguide/docker-volumes.html

https://aws.amazon.com/about-aws/whats-new/2018/08/amazon-ecs-now-supports-docker-volume-and-volume-plugins/

@russmac russmac changed the title ECS Docker volume support Feature request: ECS Docker volume support Aug 12, 2018
@radeksimko radeksimko added enhancement Requests to existing resources that expand the functionality or scope. service/ecs Issues and PRs that pertain to the ecs service. labels Aug 13, 2018
@bearfact
Copy link

👍

1 similar comment
@smartgreenga
Copy link

👍

@markphelps
Copy link

Are there any workarounds you have found in the mean time? Basically I want to be able to create a task definition that uses a persistent docker data volume, however the only thing I could find in the Terraform docs states:

ECS will create a nonpersistent data volume that starts empty and is deleted after the task has finished

Terraform noob here

@russmac
Copy link
Author

russmac commented Aug 23, 2018

@markphelps The current parameters allow you to;

  • Specify an existing Docker volume (which you have to provision yourself on the ECS instances the container has affinity to) however each instance will have a different volume.
  • Refer to an existing path in the container and use the lower performing Docker writable layer, Which is not persistent.

The new parameters would create a docker volume on the instance the task is launched or if "shared" set use an existing one (and not delete it when the task stops)

@ewilde
Copy link
Contributor

ewilde commented Aug 29, 2018

@russmac i've started working on this issue

@russmac
Copy link
Author

russmac commented Sep 3, 2018

@ewilde Thank you, I can use your PR as a guide to get started writing Go for the next feature I need.

ewilde added a commit to ewilde/terraform-provider-aws that referenced this issue Sep 7, 2018
Add support for docker volume configuration to ecs task definitions

Resolves hashicorp#5523

Signed-off-by: Edward Wilde <[email protected]>
@bflad bflad added this to the v1.36.0 milestone Sep 12, 2018
@bflad
Copy link
Contributor

bflad commented Sep 12, 2018

Initial support for this has been merged in and will be released with version 1.36.0 of the AWS provider, likely later today. 👍

@bflad
Copy link
Contributor

bflad commented Sep 13, 2018

This has been released in version 1.36.0 of the AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

@ghost
Copy link

ghost commented Apr 3, 2020

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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked and limited conversation to collaborators Apr 3, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Requests to existing resources that expand the functionality or scope. service/ecs Issues and PRs that pertain to the ecs service.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants