hashicorp-services/tfm

Generate Terraform Import Code for TFM Created Resources

jeffmccollum opened this issue · 4 comments

In the destination environment after TFM has completed a migration, new workspaces, teams, and variable sets will have been created. While this is great for the migration, this leaves Day 2 operations in a more difficult spot, as these resources are not being managed by Terraform.

It would be great if TFM could generate Terraform import statements for all resources that TFM Creates during a migration!

Is the idea here to generate the tfe_ resources? that is a really good idea

maybe instead of generating import statements you could generate import blocks

Yep, goal would be to auto generate these resources, tfe_workspace, tfe_variable_set, tfe_team and others that tfm would create.
Now the question that we are still thinking, is for generation of the terraform code, we could build the raw resources, 1 to 1 or we could do something like building a variable map and call a module (https://registry.terraform.io/modules/alexbasista/workspacer/tfe/latest) with a for each. What would you like to see?
Yes, definitely using the latest import blocks, use to old import method :)

cool find on workspacer. i built something similar when i was at AWS. at my current employer we use this module: https://github.com/aws-ia/terraform-tfe-workspace-orchestrator

i guess i would prefer an unopinionated integration, just straight up resources. unless yall plan to maintain a module

@jeffmccollum we're going to start using and recommending workspacer so i agree - push forward with that one!