Knowledge Base  /  Ecosystem Partners  /  Marketplace Guides
Knowledge Base  /  Ecosystem Partners  /  Marketplace Guides

Getting started with Hashicorp Terraform

Updated by ecosystem@centurylink.com on Dec 10, 2015
Article Code: kb/574

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

  1. Install Terraform.

  2. 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.

  3. Test.
    Save the following into a file named testing.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

  1. Explore the examples.
    Additional example and resources:

  2. Start Terraforming.
    Use the provided Terraform resources to build out your infrastructure.