-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Refactor Terraform credential loading #44037
Refactor Terraform credential loading #44037
Conversation
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 |
abec015
to
397b7de
Compare
3a97915
to
5d3f724
Compare
@marcoandredinis I addressed all your feedback and also caught a breaking change: the provider used to fallback to the local profile when no credential is specified. This makes everything super slow but I can't just break this in v16. I implemented a backward compatible behaviour in this PR and will remove it in v17. |
645fc09
to
cbdd0d8
Compare
🤖 Vercel preview here: https://docs-itxc1qiny-goteleport.vercel.app/docs/ver/preview |
@hugoShaka See the table below for backport results.
|
* Refactor Terraform credential loading * Warn about expiry * kip expired credentials * fixup! kip expired credentials * Use constants everywhere + add godocs * fixup! Use constants everywhere + add godocs * Address marco's feedback * fixup! Address marco's feedback * tidy go mod * lint * re-render TF docs
* Refactor Terraform credential loading * Warn about expiry * kip expired credentials * fixup! kip expired credentials * Use constants everywhere + add godocs * fixup! Use constants everywhere + add godocs * Address marco's feedback * fixup! Address marco's feedback * tidy go mod * lint * re-render TF docs
* Refactor Terraform credential loading * Warn about expiry * kip expired credentials * fixup! kip expired credentials * Use constants everywhere + add godocs * fixup! Use constants everywhere + add godocs * Address marco's feedback * fixup! Address marco's feedback * tidy go mod * lint * re-render TF docs
* Refactor Terraform credential loading * Warn about expiry * kip expired credentials * fixup! kip expired credentials * Use constants everywhere + add godocs * fixup! Use constants everywhere + add godocs * Address marco's feedback * fixup! Address marco's feedback * tidy go mod * lint * re-render TF docs
* Refactor Terraform credential loading * Warn about expiry * kip expired credentials * fixup! kip expired credentials * Use constants everywhere + add godocs * fixup! Use constants everywhere + add godocs * Address marco's feedback * fixup! Address marco's feedback * tidy go mod * lint * re-render TF docs
) * Introduce the `tctl terraform env` command (#43664) * Introduce the `tctl terrafor env` command * fix tests * address marco's feedback + use correct b64 lib * add license * add created-by label as specified in the RFD * Update tool/tctl/common/terraform_command.go Co-authored-by: Roman Tkachenko <roman@goteleport.com> * Apply suggestions from code review Co-authored-by: Roman Tkachenko <roman@goteleport.com> * Have telpeort create the Terraform default role * rename use-existing-role -> role, and stop hijacking identity.SSHCACertBytes * Make the terraform provider role a real preset, rename to 'terraform-provider' * lint * Fix tbot's invocation after rebase --------- Co-authored-by: Roman Tkachenko <roman@goteleport.com> * Refactor Terraform credential loading (#44037) * Refactor Terraform credential loading * Warn about expiry * kip expired credentials * fixup! kip expired credentials * Use constants everywhere + add godocs * fixup! Use constants everywhere + add godocs * Address marco's feedback * fixup! Address marco's feedback * tidy go mod * lint * re-render TF docs * Update v16 version in error message * Add Terraform Provider native MachineID support (#44306) * Add Terraform Provider native MachineID support * Reject 'token' join method * lint: fix imports * re-render TF docs * fix tests + add license * lint * tidy go mod * use v16 client.Expiry() function --------- Co-authored-by: Roman Tkachenko <roman@goteleport.com>
Fixes #42437
This PR refactors Terraform's credential loading to stop YOLO-ing all the credentials into the client and praying that one of them works.
Now each credential is individually tested. Terraform also lists the supported credentials and can explain why a credential is active or not.
This change will open the way for 2 other changes:
Other notable changes are:
terraform-plugin-log
to provide structured logging. We'll be able to tell the users to diagnose withexport TF_LOG=INFO
Changelog: clearer terraform-provider error and warning messages about its credentials.
Example output
No credential source
Expired credentials
Failed to build credentials
Failed to connect (teleport not running)