fix: stop emitting the Grafana module twice in the cloud_run template#62
Open
lokeshmuvva wants to merge 1 commit into
Open
fix: stop emitting the Grafana module twice in the cloud_run template#62lokeshmuvva wants to merge 1 commit into
lokeshmuvva wants to merge 1 commit into
Conversation
main.tf.j2's generic per-tool loop emitted a module for every tool including grafana, while a dedicated block emitted grafana again. That produced a duplicate module "model_monitoring_grafana", and the generic loop also passed arguments the Grafana Cloud Run module does not declare (cpu_request, max_scale, use_postgres, ...). A grafana stack with no MLflow/W&B (which renders this template) therefore could not deploy. Exclude grafana from the generic loop so only the dedicated block emits it, matching how mlflow_main.tf.j2 uses dedicated per-tool blocks. Verified by rendering: grafana-containing stacks now emit a single Grafana module with no stray arguments, and non-grafana tools are unaffected.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
main.tf.j2(the Cloud Run template used when a stack has neither MLflow nor W&B) emitted the Grafana module twice — once from the generic per-tool loop and once from the dedicated Grafana block. The generic loop also passed arguments the Grafana Cloud Run module doesn't declare.This excludes grafana from the generic loop so only the dedicated block emits it.
Why
Two Terraform errors made Grafana undeployable via this template:
module "model_monitoring_grafana"(duplicate module name).cpu_request,max_scale,use_postgres, …) passed to a module that doesn't declare them.mlflow_main.tf.j2already avoids this by using dedicated per-tool blocks; this alignsmain.tf.j2with that approach (exclude grafana from the catch-all, let the specialized block own it).Verification
Rendered
main.tf.j2for grafana-containing stacks:x = var.xjunk (previously emitted, e.g.grafana_port = var.grafana_port)Notes
Found while working on #61 (Grafana credentials) and deliberately scoped out of that PR to keep it focused. Independent change; touches different lines of the same file, so the two PRs do not conflict.
Test plan
main.tf.j2across grafana / non-grafana stacks (counts above)terraform applysucceeds