Menu

Virtual Geek

Tales from real IT system administrators world and non-production environment

Blog posts : "devops"

Terraform filter map and list object with if condition in for_each loop examples

In terraform there is no actual if else condition block. But still you can use if condition to filter map or list of objects to get the required keys or values. In below example I have scenario where I wanted to create Resource Group in Azure to defined locations only. Incase no data is provided or…

Read more

Terraform variable precedence and priority

This is a informational article on how the variable precedence works in Terraform. This is how the priority is defined for variable when you use it in different ways. In the following diagram, it shows the information of variable priority matrix. Lower the number it has higher the priority and it w…

Read more

Terraform Force-Unlock Command and Unlocking State file on Azure backend with PowerShell

While working on collaborative environment of Terraform deployments, you might encounter an error of acquiring the tf state locking issue. In Terraform word when backend is configured to store state file on remote. It limits multiple users from making changes to environment at the same time to avoid…

Read more

Configure Azure Storage Account Blob as Terraform backend to store tfstate file

In the HashiCorp Terraform context state file is a crucial file when deploying resources through terraform configuration tf file. State file's extension is .tfstate. It is a JSON information/documentation that stores and records details about your organization infrastructure and its configuration. …

Read more

Terraform variable validation example

In Terraform, the can function is used to determine whether a given expression or operation can be evaluated without causing an error. It returns true if the expression can be evaluated without errors, and false otherwise. This can be particularly useful for handling optional or dynamic attributes t…

Read more

Terraform create Azure Virtual Machines from map of objects

I had a task to create multiple Ubuntu Virtual Machines on Microsoft Azure using Terraform. Below is the code for the same. Requirement was VM information should be put into variable with type of map object (Multiple VMs will be created using it). Another requirement was there is already core infras…

Read more

Creating a Private Endpoint for Azure Storage Account with Terraform example 3

This is third part of the script and little bit improvement and 2 separate logics I have added to the script. It is modification of earlier written part Creating a Private Endpoint for Azure Storage Account with Terraform example 2. In the script I wanted to create multiple endpoint for sub resourc…

Read more

Creating a Private Endpoint for Azure Storage Account with Terraform example 2

This part is a revised earlier article of Terraform Azure Create Private Endpoint to existing Storage Account with Custom Private DNS zone record link. when I raised PR (Pull Request) for this configuration, Reviewer asked me to make some changes such way that while creating Private Endpoint, name …

Read more

Using element function with count meta argument example Terraform Azure subnets

I had a task to deploy multiple subnets to a Azure Virtual Network (vNet) using Hashicorp Terraform HCL. I wanted to test and use element() function combination with count meta argument to do the simple POC with less code and automation. Here is snapshot of my Virtual Network's Subnets view in the p…

Read more

Creating a Private Endpoint for Azure Storage Account with required sub services using Terraform

This is a second part of Terraform Azure Create Private Endpoint to existing Storage Account with Custom Private DNS zone record link. This article is little bit advance, and here I am creating multiple Private Endpoint based on the provided details in Storage account kind. For example if kind is

Read more

Terraform Azure Create Private Endpoint to existing Storage Account with Custom Private DNS zone record link

I had a task to create Private Endpoint in Microsoft Azure and was requirement to automate this job using HashiCorp Terraform automation tf configuration files. This Private endpoint will be linked to existing Storage Account and Virtual Network. Other required sub resources Virtual Network Links

Read more

Adding parameters in Azure DevOps pipelines examples Part 1

This is an example of how to use parameters in Azure DevOps Pipeline YAML configurations. To start with this I have added first parameters: in the YAML file configuration. Under it I have multiple parameters, to create basic string parameter 3 properties are required name, displayName and type as …

Read more

Reboot remote Linux server from PHP PowerShell web server

This web portal is part of Executing a Linux programs from PHP web server. In earlier part I used only PHP to remotely execute commands on Linux server. In this it is a combination of PHP and PowerShell. Once you launch portal you will need to provide Domain username and password to authenticate an…

Read more

Executing a Linux programs from PHP web server

This is a small web automation project I created to execute remote Linux command through web server. The web language I used in this project is PHP (It is little similar to PowerShell so I was able to grasp it quickly and code the way I want). 

Using this tool users without having access to Linu…

Read more

Azure DevOps Enable creation of classic build release pipelines grayed out

While configuring new Azure DevOps pipelines in the project I found classic editor is not visible in Pipelines section also few options under Pipelines were not visible such as releases and task groups. There is s a option to enable classic editor in Project Settings. To make changes navigate to P…

Read more

Terraform count vs for_each for examples with map of objects

In this Terraform article I have two examples for loop and count loop. I have one map of object. Where I will use both the loops on map to show how to use them in different way. You can check my earlier articles for different loops examples - Terraform for_each loop on map example and Terraform…

Read more

Terraform remote-exec provisioner with ssh connection in null_resource

This is a Terraform example of remote-exec provisioner with ssh connection using null_resource. To use remote-exec you need to provide remote server connection information. In my below example I am using and creating connection with ssh protocol to linux servers with terraform configuration. If you …

Read more

Terraform deploy create A Private DNS Record in Microsoft Azure from list of objects

This is an example of creating multiple private DNS records in Microsoft Azure from list of objects. Here I am starting with variables.tf, I am using below list of objects as type in variable.

#variables.tf
variable "dns_records" {
  type = list(object({
    name                =

Read more

Terraform testing variable map object values without resource configuration part 2

This is second part of earlier written article Terraform testing local variables and output csv file without resource Part 1. Idea is use same method technique to learn and verify how to assign map of object works. Below is the example of variable map object and its output.

I used this map obje…

Read more

Terraform testing local variables and output csv file without resource Part 1

This is article is about how I test and verify my maps, list, object and sets values without any resources and to check provided objects are mentioned correctly. Here in below example I wanted to test csv file content in terraform. To check the same I created local variables from CSV file and watch …

Read more

20 blog posts

Blog Search

Page Views

12085990

Follow me on Blogarama