u/Mert1004

Hey everyone, pretty new to Terraform here so sorry if this is a dumb question.

I'm building a pipeline in Azure DevOps where someone can input parameters (VM name, static IP, username etc.) and it automatically provisions a Windows VM on Hyper-V using Terraform + Ansible.

My concern is: if I run the pipeline again to create a second VM, will Terraform destroy or modify the first one? Since it's the same configuration, I'm worried it'll try to "sync" the state and mess with existing VMs.

I was thinking of using a dynamic state file per VM name, something like `vm-$(vm_name).tfstate` stored in Azure Blob Storage as the backend so each VM gets its own state file. Is this the right approach or am I overcomplicating it?

Also using Ansible after Terraform to handle configuration (user setup, software installation) so the pipeline is fully automated end to end.

Any advice appreciated, thanks!

reddit.com
u/Mert1004 — 11 days ago