Documentation · Administration · Set up

Set up with Terraform

The Credvane provider manages your organization's configuration as code: sources, specs, identities, issuers, trust policies, notifications and audit streams. It never handles credential values.

1. Create an API key

In the web app, Settings → API keys → Create. Choose Manage this organization and an expiry. The key (cat_...) is shown once; changes made with it appear under its name in the audit log.

The Create API key form: name terraform, permission Manage this organization, expires in 90 days.

2. Install the provider

The provider is on the Terraform Registry as commitwisedev/credvane: the required_providers block below is all it takes, and terraform init downloads it. Releases are signed with GPG, so init reports it as self-signed with the key's id, and each release has build provenance you can check (see releasing). Without access to the Registry, a filesystem or network mirror holding a release's zips works too.

Give the provider the address and key:

export CREDVANE_BASE_URL=https://credvane.example.com
export CREDVANE_API_KEY=cat_...

3. Describe your configuration

terraform {
  required_providers {
    credvane = {
      source  = "commitwisedev/credvane"
      version = "~> 0.1"
    }
  }
}

provider "credvane" {}

# An API key service, checked with a probe request.
resource "credvane_apikey_source" "datadog" {
  key  = "datadog"
  name = "Datadog"
  settings = {
    probeUrl = "https://api.datadoghq.com/api/v1/validate"
  }
}

# What may exist: a GitHub token that can only read packages.
resource "credvane_spec" "github_packages" {
  key          = "github-packages"
  name         = "GitHub packages (read)"
  source       = "github"
  scopes       = ["read:packages"]
  description  = "Pulls container images and packages in CI."
  instructions = "Create a classic token with only read:packages, expiring in 90 days."
}

resource "credvane_spec" "datadog_api" {
  key              = "datadog-api"
  name             = "Datadog API key"
  source           = credvane_apikey_source.datadog.id
  allow_unverified = true
}

# A team identity that owns credentials for CI.
resource "credvane_identity" "platform_ci" {
  name = "platform-ci"
}

# The built-in GitHub Actions issuer, by name.
data "credvane_issuer" "github" {
  name = "GitHub Actions"
}

# Jobs on main in example-org/api may read as platform-ci, with no stored secret.
resource "credvane_workload_trust" "deploy_from_main" {
  name     = "deploy-from-main"
  issuer   = data.credvane_issuer.github.url
  audience = "https://credvane.example.com"
  identity = credvane_identity.platform_ci.name
  specs    = [credvane_spec.github_packages.key, credvane_spec.datadog_api.key]
  claims = {
    repository = "example-org/api"
    ref        = "refs/heads/main"
  }
}
terraform init
terraform plan
terraform apply

People then add their credentials for these specs in the web app, and the pipeline reads them as shown in reading credentials.

Resources

ResourceManagesNotes
credvane_specA specIts source cannot change
credvane_apikey_sourceAn API key service
credvane_sourceA built-in source's settings, such as a GitHub Enterprise addressDestroy resets the settings
credvane_identityA team, application or agent identityDestroy deactivates it
credvane_issuerAn OIDC issuer: self-managed GitLab, Kubernetes, ...Built-in issuers are data sources
credvane_workload_trustA trust policyReferences identity, specs and issuer
credvane_notification_settings, credvane_notification_channelEmail notificationsThe SMTP password is write-only
credvane_audit_settings, credvane_audit_streamAudit retention and SIEM streamsHeader values are write-only

Data sources: credvane_issuer(s), credvane_source(s) and credvane_notification_events. Every resource can be imported by its key or name.

Secrets stay out of state

Passwords and header values are write-only attributes (Terraform 1.11 or later): they are sent to Credvane and kept in its secret store, never written to the state. Pass them as ephemeral variables, and bump the version to send a new one.

variable "hec_token" {
  type      = string
  sensitive = true
  ephemeral = true
}

resource "credvane_audit_settings" "this" {
  retention_days = 365
}

resource "credvane_audit_stream" "splunk" {
  name                    = "Splunk"
  kind                    = "HTTP"
  url                     = "https://splunk.example.com:8088/services/collector/raw"
  header_name             = "Authorization"
  header_value_wo         = "Splunk ${var.hec_token}"
  header_value_wo_version = 1   # bump when the token changes
}