Terraform Cloud – Step by step configuration

I recently returned from a very successful Hashiconf 2019 where lots of new features where announces for the Hashicorp products.  Here are some of the mayor announcements.

Terraform:

  • Terraform Cloud (TFC)
    • Rebranding of Terraform Enterprise SaaS to Terraform Cloud.
    • TFC is all about collaboration. When more than 1 person starts working on a Terraform project it requires backend management of the state file and you should start orchestrating Terraform runs using a deployment pipeline.  This is all now provided by Terraform Cloud!
    • Free tier (up to 5 users)
      • User interface
      • Remote state management for storing, view and locking of state files.
      • VCS connection management
      • Collaboration on runs
      • Remote runs and applies
      • Private module registry
    • Paid tiers (more than 5 users)
      • Both the paid tiers are available for free until 01.01.2020!
      • TFC: Teams
        • Create multiple teams
        • Control permissions of users on those teams
      • TFC: Teams & governance
        • This tier is also available for free until 01.01.2020
        • Use Sentinel and Cost Estimation
        • More information and pricing on offerings available here
    • More information here.
  • Terraform clustering
    • This is only available with Terraform enterprise (TFE) and current in beta version
    • More information here.
  • Terraform Cost Estimation
    • This is available for both TFE and TFC
    • Is executed between the plan and apply phases of a TF run.
    • Can also use Sentinal to control costs with defined policies
    • More information here.

Consul:

  • It definitely felt like Consul was the new shiny toy at this years conference and the related sessions were packed.
  • HashiCorp Consul Service (HCS) on Azure
    • Native provisioning of a Consul cluster into any region through the Azure marketplace.
    • Although the Pong game live demo did not go as planned I do see the value and potential for this product!
    • Currently only available in private beta
    • More information here
  • Consul Enterprise now support VMware NSX Service Mesh Federation
    • Support for the Service Mesh Federation Specification.
    • More information here.

Now back to what we are here for…Terraform Cloud!

Continue reading

Installing the Windows Subsystem for Linux and use Terraform with VS Code

I am not a developer and have been looking for a reason to use WSL for a while and found a good use case to Terraform using VS Code on Linux.

In my opinion Hashicorp’s Terraform is the de facto choice in the infrastructure as code space just like Kubernetes is for container orchestration.  It provides the ability to version your infrastructure and automate the provisioning of your resources across different cloud vendors as well as on-premise.

To get this working requires a couple of steps which I will provide here. Also at the time of writing this I am running Windows 10 Pro, with Version 10.0.18362 Build 18362.

Install WSL:

  1. Open Powershell as Administrator and run the following command to enable this feature
    1. “Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux”
  2. Open MS store and download your favorite distribution,  I selected Ubuntu.
    1. Don’t close the store just yet and wait for the installation to complete.
      1. You can also open from command prompt by typing “Ubuntu.exe” from the distro installation folder, or selecting ubuntu from app menu.
  3. Create a UNIX username
  4. Create a UNIX password
  5. Now lets update our distro to latest
    1. Run “sudo apt-get update”
    2. Run “sudo apt-get upgrade”
  6. Done

Install Terraform on linux distro:

  1. Run the following commands to install unzip
    1. “sudo apt-get install unzip”
  2. Copy the link address to latest Linux 64-bit download from this page here
  3. Run the following command to install Terraform
    1. “wget https://releases.hashicorp.com/terraform/0.12.7/terraform_0.12.7_linux_amd64.zip”
    2. “unzip terraform_0.12.7_linux_amd64.zip”
    3. “sudo mv terraform /usr/local/bin”
  4. Run the following command to verify its has been implemented successfully
    1. “terraform version”
    2. Should show “Terraform v0.12.7” (based on the version I downloaded)

Install the Azure and AWS CLI on the linux distro

This is not necessary but super useful if you have deploying to these cloud vendors.

  1. Azure CLI installation steps
    1. Run the following command to verify its working
      1. “az -v”
  2. AWS CLI installation steps
    1. Run the following command to install
      1. “sudo apt-get install awscli”
    2. Run the following command to verify its working
      1. “aws version”

Continue reading