A Terraform provider for managing Pangolin resources.
This provider is built using the Terraform Plugin Framework (instead of the older SDKv2).
- Why: It provides better type safety, improved validation capabilities, and is the current standard recommended by HashiCorp for new providers.
The API logic is isolated in internal/client/.
- Why: This separates the HTTP/JSON concerns from the Terraform state management. It makes the code more maintainable and allows for easier unit testing of the API client independent of the Terraform lifecycle.
- Flat vs. Nested: Resources like
pangolin_site_resourceinclude ID lists for roles and users to match the API's expectation of many-to-many relationships via array properties. - Sub-resources:
pangolin_targetis treated as a separate resource rather than a block withinsite_resourcebecause targets have their own lifecycle and IDs in the Pangolin API.
The provider uses Bearer Token authentication as required by the Pangolin Integration API. The token is marked as sensitive in the schema to ensure it doesn't leak into logs.
| Pangolin Version | Provider Version |
|---|---|
| >= v1.15.2 | >= 0.1.0 |
To compile the provider locally, run:
go build -o terraform-provider-pangolinTo test the provider without publishing it, you can use Terraform's dev_overrides feature. Create or edit your ~/.terraformrc file:
provider_installation {
dev_overrides {
"registry.terraform.io/groteck/pangolin" = "/path/to/your/project/pangolin-tf"
}
direct {}
}This provider communicates with the Pangolin Integration API.
You must enable the Integration API in your Pangolin server configuration (config.yml).
flags:
enable_integration_api: true
server:
integration_port: 3003 # Optional, defaults to 3003Ensure the port 3003 (or your configured port) is exposed and accessible to the machine running Terraform.
provider "pangolin" {
token = "your-api-token"
base_url = "https://your-pangolin-instance.com:3003/v1" # Point to the Integration API
}provider "pangolin" {
token = "your-api-token"
base_url = "https://api.pangolin.net/v1" # Optional
}Manages an application or service exposed through Pangolin (Host or CIDR mode).
- Attributes:
name,mode(host/cidr),site_id,destination,alias,user_ids,role_ids.
Manages an App-style resource (HTTP/TCP/UDP).
- Attributes:
name,protocol,http,subdomain,domain_id.
Manages a backend target for a pangolin_resource.
- Attributes:
resource_id,ip,port,enabled.
Manages organization-level roles.
- Attributes:
name,description,org_id.
See the examples/ directory for a full configuration.
This project enforces Conventional Commits. All commit messages must follow this specification (e.g., feat: add new resource, fix: resolve crash).
This format is used to automate the semantic versioning and changelog generation via the Release Please workflow.
Releases are automated using Release Please.
- Commit: Push changes using Conventional Commits.
- Automated PR: The Release Please bot analyzes new commits and automatically creates a "Release PR" with the updated
CHANGELOG.mdand calculated version bump (e.g.,chore(main): release v0.2.0). - Merge: When the Release PR is merged, the bot:
- Creates a GitHub Release.
- Creates a Git Tag.
- Artifacts: The creation of the tag triggers GoReleaser to build and upload the provider binaries to the release.
This project is licensed under the MIT License - see the LICENSE file for details.