Skip to content

ziemowit141/terraform-provider-kentik-cloudexport

 
 

Repository files navigation

Terraform Provider for Kentik Cloud Export

Release process

Release process for the provider is based on github repo tags. Every tag with format v[0-9].[0-9].[0-9] will trigger automatic build of package and publish it in registry.terraform.io.

To build and release package:

  1. Make sure that all code that you want to release is in master branch
  2. Create tag with format v[0-9].[0-9].[0-9] in github. Releases -> Draft a new release -> Put tag version, name and description
  3. Go to Github Actions

Requirements

Install

Build and install the plugin so that Terraform can find and use it:

make install

Test

Unit tests

Unit tests run the provider against a localhost_apiserver that serves data read from CloudExportTestData.json.
This allows to:

  • avoid the necessity of providing valid API credentials
  • avoid creating resources on remote server
  • make the test results more reliable
make test

This will:

  1. build and run localhost_apiserver that is a stub for kentik apiv6 server
  2. run tests (communication with localhost_apiserver)
  3. shut down localhost_apiserver

Acceptance tests

Acceptance tests run the provider against live server

make testacc

You need to provide valid credentials as environment variables so that the provider can communicate with the server:

  • KTAPI_AUTH_EMAIL
  • KTAPI_AUTH_TOKEN

Note: Acceptance tests create real resources.

Debug

make build
dlv exec ./terraform-provider-kentik-cloudexport
r -debug
c
# attach with terraform following the just-printed out instruction in your terminal

Using the provider

In folder with Terraform .tf definition file for cloud export resources/data sources:

terraform init
terraform apply

Note: you need to provide kentikapi credentials and also you can provide custom apiserver url, either in .tf file:

provider "kentik-cloudexport" {
  email="[email protected]"
  token="token123"
  # apiurl= "http://localhost:8080" # custom apiserver
}

or as environment variables:

export KTAPI_AUTH_EMAIL="[email protected]"
export KTAPI_AUTH_TOKEN="token123"
# export KTAPI_URL="http://localhost:8080" # custom apiserver

See: examples

Developing the Provider

If you wish to work on the provider, you'll first need Go installed on your machine (see Requirements above).

To install the provider, run make install. This will place the compiled provider binary under ~/.terraform.d/plugins/.

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

To generate or update documentation, run go generate.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 97.2%
  • Makefile 2.8%