fleet issues when migrating from terraform elasticsearch 0.13.1 to 0.14.1
hi folks;
i am currently in the process of uplifting my team's terrafrom elasticsearch version from 0.13.1 to 0.14.1, however it is a bit of an arduous process when it comes to fleet. we are testing out using spaced agents so have upped the version to enable smoother implementation of the spaceing, but shifting our approach to integration policies is a bit of a nightmare.
we have been using file()/templatefile() with json.tmpl files for the bulk of the inputs for our elasticstack_fleet_integration_policy resources which has been great, however with 0.14.0+ introducting a new approach to defining inputs for integration templates, it seems that this approach no longer works.
when using very bulky integrations such as the system integration, we have gone from being able to have a small suite of template files to having to explicitly define almost all of the streams and their variables, most of which we wish to keep as the default settings anyway or have disabled. i have attempted to covert this as follows
resource "elasticstack_fleet_integration_policy" "system-integration" {
name = "example_system"
integration_name = "system"
version = "2.1.0"
...
input {
input_id = "system-system/metrics"
enabled = true
streams_json = templatefile("system-metrics.json.tmpl", {
tags = var.system.tags
})
}
...
}
to
resource "elasticstack_fleet_integration_policy" "system-integration" {
name = "example_system"
integration_name = "system"
version = "2.1.0"
...
inputs = {
"system-system/metrics" = {
enabled = true
streams = {
"system.core" = {
enabled = true,
vars = jsonencode({
"tags": var.system.tags
})
},
...
}
}
...
}
}
however, when running a plan of the changes, it appears to destroy the bulk of the existing resource and doesn't appear to recognise that by not defining a value in vars, we want to use the default rather than not use the value at all.
so my overall questions is: is there a way of using file() or templatefile() in the same way with 0.14.1, or is it going to have to be a case of converting the existing template files to be variables or something of that ilk?
thanks so much - i'm pretty new to terraform so any help or advice would be really apprecited! <3