Skip to content

chmurakrajowa/terraform-provider-ochk

Repository files navigation

OChK Terraform Provider

Test

This repository contains Terraform Provider for managing cloud resources in OChK.

Requirements

  • Terraform 1.3.7+
  • Go 1.18+ (to build the provider plugin)

Building The Provider

Clone the repository.

$ git clone git@github.com:chmurakrajowa/ochk-terraform-provider.git

Enter the provider directory and build the provider. Output binary will be placed examples directory.

$ cd ochk-terraform-provider
$ go build -o examples/ ./...

Using the provider

Provide connection details in terraform.tfvars file. Password should be set using OCHK_PASSWORD environment variable.

$ cd examples
$ export OCHK_PASSWORD=*******
$ terraform init
$ terraform apply

Developing the Provider

If you wish to work on the provider, you'll first need Go installed on your machine (version 1.13+ is required).

To compile the provider, run go build ./.... This will build the provider and put the provider binary in the current directory.

$ go build ./...

In order to unit test the provider, you can simply run go test ./....

$ go test ./...

In order to run the full suite of Acceptance tests you need to provide connection details in environment variables. Also enable running Acceptance tests by setting TF_ACC=true.

Note: Acceptance tests create real resources, and often cost money to run.

$ export TF_ACC=true
$ export TF_VAR_host=host
$ export TF_VAR_platform=platform
$ export TF_VAR_username=username
$ export TF_VAR_password=*******

$ go test ./...