Introduce the tctl terraform env command#43664
Conversation
9cd1c1c to
d5fab1e
Compare
tctl terrafor env commandtctl terraform env command
9b34016 to
82d1cdb
Compare
There was a problem hiding this comment.
I don't think terraform provider needs to connect to these resources. Can we leave remove these wildcards and leave label selectors empty?
There was a problem hiding this comment.
No because of the way resource access control is implemented in teleport. You cannot see something you don't have access to. For the terraform provider or the operator to be able to reconcile those resources, they must see them, so they need to be able to access them, this is why we need the wildcards. This is mitigated by the fact the role does not grant any login.
I will add a comment about this in the code.
There was a problem hiding this comment.
Is there a "master list" of all resource kinds terraform provider supports somewhere so we can just update that list when adding a new resource?
There was a problem hiding this comment.
No, this can become the master list if we move it to presets.
There was a problem hiding this comment.
Nit: I would just name this flag --role.
|
Blocked by: #43877 (tbot doesn't build on windows) |
Co-authored-by: Roman Tkachenko <roman@goteleport.com>
Co-authored-by: Roman Tkachenko <roman@goteleport.com>
b5e9001 to
05e6380
Compare
|
@hugoShaka See the table below for backport results.
|
* 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>
* 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>
* 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>
* 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>
* 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>
) * 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>
This is the implementation of the "running Terraform locally" part of RFD-173.
Fixes #39744 on local setups.
This PR introduces a new command:
tctl terraform env. The design is described in more details in the RFD but basically the UX looks like:User documentation and reference will come in a future PR.
In addition to the few unit tests and the proxy/auth integration tests, this has been tested with a local instance (
-c teleport.yaml) and with a Teleport Cloud tenant.Changelog: Add the
tctl terraform envcommand that makes running the Terraform Provider locally easier.Changelog: Add a new role preset
terraform-providerwith all permissions required to use the Teleport Terraform provider. Any existing role with the same name will take precedence.