Terraform RKE providers can easily deploy Kubernetes clusters with Rancher Kubernetes Engine.
- Website: https://www.terraform.io
- Mailing list: Google Groups
Download the binary for your platform from the releases page
wget https://github.com/rancher/terraform-provider-rke/releases/download/x.x.x/terraform-provider-rke_<platform>
Rename the binary to to remove the platform ending (so it looks like terraform-provider-rke
)and move it to your terraform plugin directory (~/terraform.d/plugins/linux_amd64
) or a custom directory. If using a custom directory use the -plug-in=/my/custom/path
when running terraform init
to specify the path.
Clone repository to: $GOPATH/src/github.com/terraform-providers/terraform-provider-rke
$ mkdir -p $GOPATH/src/github.com/rancher
$ cd $GOPATH/src/github.com/rancher
$ go get github.com/rancher/terraform-provider-rke
$ go install github.com/rancher/terraform-provider-rke
Enter the provider directory and build the provider
$ cd $GOPATH/src/github.com/rancher/terraform-provider-rke
$ make build
Current master is focusing on RKE v1.0.x There are some breaking changes from previous provider version.
If you use RKE v0.2.x or v0.1.x, please set proper branch.
If you're building the provider, follow the instructions to install it as a plugin. After placing it into your plugins directory, run terraform init
to initialize it. Documentation about the provider specific configuration options can be found on the provider's website.
If you wish to work on the provider, you'll first need Go installed on your machine (version 1.12+ is required). You'll also need to correctly setup a GOPATH, as well as adding $GOPATH/bin
to your $PATH
.
To compile the provider, run make build
. This will build the provider and put the provider binary in $GOPATH/bin
.
$ make build
...
$ $GOPATH/bin/terraform-provider-rke
...
To just compile provider binary on repo path and test on terraform:
$ make bin
$ terraform init
$ terraform plan
$ terraform apply
In order to test the provider, you can simply run make test
.
$ make test
In order to run the full suite of Acceptance tests, a running rancher system, a rancher API key and a working k8s cluster imported are needed.
To run acceptance tests, you can simply run make testacc
. scripts/gotestacc.sh
will be run, deploying all needed requirements, running acceptance tests and cleanup.
$ make testacc
Currently acceptance tests only works on Linux platforms, on Mac OSX are not yet supported.
You can view some tf file examples, here.
On Openstack you can use terraform-openstack-rke module.