Contributing
Contributions, bug reports, and feedback are welcome. Please review the Code of Conduct and Security Policy before opening a pull request.
Prerequisites
- Go 1.26+
- Pulumi CLI — version must match
.pulumiversion. SDK generation output varies between CLI versions, so mismatches cause spurious diffs in the generated files. Install the pinned version with:curl -fsSL https://get.pulumi.com | sh -s -- --version $(cat .pulumiversion) - Docker (for running integration tests)
- Kind (for cluster-based examples and integration tests)
- kubectl
- jq
Development Setup
git clone https://github.com/tag1consulting/pulumi-lagoon-provider.git
cd pulumi-lagoon-provider
# Build the provider binary
make go-build
# Run unit tests (no Lagoon instance required)
make go-test
# Run Go static analysis
make go-vet
Project Structure
provider/
pkg/client/ # GraphQL API client — one file per resource domain
pkg/resources/ # Pulumi resource CRUD implementations
client_iface.go # LagoonClient interface (update when adding resources)
schema.json # Pulumi schema — regenerated, do not hand-edit
sdk/ # Generated SDKs — do not hand-edit
python/
nodejs/
go/
dotnet/
examples/ # Usage examples
simple-project/
single-cluster/
multi-cluster/
The
sdk/directory andprovider/schema.jsonare generated files. Never edit them directly — they will be overwritten on the next regeneration.
Adding a New Resource
Follow these steps to add a new resource type:
-
Add GraphQL queries to
provider/pkg/client/queries.go. -
Create the client file
provider/pkg/client/<resource>.gowith CRUD methods implementing the Lagoon API calls. Returnerrors.ErrNotFoundfromprovider/pkg/client/errors.gofor missing resources. Add a<resource>_test.goalongside it. -
Add method signatures for the new methods to the
LagoonClientinterface inprovider/pkg/resources/client_iface.go. - Create the resource file
provider/pkg/resources/<resource>.gofollowing the pattern inproject.go:type <Resource> struct{}— empty struct as the receivertype <Resource>Args struct— input fields withpulumi:"fieldName"tags; use pointer types for optional fieldstype <Resource>State struct— embeds Args, adds computed outputs (e.g.,LagoonID int)- Implement
Annotateon all three types - Implement five lifecycle methods:
Create,Update,Delete,Read,Diff - Add a
<resource>_crud_test.gousing the mock client inmock_client_test.go
-
Register the resource in the provider constructor in
provider/pkg/provider/. -
Regenerate the schema and SDKs (see Making Schema Changes).
- Verify tests pass:
make go-test
Making Schema Changes
Any change to the Pulumi-facing surface of a resource requires regenerating provider/schema.json and all four SDKs. This includes:
- Adding, removing, or renaming a field on a
*Argsor*Statestruct - Changing or adding a
pulumi:"..."struct tag - Changing or adding an
Annotatedescription - Adding a new resource
- Changing any input or output type signature
Regenerate with the pinned Pulumi CLI version:
make check-pulumi-version # Verify your CLI matches .pulumiversion
make go-schema # Regenerate provider/schema.json
make go-sdk-all # Regenerate sdk/python, sdk/nodejs, sdk/go, sdk/dotnet
Commit provider/schema.json and all sdk/ changes in the same PR as the provider source change. CI’s verify-sdks workflow fails any PR whose committed artifacts drift from a fresh regeneration with the pinned CLI version.
Testing
Unit tests use a mock GraphQL server and require no live Lagoon instance:
make go-test
There are 690+ unit tests covering all resource types. New resources must include:
provider/pkg/client/<resource>_test.goprovider/pkg/resources/<resource>_crud_test.go
Integration tests require a live Lagoon instance. See examples/simple-project/ for setup instructions.
Code Style
- Format code with
gofmtbefore committing. CI will reject improperly formatted Go files. - Run
make go-vetand fix all reported issues. - Follow the patterns established in existing resource files. Introduce new abstractions only after discussion in a GitHub issue.
Pull Request Process
- Fork the repository and create a branch off
main(e.g.,feature/my-resourceorfix/123-description). - Make your changes, including tests.
- If you changed the schema, regenerate SDKs with
make go-sdk-allusing the pinned Pulumi CLI version, and include the generated changes in your PR. - Open a pull request describing what you changed and why, linking any related issues.
- Check the schema change checkbox in the PR template if applicable.
- CI will run tests and verify that committed SDKs match a fresh regeneration.
Reporting Bugs and Requesting Features
Open a GitHub issue.
Bug reports should include: Pulumi version (pulumi version), provider version (pulumi plugin ls | grep lagoon), Lagoon version, the full resource configuration (with secrets redacted), and the complete error output.
Feature requests should describe the Lagoon API capability you want to expose and your use case.