-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feedback: .tfstates size issue #54
Comments
Hello! I guess this is an issue with how this provider is supposed to be used (always having this The duplication could also be fixed if Terraform adds support for dynamic attributes and we could get rid of the Thanks a lot for this feedback! I'll be interested to know if you open an issue to Terraform about the memory usage if there was also an issue on their side or if we are doing something wrong within this provider. |
I didn't open a issue to the Terraform core, because the memory usage is "expected". The way I build this, generate a LOT of modules (and data), so Terraform have to build the dependency tree with a lot of nodes/edges. To make this simple, I've 1 module for each kind of resources I want to monitor (ex. a database, a container, ...), with its batch of panels, and one module who dynamically load the good modules based on input (resource_type). I load the dashboard module with one or more resource type, and it append all the panels together and build one dashboard. By doing this, my stack reach ~700 datas, and nearly 6000 modules loaded (because Terraform seems to load each modules even if the count is 0 or the for_each empty) ex. module "dashboard_..." {
source = "./module/dashboard-builder"
title = "..."
folder = "..."
blocks = [
{
module = "resource_type_a", key = "identifier_a",
params = {
// params for this module
}
},
{
module = "resource_type_b", key = "identifier_b",
params = {
// params for this module
}
},
]
} And also generate the annotations for the alerts, to have the screenshot attached, without knowing the uuid. It's pretty good to generate of lot of dashboards for many services who share common resource type, but there are few hacks / data manipulation and I think Terraform was not designed with this usecase in mind 😅 My plan is to test grafonnet, it's will be probably better for my needs |
I've experiment more with the new provider (0.2.0), and now I've a bunch of dashboards via Terraform and I start to reach new kind of issue with the size of the .tfstates.
I create my dashboards with:
schemas_panel_xxx
(between 5-50 per dashboards)schemas_core_dashboard
(1 per dashboard)grafana_dashboard
(1 per dashboard), I've 35 dashboards (for now)The .tfstates reach 10mb and slowling down the plan/apply and increase the memory usage (up to 4-5gb), I'm not sure both are related and still need investigation, but for the size the problem is the information are store like four/five time with my usage:
schemas_panel_xxx
: contains all the attributes (nearly the same size as the rendered_json) AND the rendered_jsonschemas_core_dashboard
: contains the input (panels) AND the rendered_jsongrafana_dashboard
: contains the whole JSONI've try to pass my panels directly to
grafana_dashboard
resource withoutschemas_core_dashboard
, it's work and reduce the overall size from ~30%, but is kind of defeat the whole purpose of this provider.I'm not sure I use the provider wrong or this is related to how Terraform work, but for medium/large usage this can be issue.
I'll probably also open a issue to Terraform for the memory usage, which seems very high for a 10mb .tfstates
The text was updated successfully, but these errors were encountered: