Terraform multicloud orchestrator version 1.0

Beautiful Arrangement

Working with Terraform

In addition to the easily understandable configuration language, the simplicity of Terraform's operations is pleasing. Apart from terraform, you need nothing else to get started. How exactly does this work look?

One central theme in the Terraform world is the plan, short for the "execution plan," which contains all the steps you want Terraform to carry out. Enabling a plan comprises several steps; fortunately, they are quite simple and occur in a logical sequence.

The first step is to create a .tf file, which, as already mentioned, creates the state you want the installation to achieve. The .tf file lists the modules and providers to be used. Although you can find many prebuilt modules for Terraform online, you might need a local module for special functions. If need be, you can include your local modules in a state file directly through the local filesystem.

For any files that do not already exist locally, the terraform init command brings in all the modules and providers that Terraform needs. After that, the terraform apply command sends Terraform Core on its way to roll out the resources described in the state file. The plan is then considered executed and the resources are running.

Terraform 1.0

As mentioned before, the Terraform developers recently released version 1.0 of their software. Anyone familiar with the release cycles of other solutions would expect massive innovations and quantum leaps in the feature set at this point, but that is not the point of Terraform 1.0. In an approach similar that frequently practiced by Linux inventor Linus Torvalds, the Terraform developers simply assign the 1.0 version number to a release of the 0.15 branch at some point.

After more than 10 years of development, HashiCorp finally considers its own protégé ready for production. Moreover, Terraform 1.0 does not require you to migrate from previous versions. Anyone using 0.15 can switch to 1.0 without fear of failure. A few key differences are evident between Terraform 0.15 and 1.0, though. The developers promise significantly longer maintenance cycles for Terraform 1.0 than for previous versions. Bug and vulnerability fixes for the 1.0 branch will take place for at least 18 months.

CI/CD Integration

An article about Terraform 1.0 would not be complete without mentioning the solution's advanced continuous integration and continuous delivery (deployment) (CI/CD) integration. This practice is especially important for workloads in clouds and containers. If you already implement infrastructure as code (IaC) (i.e., you describe the environment in the Terraform language), then you will probably also want tests and automatic production deployment when you make a change to the Git directories containing the environment description. Terraform, especially in the form of its cloud products, offers interfaces to GitHub (Figure 4). However, DIY solutions based on Jenkins are not a problem.

Figure 4: If you combine Terraform with a pipeline for CI/CD environments such as Jenkins, Git commits immediately trigger changes to running resources on demand. © Google

Setups like those described make life easier for admins. If you change the description of the infrastructure in the template, GitHub first sends a corresponding message to Terraform. Terraform immediately performs a syntax check and checks whether the new resource specification is plausible and can be implemented in the cloud. After successfully completing all these steps, Terraform then executes an apply for the new plan at the end of the pipeline, bringing the environment into line with the target. Of course, Terraform is designed out of the box to make as few changes as necessary to the running resources.

For example, if you change the configuration of a database-as-a-service (DBaaS) instance in AWS, Terraform does not clean it up in the context of a CI/CD pipeline and create it with a new configuration. Instead, Terraform adapts the configuration of the running instance to bring it back into compliance – or outputs an error message if that doesn't work.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy ADMIN Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

comments powered by Disqus