terraform-provider-dockermachine

command module
v0.0.0-...-a718ec7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 1, 2018 License: Apache-2.0 Imports: 22 Imported by: 0

README

terraform-provider-dockermachine

Docker machine provider for Terraform

Go Report Card Build Status

Requisites

Note: docker-machine is not required as its library is embedded into the provider.

Install

$ go get github.com/gstruct/terraform-provider-dockermachine

Usage

This provider makes available to Terraform all the docker-machine drivers as resources named "dockermachine_<drivername>".
All the creation flags of each driver (common or specific) are available as attributes of the resource, with dash characters ("-") replaced by underlines ("_").
Furthermore, the following computed attributes are available:

  • address: IP address of the docker machine
  • docker_url: URL of the docker daemon
  • docker_version: version of the docker daemon
  • ssh_hostname: SSH hostname
  • ssh_keypath: SSH private key path
  • ssh_port: SSH port
  • ssh_username: SSH username

Finally the state of the machine can be set using the attribute "state", either "running" or "stopped". Upon refresh, state will contain the actual state of the machine, lowercased.

Currently, any change to resource attributes, except for the "state" attribute, will trigger a destroy-create cycle.

The following parameters can be set at provider level:

  • debug: boolean, enables docker-machine debug output in Terraform log
  • storage_path: set default storage path for docker-machine
  • certs_directory: set default path for docker-machine certs directory
Example
resource "dockermachine_virtualbox" "node" {
    count = 2
    name = "${format("node-%02d", count.index+1)}"
    virtualbox_cpu_count = 2
    virtualbox_memory = 1024
    
    provisioner "remote-exec" {
        inline = [
            "touch /tmp/this_is_a_test",
        ]
        connection {
            type        = "ssh"
            host        = "${self.ssh_hostname}"
            port        = "${self.ssh_port}"
            user        = "${self.ssh_username}"
            private_key = "${file("${self.ssh_keypath}")}"
        }
    }
}

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳