From the course: Developing Infrastructure as Code with Terraform
Unlock this course with a free trial
Join today to access over 24,900 courses taught by industry experts.
About expressions in HCL - Terraform Tutorial
From the course: Developing Infrastructure as Code with Terraform
About expressions in HCL
- Okay, Terraform supports expressions in its configuration. And so those can take on a bunch of forms so we're going to go through those now. So the first one I want to point out is something called a local. And the name local is a little bit confusing. This is what you might think of in another programming language as a variable. Variable has another meaning in Terraform, and we're going to go over that in another section. But it's just a way of storing a value that you can refer to later. So in this first example, we're just storing a simple string. But we can do other things. We can store the result of an expression in a local. So you can see in this example a little bit further down, we are storing the result of this expression. And this expression has a reference. So we are referring to this first local within another local. And you can see there's a little bit of a confusing syntax here. So it's local, it's not locals. That's a very common source of errors that I make and that…
Contents
-
-
-
-
-
-
(Locked)
Learning objectives47s
-
(Locked)
The basics: HCL structure1m 54s
-
Terraform providers4m 8s
-
(Locked)
Terraform data sources and resources4m 3s
-
(Locked)
Dependencies in Terraform7m 39s
-
(Locked)
About expressions in HCL12m 25s
-
(Locked)
Terraform variables and outputs9m 15s
-
(Locked)
Using for_each and count properties9m 47s
-
(Locked)
Resource lifecycle5m 53s
-
(Locked)
Refactoring features3m 15s
-
(Locked)
Provisioners3m 18s
-
(Locked)
-
-
-
-
-
-