mirror of
https://github.com/gravitational/teleport.git
synced 2026-10-12 02:15:01 +00:00
This is in preparation for migrating to non-template based Teleport resource implementations of Terraform DataSourceTypes and ResourceTypes. The existing files were moved from terraform/provider to terraform/provider/internal/legacy. The terraform driver has been decoupled from Teleport and all the hacks that the templates used. Instead the driver uses a series of optional interfaces to perform actions at specific points of the terraform lifecycle. For now, only a subset of the hooks from the legacy templates have been adapted to minimize scope. The hooks chosen were selected out of necessity for the first resources that will be migrated off the legacy templates. The other main change introduced here is around how resources are identified. The legacy templates originally assumed that all resources were only identified by name. That broke when access list members were introduced. That now also breaks for scoped resources. Identifiers used by the driver are now an interface over a generic type. There are several concrete implementations that cover the current cases for Teleport resources: A singleton identifier with a constant name, a named identifer that maps to a Teleport resource metadata name, a composite identifer that maps to a name and a prefix, and now a scoped identifier that maps to a name and a scope. Each DataSource and Resource implementation can chose the appropriate one and the driver doesn't care. This is also extensible if there comes along another resource with a different identifier shape.