Skip to content
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

Need to add support for SNMP Policy User and Client group descriptions #86

Merged
merged 12 commits into from
May 22, 2024
2 changes: 2 additions & 0 deletions aci_fabric_policies.tf
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ module "aci_snmp_policy" {
communities = try(each.value.communities, [])
users = [for user in try(each.value.users, []) : {
name = user.name
description = try(user.description, "")
privacy_type = try(user.privacy_type, local.defaults.apic.fabric_policies.pod_policies.snmp_policies.users.privacy_type)
privacy_key = try(user.privacy_key, null)
authorization_type = try(user.authorization_type, local.defaults.apic.fabric_policies.pod_policies.snmp_policies.users.authorization_type)
Expand All @@ -227,6 +228,7 @@ module "aci_snmp_policy" {
}]
clients = [for client in try(each.value.clients, []) : {
name = "${client.name}${local.defaults.apic.fabric_policies.pod_policies.snmp_policies.clients.name_suffix}"
description = try(client.description, "")
mgmt_epg_type = client.mgmt_epg
mgmt_epg_name = client.mgmt_epg == "oob" ? try(local.node_policies.oob_endpoint_group, local.defaults.apic.node_policies.oob_endpoint_group) : try(local.node_policies.inb_endpoint_group, local.defaults.apic.node_policies.inb_endpoint_group)
entries = [for entry in try(client.entries, []) : {
Expand Down
4 changes: 2 additions & 2 deletions modules/terraform-aci-snmp-policy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ module "aci_snmp_policy" {
| <a name="input_location"></a> [location](#input\_location) | Location. | `string` | `""` | no |
| <a name="input_contact"></a> [contact](#input\_contact) | Contact. | `string` | `""` | no |
| <a name="input_communities"></a> [communities](#input\_communities) | List of communities. | `list(string)` | `[]` | no |
| <a name="input_users"></a> [users](#input\_users) | List of users. Choices `privacy_type`: `none`, `des`, `aes-128`. Default value `privacy_type`: `none`. `privacy_key`: Minimum characters: 8. Maximum characters: 130. Choices `authorization_type`: `hmac-md5-96`, `hmac-sha1-96`, `hmac-sha2-224`, `hmac-sha2-256`, `hmac-sha2-384`, `hmac-sha2-512`. Default value `authorization_type`: `mac-md5-96`. `authorization_key`: Minimum characters: 8. Maximum characters: 130. | <pre>list(object({<br> name = string<br> privacy_type = optional(string, "none")<br> privacy_key = optional(string)<br> authorization_type = optional(string, "hmac-md5-96")<br> authorization_key = optional(string, "")<br> }))</pre> | `[]` | no |
| <a name="input_users"></a> [users](#input\_users) | List of users. Choices `privacy_type`: `none`, `des`, `aes-128`. Default value `privacy_type`: `none`. `privacy_key`: Minimum characters: 8. Maximum characters: 130. Choices `authorization_type`: `hmac-md5-96`, `hmac-sha1-96`, `hmac-sha2-224`, `hmac-sha2-256`, `hmac-sha2-384`, `hmac-sha2-512`. Default value `authorization_type`: `mac-md5-96`. `authorization_key`: Minimum characters: 8. Maximum characters: 130. | <pre>list(object({<br> name = string<br> description = optional(string, "")<br> privacy_type = optional(string, "none")<br> privacy_key = optional(string)<br> authorization_type = optional(string, "hmac-md5-96")<br> authorization_key = optional(string, "")<br> }))</pre> | `[]` | no |
| <a name="input_trap_forwarders"></a> [trap\_forwarders](#input\_trap\_forwarders) | List of trap forwarders. Allowed values `port`: 0-65535. Default value `port`: 162. | <pre>list(object({<br> ip = string<br> port = optional(number, 162)<br> }))</pre> | `[]` | no |
| <a name="input_clients"></a> [clients](#input\_clients) | List of clients. Choices `mgmt_epg_type`: `inb`, `oob`. Default value `mgmt_epg_type`: `inb`. | <pre>list(object({<br> name = string<br> mgmt_epg_type = optional(string, "inb")<br> mgmt_epg_name = optional(string)<br> entries = optional(list(object({<br> ip = string<br> name = string<br> })), [])<br> }))</pre> | `[]` | no |
| <a name="input_clients"></a> [clients](#input\_clients) | List of clients. Choices `mgmt_epg_type`: `inb`, `oob`. Default value `mgmt_epg_type`: `inb`. | <pre>list(object({<br> name = string<br> description = optional(string, "")<br> mgmt_epg_type = optional(string, "inb")<br> mgmt_epg_name = optional(string)<br> entries = optional(list(object({<br> ip = string<br> name = string<br> })), [])<br> }))</pre> | `[]` | no |

## Outputs

Expand Down
4 changes: 3 additions & 1 deletion modules/terraform-aci-snmp-policy/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ resource "aci_rest_managed" "snmpUserP" {
class_name = "snmpUserP"
content = {
name = each.value.name
descr = each.value.description
privType = each.value.privacy_type
privKey = sensitive(each.value.privacy_type != null && each.value.privacy_type != "none" ? each.value.privacy_key : null)
authType = each.value.authorization_type
Expand Down Expand Up @@ -65,7 +66,8 @@ resource "aci_rest_managed" "snmpClientGrpP" {
dn = "${aci_rest_managed.snmpPol.dn}/clgrp-${each.value.name}"
class_name = "snmpClientGrpP"
content = {
name = each.value.name
name = each.value.name
descr = each.value.description
}
}

Expand Down
2 changes: 2 additions & 0 deletions modules/terraform-aci-snmp-policy/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ variable "users" {
description = "List of users. Choices `privacy_type`: `none`, `des`, `aes-128`. Default value `privacy_type`: `none`. `privacy_key`: Minimum characters: 8. Maximum characters: 130. Choices `authorization_type`: `hmac-md5-96`, `hmac-sha1-96`, `hmac-sha2-224`, `hmac-sha2-256`, `hmac-sha2-384`, `hmac-sha2-512`. Default value `authorization_type`: `mac-md5-96`. `authorization_key`: Minimum characters: 8. Maximum characters: 130."
type = list(object({
name = string
description = optional(string, "")
privacy_type = optional(string, "none")
privacy_key = optional(string)
authorization_type = optional(string, "hmac-md5-96")
Expand Down Expand Up @@ -116,6 +117,7 @@ variable "clients" {
description = "List of clients. Choices `mgmt_epg_type`: `inb`, `oob`. Default value `mgmt_epg_type`: `inb`."
type = list(object({
name = string
description = optional(string, "")
mgmt_epg_type = optional(string, "inb")
mgmt_epg_name = optional(string)
entries = optional(list(object({
Expand Down