I am using a Terraform module to deploy resources, using separate instances to deploy sets of those resources. I would like to be able to name those resources according to the instance's name. For example:
module "thing1" {
source = "my-module"
param1 = "value the first"
param2 = "value the second"
}
And in the module:
resource "resource_type" "doesntmatter" {
name = "${module.self.name}"
...
}
In the example, I would like the resource to have the name thing1
.
I could certainly just create another variable for input to the module but that is repetitive for the client code (violates DRY--the created resource needs a reasonable identifier, but nothing pretty, so it would be good to reuse a descriptive instance name) and this seems like it should be available, but I can't see anything in the Terraform documentation.