Showing posts with label terraform. Show all posts
Showing posts with label terraform. Show all posts

Sunday, September 8, 2024

Advanced Input Variable Validation with Terraform

Terraform provides a variable validation feature that allows defining conditions to validate variable inputs. Previously, variable validation only allowed validating the input of the variable itself. However, starting with Terraform 1.9, this feature has been enhanced to allow the addition of validation conditions that reference other input variables and objects. This blog presents a simple example that explains how to add a condition to one variable that references another variable.

Pre-requites: Terraform 1.9 or greater

The following sample script is used to create two Azure resource groups. One in the West Europe region and the other in the East US region. The two resource groups should not be created in the same region.

Sunday, March 31, 2024

Bringing Role Assignments into Terraform State Management

Terraform is an infrastructure automation tool that keeps track of the state of your infrastructure managed by Terraform in a state file. It serves as a snapshot of the actual infrastructure. Therefore, Keeping Terraform state file up to date is crucial. If a new resource added or any manual changes are made to the actual resource, it is important to import those changes into the state file. This blog explains how to import manually added role assignment to the terraform state file.

Pre-requisites: Manually add User Access Administrator Role to the Azure resource group.

Saturday, November 18, 2023

Verify Terraform Configurations Using Terraform Test

This blog explains how to use the terraform test framework to verify that new changes do not break existing resources. 

Pre-requisites: Follow this blog and configure a terraform project with a test file.

The sample terraform project configure a resource group and a storage account in Azure.



Sunday, November 5, 2023

Getting Started with Terraform Test

This blog explains how to use new terraform test framework to test infrastructure automation scripts.

Pre-requisites: Install Terraform v1.6.0 or later version, Azure subscription, code editor (Visual studio code use as the code editor in this blog)

What is the use of terraform test?

Terraform has introduced new test framework which helps to achieve followings.

  • Validate terraform configuration updates and get verified new changes does not introduce any breaking changes.
  • Terraform test supports running test against test environment which allows to create short lived resources without breaking existing resources.

Tuesday, June 13, 2023

Deploy Azure Container App Environment Using Terraform

Azure container app environment is fully managed environment to run containerized applications. This blog contains terraform script that can be used to deploy Azure Container App Environment with internal only ingress which means accessible only from VNet. You can find the complete code sample in GitHub here.

Friday, September 9, 2022

Terraform State List and Terraform Graph

This blog explains two useful commands available in Terraform.

Tip 01

You might have a requirement to view resources in terraform state file to get an idea on resources already applied with your Terraform script. But, if you try to do it by reading the state file, it is not an easy task. You can get list of resources available in Terraform state file with a simple command as explain below.