Block is a container. Each block has a type (example resource
, data
, etc.). Each block type defines how many labels must follow the type keyword. Here are a few block types:
terraform
provider
resource
data
variable
output
module
locals
Local variables are similar to variables defined using the "variable" block, but they are used solely within the context of a single module or resource block. They cannot be passed between different modules like input variables can.
The purpose of the "locals" block is to store intermediate values or calculated expressions that are used within the configuration but don't need to be exposed outside of it. This can help improve the readability and maintainability of your Terraform code by allowing you to define complex expressions or values once and then reference them throughout the configuration.
init
plan
apply
destroy
show