We have this terraform project
# config.tpl
instance_name = "${name}"
environment = "${env}"
fullname="fullname"
# main.tf
variable "instance_name" {
default = "my-instance"
}
variable "environment" {
default = "staging"
}
data "template_file" "example" {
template = file("${path.module}/config.tpl")
vars = {
name = var.instance_name
env = var.environment
}
}
output "modified_template" {
value = templatestring(data.template_file.example.rendered, {
fullname = "new-value"
})
}
terraform {
}
Is there any way to make this work. Tried templatestring
but its not working. I need to update the fullname attribute later in the project as I can’t update that while using templatefile function.
Thanks