3

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.

1 Answer 1

6

There is no way to do this at the moment, you will have to go with the parameter.

1
  • That seems to match everything else I've found.
    – Drew
    Aug 16, 2018 at 19:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .