Skip to main content

Reference for the teleport_bot_v2 Terraform resource

This page describes the supported values of the teleport_bot_v2 resource of the Teleport Terraform provider.

Example Usage

# Teleport Machine ID Bot creation example

locals {
  bot_name = "example"
}

resource "random_password" "bot_token" {
  length  = 32
  special = false
}

resource "time_offset" "bot_example_token_expiry" {
  offset_hours = 1
}

resource "teleport_provision_token" "bot_example" {
  metadata = {
    expires     = time_offset.bot_example_token_expiry.rfc3339
    description = "Bot join token for ${local.bot_name} generated by Terraform"

    name = random_password.bot_token.result
  }

  spec = {
    roles       = ["Bot"]
    bot_name    = local.bot_name
    join_method = "token"
  }
}

resource "teleport_bot_v2" "example" {
  metadata = {
    name = local.bot_name
  }

  spec = {
    roles = ["access"]
    traits = {
      "logins" = ["ubuntu", "root"]
    }
  }
}

Schema

Optional

  • metadata (Attributes) Common metadata that all resources share. (see below for nested schema)
  • spec (Attributes) The configured properties of a Bot. (see below for nested schema)
  • status (Attributes) Fields that are set by the server as results of operations. These should not be modified by users. (see below for nested schema)
  • sub_kind (String) Differentiates variations of the same kind. All resources should contain one, even if it is never populated.
  • version (String) The version of the resource being represented.

Nested Schema for metadata

Optional:

  • description (String) description is object description.
  • expires (String) expires is a global expiry time header can be set on any resource in the system.
  • labels (Map of String) labels is a set of labels.
  • name (String) name is an object name.

Nested Schema for spec

Optional:

  • max_session_ttl (String) The max session TTL value for the bot's internal role. Unless specified, bots may not request a value beyond the default maximum TTL of 12 hours. This value may not be larger than 7 days (168 hours).
  • roles (List of String) The roles that the bot should be able to impersonate.
  • traits (Map of List of String) The traits that will be associated with the bot for the purposes of role templating. Where multiple specified with the same name, these will be merged by the server.

Nested Schema for status

Optional:

  • role_name (String) The name of the role associated with the bot.
  • user_name (String) The name of the user associated with the bot.