Terraform and ClickOps question

Soldato
Joined
18 May 2010
Posts
23,139
Location
London
We have been having issues with a cluster of database servers at work which where provisioned with terraform.

They needed to up scale the instance sizes, and that has been done through the console via click ops.

I updated the terraform configuration with the updated instance type, but as I suspected TF wants to destroy the instances and recreate them.

It occurred to me today after work maybe I can just edit the state files with the new instance sizes?

The terraform config also deals with route53 dns records too, but as long as tf thinks the instances haven't changed then I hope it will stop complaining that it needs to destroy and recreate the dns records as well.

What do you think?
 
Last edited:
Have you imported the infrastructure not created via IaC into Terraform? If not I'd do that first, is it then wanting to recreate them?
 
I think you want terraform apply -refresh-only
Should update your state file with what's currently live.
Don't do this, it will still destroy and apply.

The TF Plan will tell you why the instance wants to destroy and replace. You need to understand what else (other than the instance) TF is wanting to change.
 
Thanks guys.

Luckily it wasn't as hard as I feared. It was the ami that was the reason why TF wanted to destroy erase.

After I pinned the ami version it was ok.

I was fearing I'd have to manually edit the state files.
 
Last edited:
Back
Top Bottom