The Terraform Sotoon provider is a plugin for Terraform that allows for the full lifecycle management of Sotoon resources.
- Terraform >= 1.0
- Go >= 1.18 (to build the provider plugin)
- Clone the repository:
git clone https://github.com/sotoon/terraform-provider-sotoon
cd terraform-provider-sotoon- 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-sotoonFor development purposes, you can instruct Terraform to use your locally-built provider instead of downloading one from a registry.
- 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- 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.
This section shows a complete, runnable example.
- Navigate to the examples directory:
cd examples/- Initialize Terraform:
This command downloads any other required providers and sets up the backend.
terraform init- Apply the configuration:
This command will show you a plan of the resources to be created and prompt for confirmation.
terraform apply- Clean up resources:
When you are finished, destroy the created resources to avoid costs.
terraform destroyTo 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.tfvarsBelow 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"We welcome contributions! Please see the CONTRIBUTING.md file for guidelines and instructions.