Skip to content

Commit 758e6f9

Browse files
praveenmatanamPraveen Matanam
andauthored
Iosxr telnet implementation (#19)
* Implemented the feature iosxr_telnet * Update iosxr_telnet.tf --------- Co-authored-by: Praveen Matanam <pmatanam@cisco.com>
1 parent 3dcd5e9 commit 758e6f9

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ module "iosxr" {
7272
| [iosxr_service_timestamps.service_timestamps](https://registry.terraform.io/providers/CiscoDevNet/iosxr/latest/docs/resources/service_timestamps) | resource |
7373
| [iosxr_snmp_server_mib.snmp_server_mib](https://registry.terraform.io/providers/CiscoDevNet/iosxr/latest/docs/resources/snmp_server_mib) | resource |
7474
| [iosxr_snmp_server_view.snmp_server_view](https://registry.terraform.io/providers/CiscoDevNet/iosxr/latest/docs/resources/snmp_server_view) | resource |
75+
| [iosxr_telnet.telnet](https://registry.terraform.io/providers/CiscoDevNet/iosxr/latest/docs/resources/telnet) | resource |
7576
| [local_sensitive_file.defaults](https://registry.terraform.io/providers/hashicorp/local/latest/docs/resources/sensitive_file) | resource |
7677
| [terraform_data.validation](https://registry.terraform.io/providers/hashicorp/terraform/latest/docs/resources/data) | resource |
7778
## Modules

iosxr_telnet.tf

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
locals {
2+
device_telnet_configs = flatten([
3+
for device in local.devices : [
4+
{
5+
device_name = device.name
6+
key = "${device.name}-telnet"
7+
8+
ipv4_client_source_interface = try(local.device_config[device.name].telnet.ipv4_client_source_interface, local.defaults.iosxr.configuration.telnet.ipv4_client_source_interface, null)
9+
ipv6_client_source_interface = try(local.device_config[device.name].telnet.ipv6_client_source_interface, local.defaults.iosxr.configuration.telnet.ipv6_client_source_interface, null)
10+
11+
vrfs = [
12+
for vrf in try(local.device_config[device.name].telnet.vrfs, local.defaults.iosxr.configuration.telnet.vrfs, []) : {
13+
vrf_name = try(vrf.vrf_name, null)
14+
ipv4_server_max_servers = try(vrf.ipv4_server_max_servers, null)
15+
ipv4_server_access_list = try(vrf.ipv4_server_access_list, null)
16+
ipv6_server_max_servers = try(vrf.ipv6_server_max_servers, null)
17+
ipv6_server_access_list = try(vrf.ipv6_server_access_list, null)
18+
}
19+
]
20+
21+
vrfs_dscp = [
22+
for vrf_dscp in try(local.device_config[device.name].telnet.vrfs_dscp, local.defaults.iosxr.configuration.telnet.vrfs_dscp, []) : {
23+
vrf_name = try(vrf_dscp.vrf_name, null)
24+
ipv4_dscp = try(vrf_dscp.ipv4_dscp, null)
25+
}
26+
]
27+
}
28+
] if try(local.device_config[device.name].telnet, null) != null || try(local.defaults.iosxr.configuration.telnet, null) != null
29+
])
30+
}
31+
32+
resource "iosxr_telnet" "telnet" {
33+
for_each = { for telnet_config in local.device_telnet_configs : telnet_config.key => telnet_config }
34+
device = each.value.device_name
35+
36+
ipv4_client_source_interface = each.value.ipv4_client_source_interface
37+
ipv6_client_source_interface = each.value.ipv6_client_source_interface
38+
vrfs = each.value.vrfs
39+
vrfs_dscp = each.value.vrfs_dscp
40+
}

0 commit comments

Comments
 (0)