Files

3.5 KiB

page_title, subcategory, description
page_title subcategory description
kms_project_template Resource - terraform-provider Projects Create project templates & save to Hanzo KMS. Only Machine Identity authentication is supported for this resource.

kms_project_template (Resource)

Create project templates & save to Hanzo KMS. Only Machine Identity authentication is supported for this resource.

Example Usage

terraform {
  required_providers {
    kms = {
      # version = <latest version>
      source = "hanzokms/kms"
    }
  }
}

provider "kms" {
  host = "https://kms.hanzo.ai" # Only required if using self hosted instance of Hanzo KMS, default is https://kms.hanzo.ai
  auth = {
    universal = {
      client_id     = "<machine-identity-client-id>"
      client_secret = "<machine-identity-client-secret>"
    }
  }
}

resource "kms_project_template" "example-project-template" {
  name        = "example-project-template"
  description = "This is an example project template"
  type        = "secret-manager"
  environments = [{
    name     = "development",
    slug     = "dev",
    position = 1
  }]

  roles = [{
    name = "Test",
    slug = "test",
    permissions = [
      {
        action   = ["edit"]
        subject  = "secret-folders",
        inverted = true,
      },
      {
        action  = ["read", "edit"]
        subject = "secrets",
        conditions = jsonencode({
          environment = {
            "$in" = ["dev", "prod"]
            "$eq" = "dev"
          }
          secretPath = {
            "$eq" = "/"
          }
        })
      },
    ]
  }]
}

Schema

Required

Optional

  • description (String) The description of the project template
  • environments (Attributes List) The environments for the project template (see below for nested schema)
  • roles (Attributes List) The roles for the project template (see below for nested schema)

Read-Only

  • id (String) The ID of the project template

Nested Schema for environments

Required:

  • name (String) The name of the environment
  • position (Number) The position of the environment
  • slug (String) The slug of the environment

Nested Schema for roles

Required:

  • name (String) The name of the role
  • slug (String) The slug of the role

Optional:

Nested Schema for roles.permissions

Required:

  • action (Set of String) Describe what actions an entity can take.
  • subject (String) Describe the entity the permission pertains to.

Optional:

  • conditions (String) When specified, only matching conditions will be allowed to access given resource. Refer to the documentation in https://hanzo.ai/docs/internals/permissions#conditions for the complete list of supported properties and operators.
  • inverted (Boolean) Whether rule forbids. Set this to true if permission forbids.