Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document how to import resources into Terraform #39701

Merged
merged 3 commits into from
Apr 8, 2024

Conversation

ptgott
Copy link
Contributor

@ptgott ptgott commented Mar 21, 2024

Closes #9720

Add a guide to importing Teleport resources into Terraform. While it is mostly straightforward to add an import block, determining the ID to use for each resource requires some planning, since the ID depends on the resource type.

This change also edits the Terraform provider guide, since testing out this guide was required to test out the resource import workflow:

  • Minor style and readability tweaks.
  • Remove the -f flag in tctl create: This way a user doesn't accidentally override an existing terraform role
  • Add a tbot data directory in an unprivileged path in the working directory of the setup script. This way, we don't need to give teleport ownership of the default Machine ID output directory.
  • Fix identity file paths. These should point to a file called identity in the terraform-identity directory.
  • Edit the "Next steps" section to point to the resource import guide.

Copy link

The PR changelog entry failed validation: Changelog entry not found in the PR body. Please add a "no-changelog" label to the PR, or changelog lines starting with changelog: followed by the changelog entries for the PR.

Copy link

The PR changelog entry failed validation: Changelog entry not found in the PR body. Please add a "no-changelog" label to the PR, or changelog lines starting with changelog: followed by the changelog entries for the PR.

@ptgott ptgott added no-changelog Indicates that a PR does not require a changelog entry backport/branch/v15 labels Mar 21, 2024
Copy link

🤖 Vercel preview here: https://docs-3cwbak7kk-goteleport.vercel.app/docs/ver/preview

docs/config.json Outdated
Comment on lines 644 to 651
{
"title": "Terraform Provider",
"slug": "/management/dynamic-resources/terraform-provider/"
}
},
{
"title": "Import Teleport Resources into Terraform",
"slug": "/management/dynamic-resources/import-terraform-resources/"
}
Copy link
Collaborator

@r0mant r0mant Mar 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not related to this PR per-se, but I've always found our terraform provider documentation to be buried and non-discoverable. Whenever I go to search something terraform-provider-related, I always get confused where I should look (is it managing cluster? deploying agents? reference?), and can never find what I'm looking for "organically" and end up just using search.

What do think about elevating all Terraform Provider relevant documentation to its own top-level section in the left nav bar? In fact, I would probably want to do the same for Kube Operator later. I think we had both of them at the top level long time ago but then they got buried during some docs restructuring.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the past, these guides were in docs/pages/management/guides, which was kind of a catch-all section with no explicit theme.

In the current docs, we put guides related to dynamic resources in /management/dynamic-resources. Reference guides are mostly but not always in "Reference", and guides related to deploying agents are in /agents. Since the "Deploy Agents with Terraform" guide has to do with agents, and not dynamic resources, I put it in the /agents section.

I can see how this would be confusing if you're looking for all content related to Terraform. In general, the docs are inconsistent in where they store reference information, so I'm not sure of a good solution for the reference guide without taking more time to look at this.

On my 4k monitor at the default zoom, the left sidebar already extends past the bottom of the viewport—I'm also not sure if we can accommodate more sidebar sections, but it might be worth looking into. Would it make sense to promote the "Dynamic Resources" docs to a top-level section that includes content for the Kubernetes operator and Terraform provider?

Copy link
Contributor

@Tener Tener Mar 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't for the life of me navigate around the docs hierarchy myself. I'll typically just ask AI bot for pointers rather than hunting the menus. I'd really appreciate if you could simply cmd-f to find strings in there... But deeper items are permanently hidden, and the folded parts of the menu are not searched.

Copy link

🤖 Vercel preview here: https://docs-i7lunvcri-goteleport.vercel.app/docs/ver/preview

Copy link

🤖 Vercel preview here: https://docs-qnmtjfek8-goteleport.vercel.app/docs/ver/preview

Copy link

🤖 Vercel preview here: https://docs-euen0ze50-goteleport.vercel.app/docs/ver/preview

Closes #9720

Add a guide to importing Teleport resources into Terraform. While it is
mostly straightforward to add an `import` block, determining the ID to
use for each resource requires some planning, since the ID depends on
the resource type.

This change also edits the Terraform provider guide, since testing out
this guide was required to test out the resource import workflow:

- Minor style and readability tweaks.
- Remove the `-f` flag in `tctl create`: This way a user doesn't
  accidentally override an existing `terraform` role
- Add a `tbot` data directory in an unprivileged path in the working
  directory of the setup script. This way, we don't need to give
  `teleport` ownership of the default Machine ID output directory.
- Fix identity file paths. These should point to a file called
  `identity` in the `terraform-identity` directory.
- Edit the "Next steps" section to point to the resource import guide.
- Edit the "Terraform Provider" guide title to describe the purpose of
  the guide more explicitly, distinguishing it from the new guide.
- Describe general rules for finding the ID of a resource, rather than
  using a comprehensive table.
- Incorporate the import instructions into the setup guide. This way, we
  don't need to clarify the relationship between two guides, which
  wasn't entirely clear at the outset.
- Add a more explicit benefit statement for importing resources.
- Use the `-v` flag in `rm` commands
Copy link

github-actions bot commented Apr 1, 2024

🤖 Vercel preview here: https://docs-452fn4heg-goteleport.vercel.app/docs/ver/preview

@ptgott
Copy link
Contributor Author

ptgott commented Apr 1, 2024

@Tener @r0mant Friendly ping if you have a moment for a second round of feedback. The change only modifies a single file now (the getting started guide to the Teleport Terraform provider), so while information architecture of our Terraform content is still something we need to improve, I would argue that it's less relevant to this specific PR.

Copy link

github-actions bot commented Apr 2, 2024

🤖 Vercel preview here: https://docs-gdfc0lt9b-goteleport.vercel.app/docs/ver/preview

@ptgott ptgott added this pull request to the merge queue Apr 8, 2024
Merged via the queue into master with commit b32cbd7 Apr 8, 2024
35 checks passed
@ptgott ptgott deleted the paul.gottschling/9720-import branch April 8, 2024 12:42
@public-teleport-github-review-bot

@ptgott See the table below for backport results.

Branch Result
branch/v15 Create PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/branch/v15 documentation no-changelog Indicates that a PR does not require a changelog entry size/md
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Document how to import existing Teleport resources with Teleport Terraform Provider
3 participants