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

Building Quarkus native images. You can do it too!

If you read the Quarkus native build page, it should be a breeze: enable -Pnative and there we go! Well… not so fast. Not so fast at all, as they recognize in another “Quarkus native tips” page, unfortunately not linked from the first one (so good luck googling for it). And boy do you need those tips…

I had this application happily running for months and while at the beginning there were some recognized issues with native generation on Windows, nowadays the general expectation was it should work. So I updated all dependencies and started a painful three days long trip, but hey no pain no gain right?

Here’s what it required:

Continue reading

Poor man’s static web site protection in AWS S3 (with Terraform)

We’re talking internet so arguably the best protection would be to not use it at all, but here we are, serving static files from AWS S3 and hoping not every site and forum is going to link to them. Why? Because we’re the ones paying the AWS bills, aren’t we.

Continue reading

AWS SDK for Java v2 – so simple they saved on documentation

The version 2 of the AWS Java SDK is much less documented than the first one. Okay it’s newer so there are less blogs and projects, obviously, but finding official code examples with v2 on AWS sites is a real struggle. Luckily, using the SDK has become much simpler and straightforward.

Continue reading

Automated AWS provisioning with Fabric

One of these days I decided to give a try to an opensource project which happens to run only on Linux. This sounds like nothing special unless your development machine happens to be Windows 7 and you don’t want to bother with downloading and maintaining virtual images. True, Vagrant would be a good option but getting it (and VirtualBox) to work with my enterprise-grade proxy access is a real PITA. Add to that the less-than-maintained vagrant-proxyconf plugin and the zillions of tools every one with own config files for proxies (gradle, git, maven, you-name-it)… Not at least, a local virtual machine is local and we’re heading to a cloud-based society right? So, AWS to go! Continue reading