Categorygithub.com/form3tech-oss/terraform-provider-vault-grafanacloud

# Packages

No description provided by the author
No description provided by the author

# README

terraform-provider-vault-grafanacloud

Build Status

A Terraform provider for provisioning a Grafana Cloud Secrets backend and roles in a Vault instance.

Installation

Download the relevant binary from releases and copy it to $HOME/.terraform.d/plugins/.

Configuration

The following provider block variables are available for configuration:

NameEnvironment VariableDescription
addressVAULT_ADDRURL of the root of the target Vault server.
tokenVAULT_TOKENToken to use to authenticate to Vault.

Alternatively, these values can be read from the environment variables in the table.

Resources

vaultgrafanacloud_secret_backend

The vaultgrafanacloud_secret_backend resource mounts the vault-plugin-secrets-grafanacloud plugin to Vault.

Attributes

NameRequiredDescriptionDefault Value
backendfalseThe mount path for a backend, for example, the path given in "$ vault secrets enable -path=grafana-cloud grafana-cloud-plugin".grafana-cloud
keytrueGrafana Cloud API key with Admin role to create user keysN/A
urltrueThe URL for the Grafana Cloud APIN/A
organisationtrueThe Organisation slug for the Grafana Cloud API"N/A
usertrueThe User that is needed to interact with prometheus, if set this is returned alongside every issued credentialN/A

vaultgrafanacloud_secret_role

The vaultgrafanacloud_secret_role resource creates a Vault role on the Grafana Cloud secret backend.

Attributes

NameRequiredDescriptionDefault Value
backendfalseThe mount path of the Grafana Cloud backendgrafana-cloud
nametrueGrafana Cloud API key with Admin role to create user keysN/A
gc_roletrueThe URL for the Grafana Cloud APIN/A
ttl_secondsfalseThe Organisation slug for the Grafana Cloud API"300
max_ttl_secondsfalseThe User that is needed to interact with prometheus, if set this is returned alongside every issued credential300

Example

resource "vaultgrafanacloud_secret_backend" "backend" {
  backend      = "grafanacloud"
  key          = var.your_secret_api_key
  url          = "https://grafana.com/api"
  organisation = "my-org"
  user         = "my-user"
}

resource "vaultgrafanacloud_secret_role" "test" {
  backend         = "grafanacloud"
  name            = "my-role"
  gc_role         = "Viewer"
  ttl_seconds     = "3600"
  max_ttl_seconds = "3600"
}

Testing

To test the terraform provider, you will need to perform some set-up steps.

  1. Compile the vault-plugin-secrets-grafanacloud plugin and copy to ./bin/.
  2. Run docker-compose up -d
  3. Run TF_ACC=1 VAULT_ADDR=http://localhost:8200 VAULT_TOKEN=root make test