Skip to content

Latest commit

 

History

History
137 lines (88 loc) · 2.68 KB

README.md

File metadata and controls

137 lines (88 loc) · 2.68 KB

liblab Terraform Provider 0.0.8

This repository contains a Terraform provider that allows you to manage resources through the liblab API.

Prerequisites

  • Go >= 1.19

  • Terraform >= 1.0

  • Access to the liblab API.

Installing The Provider

  1. Clone the repository:
git clone https://github.com/liblaber/terraform-provider-liblab.git
  1. Navigate to the directory:
cd terraform-provider-liblab
  1. Update module references:
go mod tidy
  1. Build the provider:
go build -o terraform-provider-liblab
  1. Move the provider to your plugins directory:
mkdir -p ~/.terraform.d/plugins/example.com/user/liblab/0.0.1/<distribution>
mv terraform-provider-liblab ~/.terraform.d/plugins/example.com/user/liblab/0.0.1/<distribution>

Note: The directory structure is important. The provider must be located at ~/.terraform.d/plugins/example.com/user/liblab/0.0.1/<distribution>/terraform-provider-liblab Also please change example.com/user and <distribution> to match your real values. To get the run terraform version, possible values: linux_amd64, darwin_arm64, windows_amd64, etc.

Setting Up The Provider

  1. Configure the provider:

In your Terraform configuration, reference the provider and supply the necessary credentials:

provider "liblab" {
host = "https://localhost/"
api_token = "YOUR_API_TOKEN"
}

Running The Provider

To plan and apply your Terraform configuration:

  1. Initialize your configuration:
terraform init -plugin-dir=~/.terraform.d/plugins
  1. Plan your changes:
terraform plan
  1. Apply your configuration:
terraform apply

Debugging

If you encounter any issues or unexpected behaviors, enable debug mode by setting the environment variable:

export TF_PROVIDER_DEBUG=true

Then, run your Terraform commands.

Running Tests

  1. Generate the docs:
go generate ./...
  1. To execute the provider's tests, follow these steps:

a. Run Unit Tests:

make unit-test

b. Run Acceptance Tests:

make acceptance-test

Publishing the Provider

  1. Tag your release:
git tag v0.0.1
git push --tags
  1. Build a release binary for your platform:
GOOS=linux GOARCH=amd64 go build -o terraform-provider-liblab
  1. Upload the binary to the GitHub release or any other distribution method you prefer.

Note: For wide-reaching utility, consider registering your provider with the official Terraform provider registry once it becomes popular within the community.