i have about 10 different, unique userdata files, for separate instances. However I want to pass a common variable to all of them without creating 10 "template_file" resources. Something like this, which doesn't work, because it just sets "template" to whatever the last one is:
data "template_file" "userdata" {
template = "${file("${path.module}/userdata_olympus.conf")}"
template = "${file("${path.module}/userdata_vpn.conf")}"
template = "${file("${path.module}/userdata_nat.conf")}"
vars {
domain_suffix = "${var.domain_suffix}"
}
}
data "template_file" "userdata_puppetdb" {
template = "${file("${path.module}/userdata_puppetdb.conf")}"
vars {
domain_suffix = "${var.domain_suffix}"
puppetmaster_ip = "${aws_instance.puppet_server.private_ip}"
}
}
Where the first block uses the common "domain_suffix" variable, and then any other resource would be for instances that require unique variables.