Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sadok-f/terraform-provider-searchstax
WIP: Terraform provider for SearchStax
https://github.com/sadok-f/terraform-provider-searchstax
Last synced: 24 days ago
JSON representation
WIP: Terraform provider for SearchStax
- Host: GitHub
- URL: https://github.com/sadok-f/terraform-provider-searchstax
- Owner: sadok-f
- License: mpl-2.0
- Created: 2023-08-31T08:24:35.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-08-12T12:34:53.000Z (3 months ago)
- Last Synced: 2024-08-13T13:20:46.641Z (3 months ago)
- Language: Go
- Homepage:
- Size: 166 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Code of conduct: .github/CODE_OF_CONDUCT.md
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# Terraform Provider SearchStax (WIP)
[![Tests](https://github.com/sadok-f/terraform-provider-searchstax/actions/workflows/test.yml/badge.svg)](https://github.com/sadok-f/terraform-provider-searchstax/actions/workflows/test.yml)
This repository represents an base code for a terraform provider for [SearchStax Cloud](https://www.searchstax.com/docs/searchstax-cloud-docs-home/).
The code is still **WIP** and not published yet to the Terraform registry.## Requirements
- [Terraform](https://developer.hashicorp.com/terraform/downloads) >= 1.0
- [Go](https://golang.org/doc/install) >= 1.20## Building SearchStax Provider locally
1. Clone the repository
```shell
git clone [email protected]:sadok-f/terraform-provider-searchstax.git
```
2. Enter the repository directory
```shell
cd terraform-provider-searchstax/
```
3. Build the provider using the Go `install` command:```shell
go install
```Terraform allows you to use local provider builds by setting a `dev_overrides` block in a configuration file called `.terraformrc`. This block overrides all other configured installation methods.
Terraform searches for the `.terraformrc` file in your home directory and applies any configuration settings you set.
```
provider_installation {dev_overrides {
"registry.terraform.io/sadok-f/searchstax" = ""
}# For all other providers, install them directly from their origin provider
# registries as normal. If you omit this, Terraform will _only_ use
# the dev_overrides block, and so no other providers will be available.
direct {}
}
```Your `` may vary depending on how your Go environment variables are configured. Execute `go env GOBIN` to set it, then set the `` to the value returned. If nothing is returned, set it to the default location, `$HOME/go/bin`.
## Using the provider
```hcl
terraform {
required_providers {
searchstax = {
source = "hashicorp.com/sadok-f/searchstax"
}
}
}provider "searchstax" {
username = var.ssx_username
password = var.ssx_pwd
}```
## Developing the ProviderIf you wish to work on the provider, you'll first need [Go](http://www.golang.org) installed on your machine (see [Requirements](#requirements) above).
To compile the provider, run `go install`. This will build the provider and put the provider binary in the `$GOPATH/bin` directory.
To generate or update documentation, run `go generate`.
### Acceptance tests
*Note:* Acceptance tests runs on a SearchStax mock api server created by this [Repo](https://github.com/sadok-f/searchstax-mock-api), it returns a mocking response for each API call.
In order to run the full suite of Acceptance tests, run:
```shell
./internal/provider/acceptance.sh
```### Testing the provider locally with a debugger
Should you want to validate a change locally, the `--debug` flag allows you to execute the provider against a terraform instance locally.This also allows for debuggers (e.g. delve) to be attached to the provider.
```sh
go run main.go --debug
# Copy the TF_REATTACH_PROVIDERS env var
# In a new terminal
cd examples/resources/deployment
TF_REATTACH_PROVIDERS=... terraform init
TF_REATTACH_PROVIDERS=... terraform apply
```More details about running a terraform provider with a debugger:
[https://opencredo.com/blogs/running-a-terraform-provider-with-a-debugger/](https://opencredo.com/blogs/running-a-terraform-provider-with-a-debugger/)