Skip to content

sotoon/terraform-provider-sotoon

Repository files navigation

Terraform Provider Sotoon

The Terraform Sotoon provider is a plugin for Terraform that allows for the full lifecycle management of Sotoon resources.

Requirements

  • Terraform >= 1.0
  • Go >= 1.18 (to build the provider plugin)

Getting Started

  1. Clone the repository:
git clone https://github.com/sotoon/terraform-provider-sotoon
cd terraform-provider-sotoon
  1. Build the provider:

Run the following command to build the provider binary. This will create the terraform-provider-sotoon executable in the project's root directory.

go build -o terraform-provider-sotoon

Installing the Provider for Development

For development purposes, you can instruct Terraform to use your locally-built provider instead of downloading one from a registry.

  1. Install with Make:

The provided Makefile simplifies the process. It builds the binary and copies it to the correct plugins directory for your user.

make install
  1. Manual Installation (Alternative): You can configure Terraform manually. Create or edit the Terraform CLI configuration file (~/.terraformrc or %APPDATA%\terraform.rc on Windows).
provider_installation {
  dev_overrides {
    "sotoon/sotoon" = "<path-to-your-built-binary>"
  }
  direct {}
}

Replace <path-to-your-built-binary> with the directory containing your built terraform-provider-sotoon binary.

Example Usage

This section shows a complete, runnable example.

  1. Navigate to the examples directory:
cd examples/
  1. Initialize Terraform:

This command downloads any other required providers and sets up the backend.

terraform init
  1. Apply the configuration:

This command will show you a plan of the resources to be created and prompt for confirmation.

terraform apply
  1. Clean up resources:

When you are finished, destroy the created resources to avoid costs.

terraform destroy

Running Tests

To run unit tests locally:

go test ./internal/provider/... -tags=unit -v -run '^TestUnit'

## Example `terraform.tfvars`

Copy the example file before customizing:

```shell
cp examples/terraform.tfvars.example examples/terraform.tfvars

Below is an example of how to configure your terraform.tfvars file:

api_token     = "xxxxxxxxxxxxxxxxxxxxxxxxxxx"
workspace_id  = "your-workspace-id"
user_id       = "your user id"

# Special variable used in users, groups, etc.
workspace_id_target = "your-target-workspace-id"

Contributing

We welcome contributions! Please see the CONTRIBUTING.md file for guidelines and instructions.

About

No description, website, or topics provided.

Resources

Contributing

Stars

Watchers

Forks

Packages

No packages published

Contributors 7