Skip to content

Commit

Permalink
Add a two-part Terraform starter guide (#44834)
Browse files Browse the repository at this point in the history
* Add a two-part Terraform starter guide

Closes #41055

Add a learning series for users who wants to get started with managing
Teleport resources using Terraform. The guide takes the user through
some fundamental cluster setup tasks: deploying Agents, enrolling
resources, adding labels, configuring roles, and setting up SSO. The
series includes two guides:

- Part One: Enrolling resources
- Part Two: Configuring RBAC

Part One of the series is based on the "Deploy Agents with Terraform"
guide. This change adds instructions to the guide to label
infrastructure resources so the user can access those resources with the
roles configured in Part Two.

Other changes:

- Rename `agent-pool-terraform` to `terraform-starter`.
- Rename the "Dynamic Resources" guide to be more explicitly about
  Infrastructure as Code. Organize this section into subsections to make
  room for the new starter guide.
- Edit the Further Reading discussion in Part One. Move the static
  resource discussion to Further Reading because, otherwise, there is
  too much explanatory text between instructions. Also mention
  auto-discovery.

* Respond partially to hugoShaka feedback

- Fix link syntax.
- Set expectations that the child modules downloaded in the two guides
  are examples.
- Remove diagram with outdated logo.
- Use purpose-oriented names for TF files instead of `main.tf`
- Use `tctl terraform env` to get credentials

* Only deploy SSH Service in enroll-resources.mdx

Responds to hugoShaka feedback.

Resources that are not SSH servers registered via the SSH Service have
some complexities that don't make sense to cover in this guide. Instead,
for simplicity, the guide has the user deploy SSH Service instances,
then includes the possibility of enrolling other kinds of resources in a
"Next steps" section.

Changes:
- Remove the `agent_roles` input in the
  `terraform-starter/agent-installation` module.
- Only deploy a token for the Node role, and configure the Agents
  deployed by the module to only enable the SSH Service.
- Add an agent_labels input to the `agent-installation` module.
- Move non-server deployment instructions to "Next steps".

* Respond to thedevelopnik feedback

Note that you can skip the SSO step in the RBAC guide. Include links to
relevant docs.

* Respond to bernardjkim feedback
  • Loading branch information
ptgott authored Sep 4, 2024
1 parent edc9022 commit a513a50
Show file tree
Hide file tree
Showing 40 changed files with 1,521 additions and 686 deletions.
2 changes: 1 addition & 1 deletion docs/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@
},
{
"source": "/agents/deploy-agents-terraform/",
"destination": "/enroll-resources/agents/deploy-agents-terraform/",
"destination": "/admin-guides/infrastructure-as-code/terraform-starter/enroll-resources/",
"permanent": true
},
{
Expand Down
3 changes: 2 additions & 1 deletion docs/cspell.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"version": "0.2",
"language": "en",
"version": "0.2",
"words": [
"AADUSER",
"ABCDEFGHIJKL",
Expand Down Expand Up @@ -935,6 +935,7 @@
"subchart",
"subgroups",
"subkind",
"subnetworks",
"sudoer",
"supervillain",
"svid",
Expand Down
Binary file removed docs/img/tf-agent-diagram.png
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/pages/admin-guides/deploy-a-cluster/linux-demo.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -205,4 +205,4 @@ Step 4 showed you how to install agents manually, and you can also launch agents
and enroll resources with them using infrastructure-as-code tools. For example,
you can use Terraform to declare a pool of Teleport agents and configure them to
proxy your infrastructure. Read [Deploy Teleport Agents with
Terraform](../../enroll-resources/agents/deploy-agents-terraform.mdx) to get started.
Terraform](../../enroll-resources/agents/introduction.mdx) to get started.
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
title: "Terraform Starter Setup"
description: Provides an example to help you get started managing dynamic resources in a Teleport cluster using Terraform.
---

The Terraform starter guide provides an example of a Terraform module that
manages Teleport resources in production. The guide helps you to understand the
Teleport resources to manage with Terraform in order to accomplish common
Teleport setup tasks. You can use the example module as a starting point for
managing a complete set of Teleport cluster resources.

The guides in the Terraform starter module assume that you have followed [Machine
ID with the Teleport Terraform Provider](
../../enroll-resources/machine-id/access-guides/terraform.mdx) on your
workstation.

## Part One: Enroll resources

In Part One of the Terraform starter module, we show you how to enroll resources
such as Linux servers, databases, and Kubernetes clusters by deploying a pool of
Teleport Agents on virtual machine instances. You can then declare dynamic
infrastructure resources with Terraform or change the configuration file
provided to each Agent.

[Read Part One](./terraform-starter/enroll-resources.mdx).

## Part Two: Configure RBAC

Part Two of the Terraform starter module shows you how to configure Teleport
role-based access controls to provide different levels of access to the
resources you enrolled in Part One. It also configures Access Requests,
available in Teleport Identity, so that users authenticate with less privileged
roles by default but can request access to more privileged roles. An
authentication connector lets users authenticate to Teleport using a Single
Sign-On provider.

[Read Part Two](./terraform-starter/rbac.mdx).

Loading

0 comments on commit a513a50

Please sign in to comment.