Question
In terraform, if you have some values that repeat all over the place in the configs and you want an easy way to set their value in one place you can use local values/variables. With that in mind write code to setup the following local values/variables in your *.tf file:

default_name_prefix = "${var.project_name}-web" name_prefix = "something" Answer locals { default_name_prefix = "${var.project_name}-web"
name_prefix         = "something"
}

^^ note the use of the locals block type (un-named block) to decalre and assign all the local variables.

^^^ note that these values can be accessed in the rest of the *.tf configs, using the local.* syntax (e.x. "${local.name_prefix}") Question In terraform, if you have some values that repeat all over the place in the configs and you want an easy way to set their value in one place you can use local values/variables. With that in mind write code to setup the following local values/variables in your *.tf file: default_name_prefix = "${var.project_name}-web"
name_prefix = "something"
?

Question
In terraform, if you have some values that repeat all over the place in the configs and you want an easy way to set their value in one place you can use local values/variables. With that in mind write code to setup the following local values/variables in your *.tf file:

default_name_prefix = "${var.project_name}-web" name_prefix = "something" Answer locals { default_name_prefix = "${var.project_name}-web"
name_prefix         = "something"
}

^^ note the use of the locals block type (un-named block) to decalre and assign all the local variables.

^^^ note that these values can be accessed in the rest of the *.tf configs, using the local.* syntax (e.x. "\${local.name_prefix}")

#### Summary

status measured difficulty not learned 37% [default] 0

No repetitions