Meta Arguments is a group of arguments in HashiCorp Configuration Language (HCL) that could alter a resource’s behaviour. It includes:
Terraform Meta Arguments
-
Terraform Resource Replication
Within #Terraform Providers, we can define a resource in such a way we could replicate multiple instances of them under different name. A recommended way to do this is by using a Terraform Meta Arguments#
for_each
.for_each
will store a list of values, of type# set or map, into a variable calledeach.value
. The following shows the configuration# example: -
Terraform Providers
This will establish an implicit dependency of
my_file
onother_file
as #HashiCorp Terraform able to recognise such relationship when runningterraform apply
. However, in some cases, explicit dependency might exist even though it is not being referred. As such, use the #optional argumentdepends_on
, and defined a list of dependency the resource is relying on.