How Do You Install and Configure Terragrunt on a Linux Machine?

Prerequisite
Install make. If you need assistance, see this posting.

Procedures
Run these three commands:

curl https://github.com/gruntwork-io/terragrunt/releases/download/v0.35.18/terragrunt_linux_arm64 –output /tmp/terragrunt_linux_arm64

sudo mv -i /tmp/terragrunt_linux_arm64 /bin/terragrunt

sudo chmod u+x /bin/terragrunt …

How Are Provisioners Different from Providers in Terraform?

Question
The terms provisioner and provider seem similar. How would one be compared versus the other? Are provisioners and providers in Terraform the same? If not, how are they different?

Answer
Provisioners in Terraform run commands and do various things to a given server (e.g., transfer a file, run a shell command, run chef-client commands). (This was taken from page 213 of Terraform: Up &

How Do You Troubleshoot the Terraform Error ‘unsupported argument aws_key_pair’?

Problem scenario
You run a terraform command. You get ‘unsupported argument aws_key_pair’. You want terraform to create an EC-2 server with a specific key pair. What should you do?

Solution
Don’t use “aws_key_pair”, use “key_name”. The aws_instance section in a .tf file uses a different keyword. (The aws_key_pair is for creating an key-pair in AWS.) Use the “key_name” field for aws_instances like this:

resource “aws_instance” “example” {
ami = “ami-01a1234abcd567”
instance_type = “t2.micro”
key_name = “appleorange”
} …

What is Writing Your Own Provisioner in Terraform?

Question
You have heard there is such a thing as customer provisioners (not providers) in Terraform. What is a custom-built provisioner in Terraform?

Answer
There are generic provisioners such as “file”, “local-exec”, and “remote-exec”.

To learn about provisioners, see this: https://www.terraform.io/docs/language/resources/provisioners/

Custom provisioners exist; you can create your own provisioner beyond the generic three (“file”,

How are Provisioners in Terraform Different from User Data?

Question
How are Terraform provisioners different from Terraform User Data? Both usually involve scripts to customize a server.

Answer
Provisioners have built-in support for CM tools and can have scripts longer than 16 KB; these things are not true with User Data. (This was taken from page 213 of Terraform: Up & Running, 2nd Edition by Yevgeniy Brikman (O’Reily),

How Do You Find the Working Directory in an Azure DevOps Release Pipeline?

Problem scenario
A Terraform task is failing in an Azure DevOps release pipeline. You cannot see a variable setting for the working directory. How do you determine the working directory?

Solution
Go to Edit your release pipeline. Go to “View YAML” in the upper right hand corner. Search for “working”. You should see it (e.g., as workingDirectory).

The working directory key probably has a value that is a variable (e.g.,

How Do You Create a File on a Server with Terraform?

Problem scenario
You are trying to get user data to create a file on a server in Terraform. It is in a directory that requires sudo privileges. You use the “sudo” command in the Bash script. The Bash script executes except a file is never transferred. How do you get Terraform to copy a file to a new server?

Solution
Use the Terraform-supported cloud_config option instead of having a Bash script transfer the file.

How Do You Troubleshoot Terraform Commands That Do Not Seem to Use the -var-file= Flag Passed to Them?

Problem scenario
You want to pass the var-file flag in a Terraform command. You have a different configuration/variables file (from the default one) that you want the Terraform command to use. The resulting error indicates that there is insuffient configuration data; the behavior is consistent with no variables files being readable.

How do you get a terraform plan command to look at a different folder location or directory?

A List of Terraform Books

1492046906Terraform: Up & Running: Writing Infrastructure as Code by O’Reilly Media

B08H8XD9W4Terraform Cookbook: Efficiently define, launch, and manage Infrastructure as Code across various cloud platforms by Packt Publishing

1098114671

Infrastructure as Code: Managing Servers in the Cloud by O’Reilly Media

1838642730Learning DevOps: The complete guide to accelerate collaboration with Jenkins, Kubernetes, Terraform and Azure DevOps by Packt Publishing

1491977086Terraform: Up and Running: Writing Infrastructure as Code by O’Reilly Media

B08FYSXCC2HashiCorp Certified: Terraform Associate Practice Test

B01MZYE7OYThe Terraform Book by Turnbull Press

B07V1JHDGSLunchtime Labs: Terraform with AWS: Streamline your infrastructure operations | Learn how to use the Terraform Infrastructure as Code (IaC) tool to manage AWS in a Lunchtime