So, mathematically speaking, interpolation is a method of constructing new data points within the range of a discrete set of known data points.
Now, Terraform has been using this terminology to reference values, like variables.
I can't seem to find any minimal coincidence using this math term in TF. Where is the match?
The other answers explain why Terraform uses the term interpolation, so I'll just answer the bit
Where is the match?
As you say, in mathematics, interpolation means making a new data point in between existing data points. Crudely, this could be something like
1 2 3 _ 5 6
^
please find an appropriate value for here
In software, string interpolation is the process of putting something into a gap in a string. For example
"For the problem above, _ is the simplest value" <- 4
So the coincidence comes about if you frame interpolation as "filling a gap". It's certainly not the exact same thing, but that's how they're similar.
Different industries can use the same term in different ways. The usage of the term interpolation in software development is very common. The fact that mathematics uses the term in different ways does not really matter in the same way that they word "punch" means one thing in the boxing world and another in the metal working world.
String interpolation
It's used in the same meaning as elsewhere in programming. Typically mentioned in a phrase "String interpolation". To quote Wikipedia:
In computer programming, string interpolation [...] is the process of evaluating a string literal containing one or more placeholders,
The reason Terraform mentions that is that whenever you define a value in Terraform, you can use quotes ""
and within the quotes have one or more expressions, e.g. "ami-${var.image_id}"
. These expressions are evaluated and interpolated into the String.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With