-
-
Notifications
You must be signed in to change notification settings - Fork 55
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
Feature/enabled monitors #58
Conversation
/test |
/test all |
/test all |
/test all |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me but please let's get one more reviewer
@@ -6,7 +6,7 @@ locals { | |||
|
|||
# https://registry.terraform.io/providers/DataDog/datadog/latest/docs/resources/monitor | |||
resource "datadog_monitor" "default" { | |||
for_each = local.enabled ? var.datadog_monitors : {} | |||
for_each = local.enabled ? { for k, v in var.datadog_monitors : k => v if lookup(v, "enabled", true) } : {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
did you try it with module.this.enabled = false
.
In some cases, Tf complains about both side of the ?
operator not having the same types of elements.
If that's an issue, we can do
for_each = { for k, v in var.datadog_monitors : k => v if local.enabled && lookup(v, "enabled", true) }
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TF complained about it in the component for merging the yaml, but not in the module. Figured out an adjustment to some of the component for_each
's to get it to work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Benbentwo approved, but please see the comment
what
why