A Terraform provider for managing WALLIX Bastion resources
The Terraform WALLIX Bastion provider allows you to manage WALLIX Bastion resources such as users, groups, authorizations, and more through Infrastructure as Code.
- Visit the official Terraform website for downloads
- Go
v1.25orv1.26(for development)
terraform {
required_providers {
wallix-bastion = {
source = "wallix/wallix-bastion"
version = "~> 0.14.0"
}
}
}
provider "wallix-bastion" {
ip = "your-bastion-host"
user = "<user>"
token = "<your-api-token>"
}# Clone the repository
git clone https://github.com/wallix/terraform-provider-wallix-bastion.git
cd terraform-provider-wallix-bastion
```bash
# Build and install the provider locally
make installNote: When testing your locally built provider, you may need to explicitly specify the local source and version in your Terraform configuration. This ensures Terraform uses your development build instead of the published version.
Example:
terraform {
required_providers {
wallix-bastion = {
source = "terraform.local/local/wallix-bastion"
version = "0.0.0-dev"
}
}
}For basic building and testing:
- Go 1.25 to 1.26
- Make
- Git
For full development environment (installed via make setup-dev):
- golangci-lint - Code linting
- govulncheck - Security vulnerability scanning
- tfplugindocs - Documentation generation
Optional tools:
- Terraform CLI - For manual testing
- markdownlint - Markdown linting (
npm install -g markdownlint-cli) - go-test-report - Enhanced test output
# Build the provider
make build
# Build for all platforms
make build-all
# Clean build artifacts
make cleanFor manual development without using Makefile:
# Install dependencies
go mod download
# Format code
go fmt ./...
# Run linters
golangci-lint run --config .golangci.yml
# Build with version info
go build -ldflags="-X main.version=dev" -o terraform-provider-wallix-bastionRecommended: Use make commands instead for a consistent development experience.
# Run all unit tests
make test
# Run tests with HTML coverage report
make test-coverage
# Run specific test
go test -v ./bastion -run TestAccResourceAuthorization_basic
# Run all tests (unit + acceptance)
make test-allNote: If go-test-report is installed, make test will generate a formatted test report.
Acceptance tests require a running WALLIX Bastion instance.
# Set environment variables
export WALLIX_BASTION_HOST="your-bastion-host"
export WALLIX_BASTION_USER="admin"
export WALLIX_BASTION_TOKEN="<your-api-token>"
export WALLIX_BASTION_API_VERSION="v3.12"
# Run acceptance tests
make testacc
# Run specific acceptance test
TF_ACC=1 go test -v ./bastion -run TestAccResourceAuthorization_sessionSharing-
Create environment file from template:
# Copy the example environment file cp .env.test.example .env.test # Edit with your Bastion credentials vim .env.test # or use your preferred editor
-
Load environment variables:
# Source the environment file source .env.test # Verify configuration echo "Testing against: $WALLIX_BASTION_HOST" echo "API Version: $WALLIX_BASTION_API_VERSION"
-
Verify Bastion connectivity:
# Test API endpoint curl -k https://$WALLIX_BASTION_HOST/api/version
-
Run tests:
# Run unit tests make test # Run acceptance tests (requires configured .env.test) make testacc # Run all tests make test-all
Security Note: Never commit .env.test to version control. It's already in .gitignore.
# Clone and setup
git clone https://github.com/wallix/terraform-provider-wallix-bastion.git
cd terraform-provider-wallix-bastion
# Install dependencies and development tools
make setup-dev
# Verify installation
make setup-check# Create feature branch
git checkout -b feature/your-feature-name
# Make your changes
# ...
# Format and lint
make fmt
make lint
# Run tests
make test
# Run security checks
make lint-security# Build and install locally
make install
# Test with your Terraform configuration
cd examples/
# Choose an example directory, e.g., authorization
cd authorization
# Update the provider to use the development build
# terraform {
# required_version = ">= 1.0"
# required_providers {
# wallix-bastion = {
# # source = "wallix/wallix-bastion"
# # version = "0.14.7"
# source = "terraform.local/local/wallix-bastion"
# version = "0.0.0-dev"
# }
# }
# }
terraform init
terraform plan
terraform apply# Run full checks (like CI)
make ci-check
# Or run all tests
make test-all
# Commit changes
git add .
git commit -m "feat: your feature description"
git push origin feature/your-feature-name
# Create pull requestmake build # Build the provider with version info
make build-all # Build for all platforms (darwin/linux/windows, amd64/arm64)
make install # Install the provider locally for development
make clean # Clean build artifacts and coverage filesmake fmt # Format Go code and Terraform examples
make lint # Run golangci-lint with CI configuration
make lint-fix # Run golangci-lint and auto-fix issues
make lint-markdown # Lint markdown files (requires markdownlint)
make lint-security # Run vulnerability checks with govulncheck
make vet # Run go vetmake test # Run unit tests (with go-test-report if available)
make test-coverage # Run tests with coverage report (HTML output)
make testacc # Run acceptance tests (requires Bastion instance)
make test-all # Run all tests (unit + acceptance)make setup-dev # Setup development environment (install tools)
make setup-check # Verify development environment setup
make dev-check # Quick development checks (lint + test + build)
make ci-check # Run CI-style checks (lint + security + test)make docs # Generate documentation with tfplugindocs
make docs-verify # Verify and lint documentation qualitymake maintenance # Run maintenance tasks (deps + lint + test + build)
make update-deps # Update Go dependencies only
make prepare-release # Dry-run release preparation
make release-patch # Prepare patch release (X.Y.Z+1)
make release-minor # Prepare minor release (X.Y+1.0)
make release-major # Prepare major release (X+1.0.0)Note: See RELEASE.md for detailed release process documentation.
- Provider Documentation
- Documentation Generation Guide - How to generate and verify documentation
- Examples
We welcome contributions! Please see our Contributing Guide for details.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Make your changes and add tests
- Run quality checks (
make dev-checkormake ci-check) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
# Install all development tools
make setup-dev
# Verify your setup
make setup-check| Provider Version | Terraform Version | Go Version | WALLIX Bastion API |
|---|---|---|---|
| >= 0.15.0 | >= 1.0 | 1.25-1.26 | v3.8, v3.12 |
| 0.14.x | >= 1.0 | 1.22-1.24 | v3.8, v3.12 |
This project is licensed under the Mozilla Public License 2.0 - see the LICENSE file for details.
We would like to greatly thanks:
- Claranet for their great work on this provider!
- The Terraform community for their continuous support and contributions
- π Documentation
- π Issue Tracker
- π¬ Discussions
