Do you use Docker Machine? Do you sometimes wish you had a little more control over the infrastructure it creates?
Well now you do :)
If you can express it as a Terraform configuration, you can use it from Docker Machine.
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-lifecycle-on
(Optional) - A flag which, if specified, results in performing a custom apply on start/stop instead of just destroying machine on stop.
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_lifecycle
- Present only ifterraform-lifecycle-on
flag is present. Desired state of Docker machine:running
(used duringcreate
andstart
) andstopped
(used whenstop
orremove
is ran); if your provider doesn't support start/stop, you can just delete a server resource usingcount
parameter in Terraform.dm_machine_name
- The name of the Docker machine being createddm_ssh_user
- The SSH user name to use for authenticationdm_ssh_port
- The SSH port to usedm_ssh_public_key_file
- The public SSH key file to use for authenticationdm_ssh_private_key_file
- The private SSH key file to use for authenticationdm_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 machinedm_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
Here are some examples for several different providers:
- Digital Ocean
- Dimension Data CloudControl
- Amazon Web Services (AWS)
- Azure
Still to be implemented
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.
Download the latest release and place the provider executable in the same directory as docker-machine
executable (or somewhere on your PATH
).
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.