This repository contains the official Terraform provider for Solace Cloud. This provider allows you to manage Solace Cloud resources using HashiCorp Terraform, enabling infrastructure as code practices for your Solace event streaming and management services.
This repository is organized as follows:
internal/: Contains the core logic for the Terraform provider.examples/: Includes example Terraform configurations demonstrating how to use the provider.scripts/: Contains build and test automation scripts.docs/: Provides documentation for the provider's resources and data sources.
To build the provider from source:
- Clone the repository.
- Navigate to the repository directory.
- Build the provider using the Go
installcommand:
go installThis command compiles the provider and installs the binary to your Go environment.
The provider utilizes an OpenAPI-generated library for interacting with the Solace Cloud API. To incorporate new API features or updates:
- Refer to the instructions in
OpenAPI-howto.mdto regenerate the API client. - After updating, ensure to test the provider thoroughly.
This provider uses Go modules. Please see the Go documentation for the most up to date information about using Go modules.
To add a new dependency github.com/author/dependency to your Terraform provider:
go get github.com/author/dependency
go mod tidyThen commit the changes to go.mod and go.sum.
Fill this in for each provider
If you wish to work on the provider, you'll first need Go installed on your machine (see 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.
Run acceptance tests against staging
bash scripts/staging-acceptance.shNote: Acceptance tests create real resources, and often cost money to run.
Run local tests (Including acceptance tests against mocks)
make testThis is optional because you can execute the provider from the acceptance tests exactly like you would in a real Terraform environment.
To install the provider locally, you can copy the following terraform configuration to your ~/.terraformrc file:
provider_installation {
dev_overrides {
"hashicorp.com/edu/solacecloud" = "path-to-terraform-provider/terraform-provider-solacecloud"
"registry.terraform.io/solaceproducts/solacebroker" = "${GOBIN_OR_PATH_TO_BROKER_PROVIDER}"
}
# 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 {}
}