Rancher is a great tool to deploy Docker stacks. At Camptocamp, we have used it increasingly, starting with our infrastructure components. A few months ago, we ported our dockerized Puppet stack to Rancher and since then have open-sourced it, along with other useful templates.
More automation needed
But that wasn’t enough. While Rancher helped provide clean deployment environments to our developers, we still had many actions to perform by hand:
- creating the Rancher environment;
- setting the registry credentials to access private images;
- adding hosts to the environment;
- adding our standard stacks (logging, letsencrypt, conplicity, upkick, external-dns) to the environment.
It became quickly obvious that Terraform would be the perfect tool for these tasks, especially as we already used it to manage resources whose parameters were required for the hosts and stacks (in particular IAM credentials and route53 zones for conplicity, external-dns and letsencrypt stacks).
Rancher Terraform provider
This new provider currently features 5 resource types:
rancher_environmentto create, update and destroy Rancher environments;
rancher_registration_tokento create and destroy registration tokens for environments;
rancher_registry_credentialto create, update and destroy registries and credentials for an environment;
rancher_stackto create, update and destroy Rancher stacks.
Below is an example:
We’re looking to extend the number of resource types for this provider in the future (e.g.
Camptocamp provides education in both Docker/Rancher and Terraform. See our training page for more information.