This repository contains Terraform Provider for managing cloud resources in OChK.
- Documentation: https://registry.terraform.io/providers/chmurakrajowa/ochk/latest/docs
- Website: https://ochk.cloud
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/ ./...
Provide connection details in terraform.tfvars
file.
$ cd examples
$ terraform init
$ terraform apply
Update/generate API client for Platforma OChK V3.
- To generate new client from swagger, you need to download new swagger definition file in json format from https://pckproxy-at.ochk.pilot if you are working on AUTOTEST enviroment.
Swagger.json file is available at: https://pckproxy-at.ochk.pilot/swagger/v1/swagger.json
- Place downloaded file in location ./api/v3/swagger.json
- Run script:
./tools/swagger_gen.sh
- New proxy client will be generated. Do not modify any file under /api/v3/ location
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_api_key=api_key
$ export TF_VAR_platform_type=VMWARE / OPENSTACK
$ go test ./...