Overview
After reading this article, the user should be able to provision infrastructure with
Hashicorp Terraform on Lumen Cloud.
Description
Terraform
Hashicorp Terraform – “Terraform provides a common configuration to launch infrastructure — from physical and virtual servers to email and DNS providers. Once launched, Terraform safely and efficiently changes infrastructure as the configuration is evolved.”
Audience
Terraform users wishing to deploy to Lumen Cloud. Familiarity with infrastructure automation and the Terraform toolkit are required.
Full documentation for using Terraform on CLC.
Steps
-
Install Terraform.
-
Set Credentials.
The plugin expects CLC credentials set either as env vars:CLC_USERNAME
,CLC_PASSWORD
Or via Terraform variables:
provider "clc" { username = "" password = "" account = "" # optional }
If an account is not provided, it will default to the user's primary account. A sub-account may also be specified.
-
Test.
Save the following into a file namedtesting.tf
.provider "clc" { username = "" password = "" } resource "clc_group" "web" { location_id = "WA1" name = "TERRA" parent = "Default Group" } resource "clc_server" "srv" { name_template = "trusty" source_server_id = "UBUNTU-14-64-TEMPLATE" group_id = "${clc_group.web.id}" cpu = 2 memory_mb = 2048 }
And then run
terraform plan
Terraform should report the execution plan it will lay down.
terraform apply
will execute the plan and provision cloud resources.
Check out the full options available for VMs (and other resources) on the
official docs
-
Explore the examples.
Additional example and resources:- examples * basic use
- mantl.io - mesos from terraform + ansible
- terraform.py - dynamic inventory for ansible
-
Start Terraforming.
Use the provided Terraform resources to build out your infrastructure.