GithubHelp home page GithubHelp logo

tintoy / docker-machine-driver-terraform Goto Github PK

View Code? Open in Web Editor NEW
11.0 2.0 4.0 461 KB

Docker Machine driver that uses Terraform for infrastructure provisioning

Home Page: https://asciinema.org/a/93410

License: MIT License

Makefile 4.74% Go 94.74% Shell 0.52%
docker-machine docker-machine-driver terraform

docker-machine-driver-terraform's Introduction

Terraform driver for Docker Machine

Do you use Docker Machine? Do you sometimes wish you had a little more control over the infrastructure it creates?

Well now you do :)

asciicast

If you can express it as a Terraform configuration, you can use it from Docker Machine.

Arguments

The driver accepts the following arguments:

  • --terraform-config (Required) - The path (or URL) of the Terraform configuration to use
  • --terraform-variable (Optional) - One or more items of the form "name=value" representing additional variables for the Terraform configuration
    For example: --terraform-variable variable1=foo --terraform-variable variable2=bar
  • --terraform-variables-from (Optional) - An optional file containing the JSON that represents additional variables for the Terraform configuration
  • --terraform-refresh (Optional) - A flag which, if specified, will cause the driver to refresh the configuration after applying it

Terraform configuration

The driver can work with a Terraform configuration in any of the following formats:

  • A single local .tf file
  • A single local .zip file containing 1 or more .tf files
  • A local directory containing 1 or more .tf files
  • A single remote .tf file (using HTTP)
  • A single remote .zip file containing 1 or more .tf files (using HTTP)

It will supply the following values to the configuration as variables (in addition to any supplied via --terraform-variables-file):

  • dm_client_ip - The public IP of the client machine (useful for configuring firewall rules)
  • dm_machine_name - The name of the Docker machine being created
  • dm_ssh_user - The SSH user name to use for authentication
  • dm_ssh_port - The SSH port to use
  • dm_ssh_public_key_file - The public SSH key file to use for authentication
  • dm_ssh_private_key_file - The private SSH key file to use for authentication
  • dm_onetime_password - An optional one-time password that can be used for scenarios such as bootstrapping key-based SSH authentication

It expects the following outputs from Terraform:

  • dm_machine_ip (Required) - The IP address of the target machine
  • dm_machine_ssh_username (Optional) - The SSH user name for authentication to the target machine
    If specified this overrides the variable of the same name that was passed in

Examples

Here are some examples for several different providers:

Rancher

Yes you can use this driver with Rancher :)

Unfortunately, at the moment it works best via the Rancher API because I haven't built a custom UI for it, so you may have issues supplying variable values to it (unless you can place the variables file in a folder on the rancher server). Eventually, the custom UI plugin will enable you to add and remove variables as required.

Installing the driver

Download the latest release and place the provider executable in the same directory as docker-machine executable (or somewhere on your PATH).

Building the driver

If you'd rather run from source, run make dev and then source ./use-dev-driver.sh. You're good to go :)

See CONTRIBUTING.md for more detailed information about building / modifying the driver.

docker-machine-driver-terraform's People

Contributors

tintoy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

docker-machine-driver-terraform's Issues

Can't specify a relative path for Terraform configuration source

This seems like a problem with go-getter.

If a relative path (e.g. main.tf or ./main.tf) is specified, then go-getter doesn't actually copy the file. If you change ./main.tf to $PWD/main.tf then it works.

Interestingly, if you try specifying . or $PWD then you get the error message "source path must be a file". But go-getter is configured to work with either files or directories.

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.