In this lecture,
we will take a look at meta arguments in Terraform.
Until now,
we have been able to create
single resources
such as
a local file
and a random pet resource using Terraform,
but
what if you want to create
multiple instances of the same resource,
say,
three local files for example?
If we were using a shell script
or some other programming language,
we could create multiple files like this.
In this example,
we have created a bash script called
create files.sh,
which uses a four-loop to create
empty files inside the root directory.
The files will be called pet,
followed by the range from one to three.
While we cannot use the same script
as it is within the resource block,
Terraform offers several alternatives
to achieve the same goal,
and these can be done
by making use of specific meta arguments in Terraform.
Meta arguments can be used within
any resource block
to change the behavior of resources.
We've already seen two types
of meta arguments already in this course.
That depends on
for defining explicit dependency between resources
and the lifecycle rules
which define how the resources should be created,
updated, and destroyed within Terraform.
Now,
let us look at some more meta arguments
specifically related to loops in Terraform.