How do you reference values in Terraform expressions?
BeginnerConceptIaC and Terraform Fundamentals
Answer
var.name for variables, local.name for locals, aws_vpc.main.id for resource attributes, data.aws_ami.al2023.id for data sources, module.network.vpc_id for module outputs, each.key/each.value, count.index, path.module, and terraform.workspace. These references create the dependency graph automatically.
More on IaC and Terraform Fundamentals
What is Infrastructure as Code and why do teams use it?BeginnerWhat is the difference between declarative and imperative infrastructure tools?BeginnerWhat is Terraform and what problem does it solve?BeginnerWhat is HCL and can Terraform use anything else?BeginnerWhich files make up a typical Terraform root module?BeginnerHow does Terraform work internally?Advanced