What is Terraform?
Terraform is a free and open source tool to manage infrastructures. Created by HashiCorp company, it's now one of the most used tool to deploy and manage Cloud infrastructures.
Infra-as-code & open source software
Terraform allows you to setup Cloud resources in a declarative way while describing target infrastructure in a configuration file. Terraform is 'state-full', which means it can keep 'status' of a deployed infrastructure. If a unique change occurs in target infrastructure description, only this change will be applied, not all servers will be re-deployed if not required.
Finally Terraform is supported by a large community of users and contributors but also by lots of Cloud providers who develop and offer solutions that allow to deploy resources through Terraform.
Why Infra-as-Code to manage your servers?
For the last few years, Infra-as-Code (IaC) is the norm to manage Cloud infrastructure using public providers.
- Infra-as-Code eases the deployment of complex infrastructures based on descriptive files which can be integrated in version control system tools (Gitlab, Github, ...).
- Infra-as-Code eases automation of deployment and regular changes, it's now easy to test prior pushing in production those changes and thus ensuring architecture changes are working as expected.
- Infra-as-Code is used to deploy virtual private servers (VPS), bare-metal servers (Dedicated Servers) and also storage and network resources.
- There's a large ecosystem of tools for Infra-as-Code, the most popular ones are : Terraform, Ansible, Packer, Chef, Puppet.
Five advantages to deploy your infrastructure with Terraform
'State-full' management
One of the main advantage of Terraform is that it's 'state-full', it keeps in memory the managed infrastructure status. During an update, minor or major, it only replays the part that needs to be updated and doesn't modify any resources or services whose configuration hasn't changed.
Predictability
It can simulate the launch of a script in advance, (with command 'terraform plan') to confirm the impact of those changes on infrastructure.
Ready-to-go Providers
Another main advantage is the huge community of users and 'Terraform Providers' which propose tools to pilot services through Terraform.
Multi-Cloud
In a context where multi-cloud is more and more popular (having multiple public cloud providers to dispatch and have redundancy of infrastructure), it's important to standardize the way to handle cloud resources management.
Standard
At Gandi, a public OpenStack API is provided with VPS servers. As Openstack provider for Terraform is available, you can natively deploy Gandi VPS Servers with Terraform.
Create VPS server with Terraform
Subscribe
Subscribe to GandiCloud VPS
Create resources
You can create resources as soon as your GandiCloud account is created . Terraform uses the Openstack public API and thus ensure that the Openstack CLI/API is setup. You can follow this guide to setup the Openstack CLI/API.
Create server
Then, the only step left is to create your first server as described here.