diff --git a/README.md b/README.md index 1b173e7..9af86fb 100644 --- a/README.md +++ b/README.md @@ -66,6 +66,7 @@ module "iosxr" { | [iosxr_domain.domain](https://registry.terraform.io/providers/CiscoDevNet/iosxr/latest/docs/resources/domain) | resource | | [iosxr_domain_vrf.domain_vrf](https://registry.terraform.io/providers/CiscoDevNet/iosxr/latest/docs/resources/domain_vrf) | resource | | [iosxr_evpn.evpn](https://registry.terraform.io/providers/CiscoDevNet/iosxr/latest/docs/resources/evpn) | resource | +| [iosxr_flow_sampler_map.flow_sampler_map](https://registry.terraform.io/providers/CiscoDevNet/iosxr/latest/docs/resources/flow_sampler_map) | resource | | [iosxr_hostname.hostname](https://registry.terraform.io/providers/CiscoDevNet/iosxr/latest/docs/resources/hostname) | resource | | [iosxr_interface.interface](https://registry.terraform.io/providers/CiscoDevNet/iosxr/latest/docs/resources/interface) | resource | | [iosxr_ipv4_prefix_list.ipv4_prefix_list](https://registry.terraform.io/providers/CiscoDevNet/iosxr/latest/docs/resources/ipv4_prefix_list) | resource | diff --git a/iosxr_flow_sampler_map.tf b/iosxr_flow_sampler_map.tf new file mode 100644 index 0000000..c9130f1 --- /dev/null +++ b/iosxr_flow_sampler_map.tf @@ -0,0 +1,22 @@ +locals { + device_flow_sampler_maps = flatten([ + for device in local.devices : [ + for sampler_map in try(local.device_config[device.name].flow_sampler_map, []) : { + device_name = device.name + key = "${device.name}-flow-sampler-map-${sampler_map.name}" + name = try(sampler_map.name, local.defaults.iosxr.configuration.flow_sampler_map.name, null) + random = try(sampler_map.random, local.defaults.iosxr.configuration.flow_sampler_map.random, null) + out_of = try(sampler_map.out_of, local.defaults.iosxr.configuration.flow_sampler_map.out_of, null) + } + ] + ]) +} + +resource "iosxr_flow_sampler_map" "flow_sampler_map" { + for_each = { for sampler_map in local.device_flow_sampler_maps : sampler_map.key => sampler_map } + device = each.value.device_name + + name = each.value.name + random = each.value.random + out_of = each.value.out_of +} \ No newline at end of file