Slide 1
Most trusted JOB oriented professional program
DevOps Certified Professional (DCP)

Take your first step into the world of DevOps with this course, which will help you to learn about the methodologies and tools used to develop, deploy, and operate high-quality software.

Slide 2
DevOps to DevSecOps – Learn the evolution
DevSecOps Certified Professional (DSOCP)

Learn to automate security into a fast-paced DevOps environment using various open-source tools and scripts.

Slide 2
Get certified in the new tech skill to rule the industry
Site Reliability Engineering (SRE) Certified Professional

A method of measuring and achieving reliability through engineering and operations work – developed by Google to manage services.

Slide 2
Master the art of DevOps
Master in DevOps Engineering (MDE)

Get enrolled for the most advanced and only course in the WORLD which can make you an expert and proficient Architect in DevOps, DevSecOps and Site Reliability Engineering (SRE) principles together.

Slide 2
Gain expertise and certified yourself
Azure DevOps Solutions Expert

Learn about the DevOps services available on Azure and how you can use them to make your workflow more efficient.

Slide 3
Learn and get certified
AWS Certified DevOps Professional

Learn about the DevOps services offered by AWS and how you can use them to make your workflow more efficient.

previous arrow
next arrow

Terraform interpolation explained with example programs

Spread the Knowledge

What is interpolation?

Interpolation is the estimation of a value or set of values based on their context. In other words, Interpolation is a useful mathematical and statistical tool used to estimate values between two points.

What is Terraform interpolation?

In Terraform, string interpolation (or variable interpolation, variable substitution, or variable expansion) is the process of evaluating a string literal containing one or more placeholders, yielding a result in which the placeholders are replaced with their corresponding values.

  • Embedded within strings in Terraform, whether you’re using the Terraform syntax or JSON syntax, you can interpolate other values. These interpolations are wrapped in ${}, such as ${}.
  • The interpolation syntax is powerful and allows you to reference variables, attributes of resources, call functions, etc.
  • You can perform simple math in interpolations, allowing you to write expressions such as ${count.index
  • 1}. And you can also use conditionals to determine a value based on some logic.
  • You can escape interpolation with double dollar signs: $${foo} will be rendered as a literal ${foo}.
  • The string interpolation syntax ${ … } has been part of Terraform since its initial release in 2015.
  • In Terraform 0.12, is now extended to include support for conditionals and for expressions. These new features are most useful within multi-line strings. Terraform is extending interpolation syntax used for strings (${}) to loops and conditionals (which implies interpolation syntax is still valid for strings).
# Configuration for Terraform 0.12

locals {
  lb_config = <<EOT
%{ for instance in opc_compute_instance.example ~}
server ${instance.label} ${instance.ip_address}:8080
%{ endfor }

More Reference

Rajesh Kumar