Do You Need Terraform to Deploy a New Version to Existing VMs?

For a routine WAR release where VM count, network and disks stay the same, installing files and checking the application server is enough to build the deploy. On days that need new VMs and target groups, put the infrastructure change process in front. How to split work by what actually changes, and how to pick one owner for routing values.

John Baek
John Baek
Founder, CollabOps
2 min read

Every Thursday, a new WAR goes onto the same four VMs. The VM count doesn't change. Neither does the network or the disks. The team wants to automate this, and the first meeting burns its time debating whether to adopt Terraform. In this case, you can build the deploy entirely out of installing files on existing VMs and verifying how the application server behaves.

It's a different story if this release requires a new Green group on the business network, a connection to a new subnet, and a new load balancer target group. Now there's infrastructure you'll need to reproduce next month. Both requests were called "a deploy," but they change different things. Running the Green group itself is covered in can you do blue-green on existing VMs and WAS without Kubernetes?.

The scope of deploy automation should be set by what the work actually changes (infrastructure resources, application files, running services, routing values), not by the fact that someone called it "a deploy."

Which process should own each kind of change?

This jobWhat changesProcess that can own it
Create two Green VMs and a target groupInfrastructure resources and their wiringTerraform or the organization's infrastructure change process
Install the approved WAR on existing VMsApplication filesDeploy pipeline or the existing WAS deploy tool
Restart each instance and check business behaviorRunning servicesService manager plus deploy pipeline
Switch traffic between existing Blue and GreenLoad balancer routing valuesWhichever network or deploy process owns that value

Terraform does have provisioners that copy files and run commands. HashiCorp, though, explains that Terraform can't model the results of such actions predictably, and recommends looking at a purpose-built tool first (Provisioners are a Last Resort). On the other hand, if your operating model replaces instances with a new VM image every time, a change of image version naturally becomes part of the infrastructure deploy.

Who should own the routing value?

The routing value should have exactly one source of truth. Surprisingly, the last row of the table is where incidents tend to happen. Friday night, the deploy pipeline switches the target to Green. Monday morning, the infrastructure team applies an unrelated change, and the Terraform configuration still says Blue. If routing values are under Terraform's management, the next apply can flip the target back. The two teams need to agree which system holds the source of truth for that value.

How do you scope the first automation project?

To scope the first project, lay out one recent deploy and mark which rows actually changed. If only file replacement and restart are marked, automate those two rows first. On days that need new VMs, put infrastructure change approval in front. Split that way, the first project's scope and each team's operating responsibilities are easier to pin down.

  • #legacy-deploy
  • #terraform
  • #infrastructure
  • #vm
  • #deployment