Closed iahmad-khan closed 5 years ago
Hi Iahmad, have you read about Terrafom's import functionality? https://www.terraform.io/docs/import/index.html can be useful in gradually adopting infrastructure into terraform.
Hi,
If I write the code for existing resources with same values and push it, it will overwrite the resources in vtm? Is it safe to do so?
On Mon, Feb 11, 2019, 9:01 AM Nick Davidson <notifications@github.com wrote:
Hi Iahmad, have you read about Terrafom's import functionality? https://www.terraform.io/docs/import/index.html can be useful in gradually adopting infrastructure into terraform.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/pulse-vadc/terraform-provider-vtm/issues/10#issuecomment-462256244, or mute the thread https://github.com/notifications/unsubscribe-auth/AM2peJHjkEgi6omq0SvZJSII42IjAZJnks5vMTFYgaJpZM4axTUR .
Yes apply from Terraform will overwrite the existing resources.
You can use the diff from terraform plan without apply to check that nothing unexpected is going to change and that your resource definition is complete.
Terraform like many dev-ops style solutions doesn't expect resources to change under its feet, but by paying careful attention to the output of plan / apply you should be able to tell if you've missed a setting in your resource definition or if someone changes the resources directly after you've migrated some of the configuration.
If you're considering gradually migrating a manually managed vtm into terraform then the following strategy may help:
For example if you are intending to migrate the virtual server staging_vs
, rule ssl_redirect
and pool staging_pool
you could add the tf_
prefix so they become: tf_staging_vs
, tf_staging_ssl_redirect
and tf_staging_pool
.
I am trying to convert all the existing configuration to terraform , and wonder if there is some way to convert the json representation of existing resources into terraform code?