Skip to content

abbeylabs/terraform-provider-abbey

Repository files navigation

abbey Terraform Provider 0.2.9

The public Abbey API. Used for integrating with Abbey and building interfaces to extend the Abbey platform. See https://docs.abbey.io for more information. This repository contains a Terraform provider that allows you to manage resources through the abbey API.

Prerequisites

Installing The Provider

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

Note: The directory structure is important. The provider must be located at ~/.terraform.d/plugins/example.com/user/abbey/0.2.9/<distribution>/terraform-provider-abbey 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 "abbey" {
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.2.9
git push --tags
  1. Build a release binary for your platform:
GOOS=linux GOARCH=amd64 go build -o terraform-provider-abbey
  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.