I have a template file, that is creating a fluentd file and inserting various variables. I am now trying to include this plugin which expects to find its own variables in the config file. The problem is that Terraform defines a variable in a template like ${variable} and this plugin expects to find its variables in the file as literal ${variable}
How can I tell terraform to not interpolate a ${} in a file, but to actually pass that entire string?
File Snippet:
<filter tomcat.logs>
@type record_transformer
<record>
customer ${customer}
environment ${environment}
application ${application}
</record>
</filter>
The above ${} are all variables I have defined for my template. I now need to add a section like this.
<record>
hostname ${tagset_name}
instance_id ${instance_id}
instance_type ${instance_type}
az ${availability_zone}
private_ip ${private_ip}
vpc_id ${vpc_id}
ami_id ${image_id}
account_id ${account_id}
</record>
Where all of those are not variables but how it actually needs to look in the rendered template. I tried swapping them to be like $${account_id}, but that just ends up rendering account_id in the file.
data "template_file" "app" {
template = "${file("templates/${var.application}.tpl")}"
vars {
customer = "${var.customer}"
environment = "${var.environment}"
application = "${var.application}"
}
}
Here is a breakdown of what is happening.
In the user data I have "instance_type $${instance_type}"
The launch configuration that is created for the instances, shows "instance_type ${instance_type}"
The actual file that is present on AWS shows "instance_type"