Lessons learned after losing the Terraform state file

Terraform is a infrastructure-as-code (IaC) tool where you describe the desired pieces of infrastructure you need in some config files, then Terraform will create the infrastructure in your cloud provider of choice. Or delete them, or modify them – because Terraform compares the cloud infrastructure state with the expected one. And the expected state is kept in… a state file, right. So if the state file gets lost, Terraform will think it never created those resources in the first place and will try to duplicate everything. Do you see the problem here? Not only your infrastructure will cost double, but you’ll get also all kind of nasty overlappings and cross-pollination between previous and fresh resources and versions. We definitely don’t want that.

Continue reading
Advertisement

Reading in from CSV numbers into strings with Jackson

Reading data from CSV, nothing simpler in Java with all those Jackson tutorials out there. Unless you want to read everything as string, that is. CsvMapper will take anything looking like a number and try to map it into some Integer or whatever, and if you needed strings in that field, well, too bad. Crash.

Continue reading