Giter Site home page Giter Site logo

tamsky / terraform-provider-compose2ecs Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jritsema/terraform-provider-compose2ecs

1.0 2.0 0.0 2.13 MB

A terraform plugin containing a datasource that can transform a docker compose file into an ecs task defnition

Shell 4.58% Go 95.42%

terraform-provider-compose2ecs's Introduction

terraform-provider-compose2ecs

A terraform plugin containing a datasource that can transform a docker compose file into an ecs task definition.

CircleCI

usage

Download and install the plugin, either by putting the binary next to your terraform binary or by addding it to your ~/.terraformrc as documented here.

$ wget -O /usr/local/bin/terraform/terraform-provider-compose2ecs https://github.com/jritsema/terraform-provider-compose2ecs/releases/download/0.1.1/ncd_darwin_amd64 && chmod +x /usr/local/bin/terraform/terraform-provider-compose2ecs

Now use it by declaring a data resource.

data "compose2ecs" "compose" {}

output "container_definitions" {
  value = "${data.compose2ecs.compose.container_definitions}"
}

Use it with an ECS task definition (aws_ecs_task_definition) resource.

data "compose2ecs" "compose" {}

resource "aws_ecs_task_definition" "app" {
  family                = "${var.app}"
  container_definitions = "${data.compose2ecs.compose.container_definitions}"
}

You can optionally specify compose_file if you want to override the default compose file name (defaults to docker-compose.yml). You can also optionally specify which subset of services from the compose file you want to include (defaults to all).

data "compose2ecs" "compose" {
  compose_file = "my-compose.yml"
  services     = ["web", "worker"]
}

where docker-compose.yml might look like...

version: "2"
services:  
  web:
    container_name: web
    image: 618440173123.dkr.ecr.us-east-1.amazonaws.com/web:$VERSION
    ports:
      - 80:80
    labels: 
      compose2ecs.hostPort: "0"
      compose2ecs.memoryReservation: "1000"

and the outputted container_definitions would be...

[
  {
    "Name": "web",    
    "Image": "618440173123.dkr.ecr.us-east-1.amazonaws.com/web:1.0",
    "MemoryReservation": 1000,
    "PortMappings": [
      {
        "ContainerPort": 80,
        "HostPort": 0
      }
    ]
  }
]

terraform-provider-compose2ecs's People

Contributors

jritsema avatar

Stargazers

Marc Tamsky avatar

Watchers

James Cloos avatar  avatar

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.