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

What Is The Disambiguation of The Word “heap” in I.T.?

Problem scenario
You have read about heaps in computer programming and in operating systems. What do the different definitions of “heap” mean in I.T.?

Overview
Merriam-Webster’s Dictionary (11th Edition, on page 574) defines a heap as “a collection of things thrown one on another” or as a “pile.” The same word can have completely different meanings in English; a trash heap,

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 Do a regex Operation in Python without Importing a Module?

Problem scenario
You need a pattern matching function in a Python program, but you cannot use “import re”. What should you do?

Possible Solution #1
Use the index() function.

Here is an example:

foobar = “abcdefghijklmnopqrstuvwxyz”
print(foobar.index(‘jk’))

Possible Solution #2
Use the .starswith() function.

foobar = “abcdefghijklmnopqrstuvwxyz”
print(foobar.startswith(‘abc’))

Possible Solution #3
Use the find() function.