/terraform-provider-pks

Terraform Provider for PKS

Primary LanguageGo

Terraform Provider

It's a Terraform provider for PKS. At the moment the only completed resource is the pks_cluster resource for creating clusters.

Note that this is not an officially supported provider. Nor does the PKS HTTP API offer any direct guarantees to maintaining compatibility over upgrades. However, if you encounter any issues you are welcome to raise an issue on this repo.

Requirements

  • Terraform 0.12
  • Go 1.13 (to build the provider plugin)

Using the Provider

To use this provider in your Terraform environment, follow the instructions to install it as a plugin. After placing it into your plugins directory, run terraform init to initialize it.

Example Configuration

A simple configuration to create a cluster:

provider "pks" {
  target = "${var.pks_api_dns_name}"
  token = "${var.token}"
}

resource "pks_cluster" "example" {
  name = "example1"
  external_hostname = "${var.k8s_api_dns_name}"
  plan = "small"
  num_nodes = 1
}

variable "k8s_api_dns_name" {
  type = "string"
}

variable "pks_api_dns_name" {
  type = "string"
}

variable "token" {
  type = "string"
}

Configuration Options

Configuration options can be found :

  • Here for the provider itself
  • Here for the pks_cluster resource

Developing the Provider

If you wish to work on the provider, you'll first need Go installed on your machine (please check the requirements before proceeding).

Note: This project uses Go Modules making it safe to work with it outside of your existing GOPATH. The instructions that follow assume a directory in your home directory outside of the standard GOPATH (i.e $HOME/development/terraform-providers/).

Clone repository to: $HOME/development/terraform-providers/

$ mkdir -p $HOME/development/terraform-providers/; cd $HOME/development/terraform-providers/
$ git clone git@github.com:terraform-providers/terraform-provider-aws
...

Enter the provider directory and run make tools. This will install some useful tools for the provider.

$ make tools

To compile the provider, run make build. This will build the provider and put the provider binary in the $GOPATH/bin directory.

$ make build
...
$ $GOPATH/bin/terraform-provider-aws
...

Testing the Provider

In order to run the full suite of Acceptance tests, run make testacc.

Note: Acceptance tests create real resources, and often cost money to run. Please read Running an Acceptance Test in the contribution guidelines for more information on usage.

$ make testacc

Contributing

Issues on GitHub are intended to be related to bugs or feature requests with provider codebase. See https://www.terraform.io/docs/extend/community/index.html for a list of community resources to ask questions about Terraform.