A basic terraform provider which allows generic YAML config for Kubernetes
Clone or download
lawrencegripper Merge pull request #10 from lawrencegripper/lg/issue/3
Run integration tests over all examples in the repository using MiniKube and Travis
Latest commit dff6dbd Jan 20, 2019

README.md

Kubernetes YAML Provider

Build Status

This was originally proposed as a PR to add a YAML resource into the official Terraform provider.

While the work is ongoing to provide a better experience in the official provider I've pulled the code out into a standalone provider which just provides the YAML resource. This allows for it to be used alongside the existing providers.

demo

Status: Experimental

Currently the code has been tried on a limited number of use cases. I would expect wider use to find issue, please raise them on the repository and make contributions to resolve them if you can.

Using the provider

Download a binary for your system from the release page and remove the -os-arch details so you're left with terraform-provider-k8sraw. Use chmod +x to make it executable and then either place it at the root of your Terraform folder or in the Terraform plugin folder on your system.

Then you can create a YAML resources by using the following Terraform:

provider "k8sraw" {}

resource "k8sraw_yaml" "test" {
    yaml_body = <<YAML
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: test-ingress
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /
    azure/frontdoor: enabled
spec:
  rules:
  - http:
      paths:
      - path: /testpath
        backend:
          serviceName: test
          servicePort: 80
    YAML
}

Building The Provider

Clone repository to: $GOPATH/src/github.com/terraform-providers/terraform-provider-kubernetes

$ mkdir -p $GOPATH/src/github.com/lawrencegripper; cd $GOPATH/src/github.com/lawrencegripper
$ git clone git@github.com:lawrencegripper/terraform-provider-kubernetes-yaml

Enter the provider directory and build the provider

$ cd $GOPATH/src/github.com/lawrencegripper/terraform-provider-kubernetes-yaml
$ make build

Developing the Provider

Development Environment

If you wish to work on the provider, you'll first need Go installed on your machine (version 1.9+ 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 the $GOPATH/bin directory.

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

In order to test the provider, you can simply run make test.

$ make test

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.

$ make testacc