I cannot find this if it does exist. I'm looking for a way to define a template_file in a terraform module, and then "extend" / "append" to it at the instantiation level.
I've tried creating the template_file in the module, then creating an output in the module of the rendering. Then defining another template_file on the instantiation level and trying to reference the module's output as an interpolated value in the template file.
Doing so results in a unknown variable error.
Module file
data "template_file" "module_user_data_template" {
template = "${file("${path.module}/user_data.sh.template")}"
}
output "module_template_file" {
value = "${data.template_file.module_user_data_template.rendered}"
}
Instance main.tf
data "template_file" "user_data_template" {
template = "${file("${path.module}/user_data.sh.template")}"
}
# Create External Proxy Server
module "my-module-instance" {
source = "../../../../../modules/my-module"
}
I cannot find this if it does exist. I'm looking for a way to define a template_file in a terraform module, and then "extend" / "append" to it at the instantiation level.
I've tried creating the template_file in the module, then creating an output in the module of the rendering. Then defining another template_file on the instantiation level and trying to reference the module's output as an interpolated value in the template file.
Doing so results in a unknown variable error.
Module file
Instance main.tf
Instance template file