# Reference for the teleport\_installer Terraform resource

This page describes the supported values of the teleport\_installer resource of the Teleport Terraform provider.

## Example Usage

```
# Teleport Installer resource

resource "teleport_installer" "example" {
  version = "v1"
  metadata = {
    name        = "example"
    description = "Example Teleport Installer"
    labels = {
      example = "yes"
    }
  }

  spec = {
    # This "custom" script is actually the default installer script ($ tctl get installer/default-installer).
    # Edit it to customize the commands that the Teleport Discovery Service
    # configures virtual machines to run to install Teleport on startup.
    script = <<EOF
#!/usr/bin/env sh
set -eu


INSTALL_SCRIPT_URL="https://{{.PublicProxyAddr}}/scripts/install.sh"

echo "Offloading the installation part to the generic Teleport install script hosted at: $INSTALL_SCRIPT_URL"

TEMP_INSTALLER_SCRIPT="$(mktemp)"
curl -sSf "$INSTALL_SCRIPT_URL" -o "$TEMP_INSTALLER_SCRIPT"

chmod +x "$TEMP_INSTALLER_SCRIPT"

sudo -E "$TEMP_INSTALLER_SCRIPT" || (echo "The install script ($TEMP_INSTALLER_SCRIPT) returned a non-zero exit code" && exit 1)
rm "$TEMP_INSTALLER_SCRIPT"


echo "Configuring the Teleport agent"

set +x
TELEPORT_BINARY=/usr/local/bin/teleport
[ -z "$${TELEPORT_INSTALL_SUFFIX:-}" ] || TELEPORT_BINARY=/opt/teleport/$${TELEPORT_INSTALL_SUFFIX}/bin/teleport

sudo -E "$TELEPORT_BINARY" install autodiscover-node --public-proxy-addr={{.PublicProxyAddr}} --teleport-package={{.TeleportPackage}} --repo-channel={{.RepoChannel}} --auto-upgrade={{.AutomaticUpgrades}} --azure-client-id={{.AzureClientID}} $@
  }
}
EOF
  }
}

```

## Schema

### Required

- `spec` (Attributes) Spec is the resource spec. (see [below for nested schema](#nested-schema-for-spec))
- `version` (String) Version is the resource version.

### Optional

- `metadata` (Attributes) Metadata is the resource metadata. (see [below for nested schema](#nested-schema-for-metadata))
- `sub_kind` (String) SubKind is an optional resource subkind. Currently unused for this resource.

### Nested Schema for `spec`

Required:

- `script` (String) Script represents the contents of a installer shell script

### Nested Schema for `metadata`

Required:

- `name` (String) Name is an object name

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
