Manage single machine

The two “getting started” tutorials show how to set up terraform to be used in AWS and Azure, but I only want to use it to (re)configure a single VM that I do not have permissions to teardown/setup.

Is this possible, and how do you do this?

Hi @philmagr,

Terraform’s purpose is to create, update, and destroy infrastructure objects, which includes virtual machines. However, managing the configuration of the software on those virtual machines is not part of Terraform’s scope.

If you have an existing machine that you wish to reconfigure in-place, I think a configuration management tool is what you’re looking for. If some other system or process is already creating the VMs you wish to manage then it is performing the role that Terraform would play, and so introducing Terraform is likely redundant.

Teams using Terraform often prefer to treat their virtual machines as immutable, meaning that they are booted from a customized disk image with the software and configuration pre-populated so that the machine immediately starts doing its work at boot and continues doing so until it is shut down, without any active ongoing management. That usage pattern then allows using mechanisms like AWS autoscaling to allow the machines to be automatically replaced when they fail, etc. While this approach is not required when using Terraform – you can use Terraform to start a VM and then connect it with a traditional configuration management system – Terraform tends to be less useful in environments that consist mostly of long-lived “pet” virtual machines whose behavior is changed over time using configuration management tools.

I see. I don’t think I really understand Terraform, then.

Do the “Configuration management tools” such as chef/puppet offer the “env diff” feature of Terraform?

Each of them has different functionality, so I can’t really answer that question in general. You didn’t mention what exactly you want to do to this existing single virtual machine, so I can’t really say whether any particular tool would meet that need.

The general idea of a configuration management tool is to run in the virtual machine (or indeed, on a “real” machine) and perform tasks like installing software, creating configuration files, etc. When you said you wanted to reconfigure a virtual machine, I assumed that was the sort of configuration you wanted to do. Some use a declarative model similar to Terraform and may be able to offer something similar to “terraform plan”, but the details and constraints are likely to be different.