'fp.monitoring' fixed and expanded (Issue623) - #267
Conversation
|
I guess this example data is vague? |
| @@ -854,15 +854,19 @@ module "aci_syslog_policy" { | |||
| module "aci_monitoring_policy" { | |||
There was a problem hiding this comment.
maybe lets call it aci_monitoring_policy_common and 2nd module just aci_monitoring_policy?
There was a problem hiding this comment.
and lets add there fault severity policies (for common object), to keep all modules supporting the same
There was a problem hiding this comment.
by the way, i guess there is not an option to configure new syslog destination or snmp destination without adding it to common object?
There was a problem hiding this comment.
maybe lets call it aci_monitoring_policy_common and 2nd module just aci_monitoring_policy?
We can check this with Justyna. I tried to keep it the way it is in order to ensure backwards compatibility.
and lets add there fault severity policies (for common object), to keep all modules supporting the same
As per my tests, common policy does not allow changes in Fault severities.
by the way, i guess there is not an option to configure new syslog destination or snmp destination without adding it to common object?
Not sure about this one. Hope you can elaborate it
|
If we analyze common policy, i guess that there was 1 more broken thing: If we consider that we create an SNMP destination named "trap1" and also it automatically creates under monitoring common policy reference, in our case it will generate reference to 'mon_snmp1_dst_group` which doesn't exists. Wouldn't it be there that we need to keep destination_group and name always the same to make it working? I guess maybe we should force users to keep it the same? destination_group would have to include name_suffix as well |
User should be in charge of make sure references are pointing to valid objects (e.g. when you define a BD under EPG, tool does not validate if the BD exists and no error is popped up). Also, an internal issue was raised where the engineers are not using the same name for both objetcs, instead, they create the SNMP destinations independently. Let's meet and discuss this further. Thanks! |
| faults = try(policy.faults, local.defaults.apic.fabric_policies.monitoring.syslogs.faults) | ||
| session = try(policy.session, local.defaults.apic.fabric_policies.monitoring.syslogs.session) | ||
| minimum_severity = try(policy.minimum_severity, local.defaults.apic.fabric_policies.monitoring.syslogs.minimum_severity) | ||
| destination_group = try("${policy.destination_group}${local.defaults.apic.fabric_policies.monitoring.syslogs.destination_group_suffix}", "") |
There was a problem hiding this comment.
this should read from:
---
defaults:
apic:
fabric_policies:
monitoring:
syslogs:
name_suffix: ""
| count = local.modules.aci_monitoring_policy == true && var.manage_fabric_policies ? 1 : 0 | ||
| snmp_trap_policies = [for policy in try(local.fabric_policies.monitoring.snmp_traps, []) : { | ||
| name = "${policy.name}${local.defaults.apic.fabric_policies.monitoring.snmp_traps.name_suffix}" | ||
| destination_group = try("${policy.destination_group}${local.defaults.apic.fabric_policies.monitoring.snmp_traps.destination_group_suffix}", "") |
There was a problem hiding this comment.
this should read from:
---
defaults:
apic:
fabric_policies:
monitoring:
snmp_traps:
name_suffix: ""
There was a problem hiding this comment.
there is no need to create new destination_group_suffix
|
This PR has been updated to be fully backwards compatible: current data models and current terraform modules remain exactly the same It proposes a new and independent Terraform module to handle User defined Fabric monitoring policies that does not affect current assets in any way. New module was tested in a whole and isolated way. |
ogorczow
left a comment
There was a problem hiding this comment.
all ok.
The only thing to discuss is if we want to keep module name this way "aci_monitoring_policy_user_defined"
ogorczow
left a comment
There was a problem hiding this comment.
1 major change
2 minor changes
| aci_monitoring_policy: true | ||
| aci_monitoring_policy_common: true | ||
| aci_monitoring_policy_custom: true | ||
| aci_access_monitoring_policy: true |
There was a problem hiding this comment.
duplicated aci_access_monitoring_policy: true in code:
│ Call to function "provider::utils::yaml_merge" failed: Error reading YAML string: yaml: unmarshal
│ errors:
│ line 120: mapping key "aci_access_monitoring_policy" already defined at line 12.
| } | ||
| } | ||
|
|
||
| resource "aci_rest_managed" "snmpRsDestGroup" { |
There was a problem hiding this comment.
if you try to configure custom policy without destination_group, then terraform tries to create resource with empty tDn snmpgroup name:
# module.aci.module.aci_monitoring_policy_custom["NEW_POLICY"].aci_rest_managed.snmpRsDestGroup["trap2"] will be created
+ resource "aci_rest_managed" "snmpRsDestGroup" {
+ annotation = "orchestrator:terraform"
+ class_name = "snmpRsDestGroup"
+ content = {
+ "tDn" = "uni/fabric/snmpgroup-"
}
+ dn = "uni/fabric/monfab-NEW_POLICY/snmpsrc-trap2/rsdestGroup"
+ escape_html = true
+ id = (known after apply)
}
common one works fine
There was a problem hiding this comment.
policies:
- name: NEW_POLICY
description: This is a new policy
snmp_traps:
- name: trap2
| } | ||
|
|
||
| resource "aci_rest_managed" "syslogRsDestGroup" { | ||
| for_each = { for s in var.syslog_policies : s.name => s if s.destination_group != null } |
There was a problem hiding this comment.
if you try to configure custom policy without destination_group, then terraform tries to create resource with empty tDn slgroup name:
# module.aci.module.aci_monitoring_policy_custom["NEW_POLICY"].aci_rest_managed.syslogRsDestGroup["syslogX"] will be created
+ resource "aci_rest_managed" "syslogRsDestGroup" {
+ annotation = "orchestrator:terraform"
+ class_name = "syslogRsDestGroup"
+ content = {
+ "tDn" = "uni/fabric/slgroup-"
}
+ dn = "uni/fabric/monfab-NEW_POLICY/slsrc-syslogX/rsdestGroup"
+ escape_html = true
+ id = (known after apply)
}
common one works fine
There was a problem hiding this comment.
policies:
- name: NEW_POLICY
description: This is a new policy
syslogs:
- name: syslogX
Current Fabric Monitoring Data Model only accept the configuration of
name. Support fordestination_groupwas added and support of user-defined fabric monitoring policies.These are non-breaking changes.
Data tested: