terraform-provider-serval

command module
v0.26.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 26, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

README

Serval Terraform Provider

The Serval Terraform provider provides convenient access to the Serval REST API from Terraform.

Requirements

This provider requires Terraform CLI 1.0 or later. You can install it for your system on Hashicorp's website.

Usage

Add the following to your main.tf file:

# Declare the provider and version
terraform {
  required_providers {
    serval = {
      source  = "ServalHQ/serval"
      version = "~> 0.26.0"
    }
  }
}

# Initialize the provider
provider "serval" {
  client_id = "My Client ID" # or set SERVAL_CLIENT_ID env variable
  client_secret = "My Client Secret" # or set SERVAL_CLIENT_SECRET env variable
  bearer_token = "My Bearer Token" # or set SERVAL_BEARER_TOKEN env variable
}

# Configure a resource
resource "serval_access_policy" "example_access_policy" {

}

Initialize your project by running terraform init in the directory.

Additional examples can be found in the ./examples folder within this repository, and you can refer to the full documentation on the Terraform Registry.

Provider Options

When you initialize the provider, the following options are supported. It is recommended to use environment variables for sensitive values like access tokens. If an environment variable is provided, then the option does not need to be set in the terraform source.

Property Environment variable Required Default value
client_secret SERVAL_CLIENT_SECRET false —
client_id SERVAL_CLIENT_ID false —
bearer_token SERVAL_BEARER_TOKEN false —

Semantic versioning

This package generally follows SemVer conventions, though certain backwards-incompatible changes may be released as minor versions:

  1. Changes to library internals which are technically public but not intended or documented for external use. (Please open a GitHub issue to let us know if you are relying on such internals.)
  2. Changes that we do not expect to impact the vast majority of users in practice.

We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.

We are keen for your feedback; please open an issue with questions, bugs, or suggestions.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
cmd
e2etest command
Command e2etest fetches one of each resource type from a real Serval instance, runs direct generation to produce state + HCL, and writes the output to a workspace that can be verified with `tofu plan -refresh-only`.
Command e2etest fetches one of each resource type from a real Serval instance, runs direct generation to produce state + HCL, and writes the output to a workspace that can be verified with `tofu plan -refresh-only`.
testgen command
Command testgen exercises the pkg/export API by reading the directgen test fixtures, generating Terraform state + HCL via the direct generation pipeline, and writing the output to a test workspace directory.
Command testgen exercises the pkg/export API by reading the directgen test fixtures, generating Terraform state + HCL via the direct generation pipeline, and writing the output to a test workspace directory.
cache
Package cache provides a simple prefetch-based caching layer for the Serval Terraform provider.
Package cache provides a simple prefetch-based caching layer for the Serval Terraform provider.
directgen
Package directgen provides direct generation of Terraform state files and HCL configuration from raw API JSON, bypassing OpenTofu's import pipeline.
Package directgen provides direct generation of Terraform state files and HCL configuration from raw API JSON, bypassing OpenTofu's import pipeline.
hclcodec
Package hclcodec provides reflection-based generation of HCL resource blocks from Terraform provider model structs.
Package hclcodec provides reflection-based generation of HCL resource blocks from Terraform provider model structs.
statecodec
Package statecodec provides reflection-based serialization of Terraform provider model structs to the JSON attributes format used in terraform.tfstate files.
Package statecodec provides reflection-based serialization of Terraform provider model structs to the JSON attributes format used in terraform.tfstate files.
pkg
export
Package export provides a public API for generating Terraform state files and HCL configuration directly from raw Serval API JSON responses.
Package export provides a public API for generating Terraform state files and HCL configuration directly from raw Serval API JSON responses.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL