Skip to content

RFD 0173: Authenticating the Terraform Provider with MachineID#42868

Merged
hugoShaka merged 9 commits intomasterfrom
rfd/173-terraform-machine-id
Jun 27, 2024
Merged

RFD 0173: Authenticating the Terraform Provider with MachineID#42868
hugoShaka merged 9 commits intomasterfrom
rfd/173-terraform-machine-id

Conversation

@hugoShaka
Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot requested review from lxea and tigrato June 12, 2024 18:02
@github-actions github-actions Bot added rfd Request for Discussion size/md labels Jun 12, 2024
@github-actions
Copy link
Copy Markdown
Contributor

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.

@github-actions
Copy link
Copy Markdown
Contributor

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.

@hugoShaka hugoShaka requested review from Joerger, klizhentas, r0mant, strideynet, thedevelopnik and xinding33 and removed request for lxea and tigrato June 12, 2024 18:26
@hugoShaka hugoShaka self-assigned this Jun 12, 2024
@hugoShaka hugoShaka added the no-changelog Indicates that a PR does not require a changelog entry label Jun 12, 2024
Comment thread rfd/0173-terraform-machine-id.md Outdated
Comment thread rfd/0173-terraform-machine-id.md Outdated
Comment thread rfd/0173-terraform-machine-id.md Outdated
Comment thread rfd/0173-terraform-machine-id.md Outdated
Comment thread rfd/0173-terraform-machine-id.md Outdated
Co-authored-by: Brian Joerger <bjoerger@goteleport.com>
Comment thread rfd/0173-terraform-machine-id.md
Comment thread rfd/0173-terraform-machine-id.md
Comment thread rfd/0173-terraform-machine-id.md
Comment thread rfd/0173-terraform-machine-id.md Outdated

Depending on their license, Teleport customers can have clusters dialing home and reporting usage.
We can leverage this to report metrics from the auth. An option would be to add an annotation on the bot resource such as
`teleport.dev/integration: terraform` or `teleport.dev/usage: terraform`. Potential values could be expanded as we add
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Annotation strategy would work fine for your bootstrapping, but if someone set up a Bot/Token themselves, we wouldn't necessarily be aware.

}
```

Telemetry would be gated by the `TELEPORT_ANONYMOUS_TELEMETRY=1` environment variable.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

FWIW: Uptake on anonymous Telemetry remains fairly low

- the fact `bootstrap` is only usable on local laptop. It requires a valid `~/.tsh` profile and the ability to pass an
MFA challenge (when MFA4A is enabled, which we are pushing everywhere and is Cloud's default). Intensive CI usage will
use existing bot resources and the `onboarding` configuration.
- the bootstrap resource expiry, by default 1 hour.
Copy link
Copy Markdown
Contributor

@thedevelopnik thedevelopnik Jun 14, 2024

Choose a reason for hiding this comment

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

Am I reading this correctly as the bots from bootstrap being removed after 1 hour, not just the local certs having a 1hr TTL?

I know when I'm first trying a new thing out with Terraform, or even first trying out a new IaC tool (and for some small number of people we may be the first thing they use Terraform with), I can easily end up running terraform apply several times per minute to get this freaking thing working, but I think an hour is a good default. I probably wouldn't create more than ~80 bots during that time. If this is just the local TTL though, and the bots hang around on the backend, this is my notification that I could easily create ~80 bots in an hour. Several days in a row. I'm often dumb in very specific ways that make me great for testing edge cases 😄 .

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

You're correct, this si the resoucre TTL, not the certs. So I don't expect more than a 100 bots in a very intensive setup session. This is noisy, but should not impact performance. We can add a GET call beforeto count the bots and limit their number if needed (e.g. 20 bots max)

@hugoShaka hugoShaka requested review from Joerger and strideynet June 17, 2024 19:58
Copy link
Copy Markdown
Contributor

@klizhentas klizhentas left a comment

Choose a reason for hiding this comment

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

my only question is whether we can group those bots to view properly in TAG, so they don't pollute the view and other stats.

Comment thread rfd/0173-terraform-machine-id.md Outdated
Comment on lines +116 to +120
##### Note regarding CGO

The Terraform provider is currently built without CGO but `tbot` depends on `lib/auth`, which depends on `lib/services`
which depends on CGO. As CGO is not supported in Hashicorp Terraform Cloud, the embedded tbot
will rely on the work currently done by @rosstimothy and the MachineID team to remove the CGO dependency from tbot.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is no longer true on master or any supported release branches. I've got PRs out now to make building tbot use CGO_ENABLED=0 by default.

Copy link
Copy Markdown
Collaborator

@r0mant r0mant left a comment

Choose a reason for hiding this comment

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

lgtm with a few questions/nitpicks

Comment thread rfd/0173-terraform-machine-id.md Outdated
Comment on lines +101 to +104
joining = {
token = "gha-runner"
method = "github"
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

What would this look like if I want to test the provider locally from my laptop?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

You cannot join locally because you don't have any delegated join methods available.
Joining is reserved for delegated joining because we don't store the state, so secret-based bot would be single use.

To run TF locally you would use the tctl terraform-helper and the terraform section would be empty.

Comment thread rfd/0173-terraform-machine-id.md Outdated
Comment thread rfd/0173-terraform-machine-id.md
Comment thread rfd/0173-terraform-machine-id.md Outdated
Comment thread rfd/0173-terraform-machine-id.md Outdated
Comment thread rfd/0173-terraform-machine-id.md Outdated
Comment thread rfd/0173-terraform-machine-id.md Outdated
@public-teleport-github-review-bot public-teleport-github-review-bot Bot removed the request for review from xinding33 June 26, 2024 21:50
@hugoShaka hugoShaka enabled auto-merge June 27, 2024 21:07
@hugoShaka hugoShaka added this pull request to the merge queue Jun 27, 2024
Merged via the queue into master with commit 1598337 Jun 27, 2024
@hugoShaka hugoShaka deleted the rfd/173-terraform-machine-id branch June 27, 2024 21:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-changelog Indicates that a PR does not require a changelog entry rfd Request for Discussion size/md

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants