Parameterized resources in Terraform
There are cases where you might want to declare a single, parameterized resource in place of a (possibly variable) number of resources to be managed. Terraform enables this through some of its native constructs.
File-based parameterization
You can use a combination of the for_each
meta-argument and the fileset function to your advantage, for example when creating browser checks that share all their settings apart from their script:
This will create as many browser checks running each minute as there are files in the ./scripts
folder in your project’s path.
Aside from checks, these constructs can be useful for a variety of resources like alert channels, snippets and more.
Last updated on December 13, 2024. You can contribute to this documentation by editing this page on Github