You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
If you are interested in working on this issue or have submitted a pull request, please leave a comment
Description
I would like to have a new command in the Scaleway CLI that allows exporting existing resources from a specified Scaleway project into a Terraform template. Additionally, it should generate the corresponding terraform import statements, so we can easily bring existing resources into a Terraform-managed state without manually writing each resource definition and import command.
This feature would be especially helpful for teams migrating from a manual configuration or other tooling to Terraform, as it would significantly reduce the time and potential errors involved in translating existing infrastructure into Terraform code.
How I imagine scw could expose this functionality
A possible example command:
scw project export-terraform --project-id <PROJECT_ID> --output-file <FILE_NAME> --project-id <PROJECT_ID>: specifies the Scaleway project from which to extract the resources. --output-file <FILE_NAME>: specifies the path and file name where the generated Terraform code should be saved (e.g., main.tf).
The command could also generate an accompanying file (or additional output) containing the import commands, for instance:
terraform import scaleway_instance.server_id <resource_id>
and so on for each resource found in the project.
This way, a user can run something like:
scw project export-terraform --project-id <PROJECT_ID> --output-file main.tf
Inspect/update main.tf as needed.
Run the import commands generated by the CLI to populate their Terraform state.
The text was updated successfully, but these errors were encountered:
Thanks a lot for the feedback, we already started with @Codelax with a draft of a similar features. New features coming in terraform might also help bring an easier integration.
Community Note
Description
I would like to have a new command in the Scaleway CLI that allows exporting existing resources from a specified Scaleway project into a Terraform template. Additionally, it should generate the corresponding
terraform import
statements, so we can easily bring existing resources into a Terraform-managed state without manually writing each resource definition and import command.This feature would be especially helpful for teams migrating from a manual configuration or other tooling to Terraform, as it would significantly reduce the time and potential errors involved in translating existing infrastructure into Terraform code.
How I imagine scw could expose this functionality
A possible example command:
scw project export-terraform --project-id <PROJECT_ID> --output-file <FILE_NAME>
--project-id <PROJECT_ID>
: specifies the Scaleway project from which to extract the resources.--output-file <FILE_NAME>
: specifies the path and file name where the generated Terraform code should be saved (e.g., main.tf).The command could also generate an accompanying file (or additional output) containing the import commands, for instance:
terraform import scaleway_instance.server_id <resource_id>
and so on for each resource found in the project.
This way, a user can run something like:
scw project export-terraform --project-id <PROJECT_ID> --output-file main.tf
Inspect/update main.tf as needed.
Run the import commands generated by the CLI to populate their Terraform state.
The text was updated successfully, but these errors were encountered: