How Do You Troubleshoot The Terraform Error “Authentication using either SSH …must be enabled in Linux profile”?

Problem scenario
You try to run terraform apply to create an Azure VM but you receive a message like this:

Error: Error applying plan:

1 error(s) occurred:

* azurerm_virtual_machine.myterraformvm: 1 error(s) occurred:

* azurerm_virtual_machine.myterraformvm: compute.VirtualMachinesClient#CreateOrUpdate: Failure sending request: StatusCo” Message=”Authentication using either SSH or by user name and password must be enabled in Linux profile.” Target=”linux”

What should you do?

Solution
1.

 » Read more..

How Do You Use Terraform to Create a Server in GCP?

Problem scenario
You want to use infrastructure as a code with Terraform and GCP. How do you use a .tf file to create a virtual machine in Google Cloud Platform?

Solution
Prerequisite

This assumes you have installed Terraform. If you need assistance with this, see this posting.

Procedures

1. Obtain the account.json file for your GCP account.

 » Read more..

How Do You Create a Server in Azure with Terraform?

Problem scenario
You want to use Terraform to create a virtual machine in Azure. What do you do?

Solution
Prerequisites

i. Terraform must be installed on a Linux server. If you need assistance with this, see this posting.
ii. The Azure CLI must be installed and configured on the Linux server. If you need assistance with this, see this posting.

 » Read more..

How Do You Use Terraform to Create AWS Servers?

Problem scenario
You want to use Terraform to deploy EC-2 instances (VMs in AWS).  How do you do this?

Solution
These directions can work on a Linux server in your enterprise, a Linux server in Azure or a Linux server in AWS.

1.  Install Terraform.  See this link if you do not know how.

2.  Create a file like this called contint.tf with this as the content:

provider “aws” {
 

 » Read more..

How Do You Install Terraform on any Type of Linux?

Problem scenario
You want to quickly install Terraform on any type of Linux.  How do you write a single script that will work on Debian/Ubuntu, CentOS/RedHat/Fedora, or Linux SUSE?

Solution
1.  Create a file called terra.sh in /tmp/ with the content below.

#!/bin/bash
# Written by www.continualintegration.com

tfv=0.11.2  # Change this version as necessary

distro=$(cat /etc/*-release | grep NAME)

debflag=$(echo $distro | grep -i “ubuntu”)
if [ -z “$debflag” ]
then  

 » Read more..