Please read about variable blocks and variable types before proceeding with this blog. When it comes to providing values to variables, you may do it in the following methods, which we will go over in detail in this article. Defaults pass through console environment variables variable flags variable files Defaults These are the values you… Continue reading How to pass inputs to terraform variables
How to create resource conditionally in terraform
In this cloud era, every other resources existence is dependent on another resource. Which is nothing but conditional existence. In this blog, we will discuss about the same, How to create resource conditionally in terraform using conditional expressions. We will discuss about the same by going through examples with two different use cases. Firstly using… Continue reading How to create resource conditionally in terraform
How to use terraform blocks
In this blog, we are going to learn the anatomy and use-cases of the different types of blocks that are provided by terraform. namely the following1. resource2. variable3. output 1. Resource block The resource block is the core of terraform design patterns. with these, you will be able to create the resources. The below picture… Continue reading How to use terraform blocks
How to use existing resource in a terraform project
In a real-world situation of test-driven development, it will be a combination of developing terraform scripts and experimenting with the cloud portal. However, during this time, you may need to leverage resources produced manually on the cloud provider’s website. The two methods are to use a data block or an import statement. In this blog… Continue reading How to use existing resource in a terraform project
How to implement DRY principles in terraform with modules
DRY principles are crucial for your codebase’s scalability in any situation. If you frequently create the same components in Terraform, this blog is for you. DRY is an acronym that stands for Don’t Repeat Yourself. That is, if your code accomplishes the same objective, you should not repeat it. For example, if you construct a… Continue reading How to implement DRY principles in terraform with modules
How to make the block dynamic in terraform
In this blog, we will discuss about the dynamic block. Which is like more advanced version of looping available in terraform. It is better to have a knowledge of count, conditionals ,for_each and object data type before reading this blog. First of all, understand the basic usage of dynamic blocks. The basic use case is… Continue reading How to make the block dynamic in terraform
How to iterate in terraform with for_each.
In the previous article we have already learn to iterate with count structure and also we have how it works and its disadvantages, In this article we will look deeply into for_each, which is another way to achieve looping in terraform. The simplest example I can think of is to create some 10 or 20… Continue reading How to iterate in terraform with for_each.
How to iterate over terraform resources with count
Imagine you have to create a 100 files on you remote server or let’s say you need to create 30 virtual machines as part of your infrastructure setup. If you want to accomplish this task via terraform, you should learn COUNT and this is a must read blog for you. Terraform created a design pattern… Continue reading How to iterate over terraform resources with count
Complete understanding of Terraform variables
In this article, we are going to deep dive into terraform variables, each parameter and their use-cases with examples. This is part 1 of the article which cover first and second objectives. To know about the terraform fundamental blocks, please refer here. Data types and examples Referring the variables Various way to give input to… Continue reading Complete understanding of Terraform variables