Skip to content

Commit d03c75d

Browse files
committed
Add support for more string casts
1 parent 6c6132c commit d03c75d

File tree

9 files changed

+73
-73
lines changed

9 files changed

+73
-73
lines changed

iosxe_aaa.tf

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ resource "iosxe_aaa" "aaa" {
1717

1818
ip_radius_source_interface_loopback = try(e.source_interface_type, local.defaults.iosxe.configuration.aaa.radius_groups.source_interface_type, null) == "Loopback" ? try(e.source_interface_id, local.defaults.iosxe.configuration.aaa.radius_groups.source_interface_id, null) : null
1919
ip_radius_source_interface_vlan = try(e.source_interface_type, local.defaults.iosxe.configuration.aaa.radius_groups.source_interface_type, null) == "Vlan" ? try(e.source_interface_id, local.defaults.iosxe.configuration.aaa.radius_groups.source_interface_id, null) : null
20-
ip_radius_source_interface_gigabit_ethernet = try(e.source_interface_type, local.defaults.iosxe.configuration.aaa.radius_groups.source_interface_type, null) == "GigabitEthernet" ? try(e.source_interface_id, local.defaults.iosxe.configuration.aaa.radius_groups.source_interface_id, null) : null
21-
ip_radius_source_interface_two_gigabit_ethernet = try(e.source_interface_type, local.defaults.iosxe.configuration.aaa.radius_groups.source_interface_type, null) == "TwoGigabitEthernet" ? try(e.source_interface_id, local.defaults.iosxe.configuration.aaa.radius_groups.source_interface_id, null) : null
22-
ip_radius_source_interface_five_gigabit_ethernet = try(e.source_interface_type, local.defaults.iosxe.configuration.aaa.radius_groups.source_interface_type, null) == "FiveGigabitEthernet" ? try(e.source_interface_id, local.defaults.iosxe.configuration.aaa.radius_groups.source_interface_id, null) : null
23-
ip_radius_source_interface_ten_gigabit_ethernet = try(e.source_interface_type, local.defaults.iosxe.configuration.aaa.radius_groups.source_interface_type, null) == "TenGigabitEthernet" ? try(e.source_interface_id, local.defaults.iosxe.configuration.aaa.radius_groups.source_interface_id, null) : null
24-
ip_radius_source_interface_twenty_five_gigabit_ethernet = try(e.source_interface_type, local.defaults.iosxe.configuration.aaa.radius_groups.source_interface_type, null) == "TwentyFiveGigabitEthernet" ? try(e.source_interface_id, local.defaults.iosxe.configuration.aaa.radius_groups.source_interface_id, null) : null
25-
ip_radius_source_interface_forty_gigabit_ethernet = try(e.source_interface_type, local.defaults.iosxe.configuration.aaa.radius_groups.source_interface_type, null) == "FortyGigabitEthernet" ? try(e.source_interface_id, local.defaults.iosxe.configuration.aaa.radius_groups.source_interface_id, null) : null
26-
ip_radius_source_interface_hundred_gigabit_ethernet = try(e.source_interface_type, local.defaults.iosxe.configuration.aaa.radius_groups.source_interface_type, null) == "HundredGigabitEthernet" ? try(e.source_interface_id, local.defaults.iosxe.configuration.aaa.radius_groups.source_interface_id, null) : null
20+
ip_radius_source_interface_gigabit_ethernet = try(e.source_interface_type, local.defaults.iosxe.configuration.aaa.radius_groups.source_interface_type, null) == "GigabitEthernet" ? try(trimprefix(e.source_interface_id, "$string "), local.defaults.iosxe.configuration.aaa.radius_groups.source_interface_id, null) : null
21+
ip_radius_source_interface_two_gigabit_ethernet = try(e.source_interface_type, local.defaults.iosxe.configuration.aaa.radius_groups.source_interface_type, null) == "TwoGigabitEthernet" ? try(trimprefix(e.source_interface_id, "$string "), local.defaults.iosxe.configuration.aaa.radius_groups.source_interface_id, null) : null
22+
ip_radius_source_interface_five_gigabit_ethernet = try(e.source_interface_type, local.defaults.iosxe.configuration.aaa.radius_groups.source_interface_type, null) == "FiveGigabitEthernet" ? try(trimprefix(e.source_interface_id, "$string "), local.defaults.iosxe.configuration.aaa.radius_groups.source_interface_id, null) : null
23+
ip_radius_source_interface_ten_gigabit_ethernet = try(e.source_interface_type, local.defaults.iosxe.configuration.aaa.radius_groups.source_interface_type, null) == "TenGigabitEthernet" ? try(trimprefix(e.source_interface_id, "$string "), local.defaults.iosxe.configuration.aaa.radius_groups.source_interface_id, null) : null
24+
ip_radius_source_interface_twenty_five_gigabit_ethernet = try(e.source_interface_type, local.defaults.iosxe.configuration.aaa.radius_groups.source_interface_type, null) == "TwentyFiveGigabitEthernet" ? try(trimprefix(e.source_interface_id, "$string "), local.defaults.iosxe.configuration.aaa.radius_groups.source_interface_id, null) : null
25+
ip_radius_source_interface_forty_gigabit_ethernet = try(e.source_interface_type, local.defaults.iosxe.configuration.aaa.radius_groups.source_interface_type, null) == "FortyGigabitEthernet" ? try(trimprefix(e.source_interface_id, "$string "), local.defaults.iosxe.configuration.aaa.radius_groups.source_interface_id, null) : null
26+
ip_radius_source_interface_hundred_gigabit_ethernet = try(e.source_interface_type, local.defaults.iosxe.configuration.aaa.radius_groups.source_interface_type, null) == "HundredGigabitEthernet" ? try(trimprefix(e.source_interface_id, "$string "), local.defaults.iosxe.configuration.aaa.radius_groups.source_interface_id, null) : null
2727
server_names = try(length(e.server_names) == 0, true) ? null : [for s in e.server_names : {
2828
name = s
2929
}]
@@ -33,13 +33,13 @@ resource "iosxe_aaa" "aaa" {
3333
vrf = try(e.vrf, local.defaults.iosxe.configuration.aaa.tacacs_groups.vrf, null)
3434
ip_tacacs_source_interface_loopback = try(e.source_interface_type, local.defaults.iosxe.configuration.aaa.tacacs_groups.source_interface_type, null) == "Loopback" ? try(e.source_interface_id, local.defaults.iosxe.configuration.aaa.tacacs_groups.source_interface_id, null) : null
3535
ip_tacacs_source_interface_vlan = try(e.source_interface_type, local.defaults.iosxe.configuration.aaa.tacacs_groups.source_interface_type, null) == "Vlan" ? try(e.source_interface_id, local.defaults.iosxe.configuration.aaa.tacacs_groups.source_interface_id, null) : null
36-
ip_tacacs_source_interface_gigabit_ethernet = try(e.source_interface_type, local.defaults.iosxe.configuration.aaa.tacacs_groups.source_interface_type, null) == "GigabitEthernet" ? try(e.source_interface_id, local.defaults.iosxe.configuration.aaa.tacacs_groups.source_interface_id, null) : null
37-
ip_tacacs_source_interface_two_gigabit_ethernet = try(e.source_interface_type, local.defaults.iosxe.configuration.aaa.tacacs_groups.source_interface_type, null) == "TwoGigabitEthernet" ? try(e.source_interface_id, local.defaults.iosxe.configuration.aaa.tacacs_groups.source_interface_id, null) : null
38-
ip_tacacs_source_interface_five_gigabit_ethernet = try(e.source_interface_type, local.defaults.iosxe.configuration.aaa.tacacs_groups.source_interface_type, null) == "FiveGigabitEthernet" ? try(e.source_interface_id, local.defaults.iosxe.configuration.aaa.tacacs_groups.source_interface_id, null) : null
39-
ip_tacacs_source_interface_ten_gigabit_ethernet = try(e.source_interface_type, local.defaults.iosxe.configuration.aaa.tacacs_groups.source_interface_type, null) == "TenGigabitEthernet" ? try(e.source_interface_id, local.defaults.iosxe.configuration.aaa.tacacs_groups.source_interface_id, null) : null
40-
ip_tacacs_source_interface_twenty_five_gigabit_ethernet = try(e.source_interface_type, local.defaults.iosxe.configuration.aaa.tacacs_groups.source_interface_type, null) == "TwentyFiveGigabitEthernet" ? try(e.source_interface_id, local.defaults.iosxe.configuration.aaa.tacacs_groups.source_interface_id, null) : null
41-
ip_tacacs_source_interface_forty_gigabit_ethernet = try(e.source_interface_type, local.defaults.iosxe.configuration.aaa.tacacs_groups.source_interface_type, null) == "FortyGigabitEthernet" ? try(e.source_interface_id, local.defaults.iosxe.configuration.aaa.tacacs_groups.source_interface_id, null) : null
42-
ip_tacacs_source_interface_hundred_gigabit_ethernet = try(e.source_interface_type, local.defaults.iosxe.configuration.aaa.tacacs_groups.source_interface_type, null) == "HundredGigabitEthernet" ? try(e.source_interface_id, local.defaults.iosxe.configuration.aaa.tacacs_groups.source_interface_id, null) : null
36+
ip_tacacs_source_interface_gigabit_ethernet = try(e.source_interface_type, local.defaults.iosxe.configuration.aaa.tacacs_groups.source_interface_type, null) == "GigabitEthernet" ? try(trimprefix(e.source_interface_id, "$string "), local.defaults.iosxe.configuration.aaa.tacacs_groups.source_interface_id, null) : null
37+
ip_tacacs_source_interface_two_gigabit_ethernet = try(e.source_interface_type, local.defaults.iosxe.configuration.aaa.tacacs_groups.source_interface_type, null) == "TwoGigabitEthernet" ? try(trimprefix(e.source_interface_id, "$string "), local.defaults.iosxe.configuration.aaa.tacacs_groups.source_interface_id, null) : null
38+
ip_tacacs_source_interface_five_gigabit_ethernet = try(e.source_interface_type, local.defaults.iosxe.configuration.aaa.tacacs_groups.source_interface_type, null) == "FiveGigabitEthernet" ? try(trimprefix(e.source_interface_id, "$string "), local.defaults.iosxe.configuration.aaa.tacacs_groups.source_interface_id, null) : null
39+
ip_tacacs_source_interface_ten_gigabit_ethernet = try(e.source_interface_type, local.defaults.iosxe.configuration.aaa.tacacs_groups.source_interface_type, null) == "TenGigabitEthernet" ? try(trimprefix(e.source_interface_id, "$string "), local.defaults.iosxe.configuration.aaa.tacacs_groups.source_interface_id, null) : null
40+
ip_tacacs_source_interface_twenty_five_gigabit_ethernet = try(e.source_interface_type, local.defaults.iosxe.configuration.aaa.tacacs_groups.source_interface_type, null) == "TwentyFiveGigabitEthernet" ? try(trimprefix(e.source_interface_id, "$string "), local.defaults.iosxe.configuration.aaa.tacacs_groups.source_interface_id, null) : null
41+
ip_tacacs_source_interface_forty_gigabit_ethernet = try(e.source_interface_type, local.defaults.iosxe.configuration.aaa.tacacs_groups.source_interface_type, null) == "FortyGigabitEthernet" ? try(trimprefix(e.source_interface_id, "$string "), local.defaults.iosxe.configuration.aaa.tacacs_groups.source_interface_id, null) : null
42+
ip_tacacs_source_interface_hundred_gigabit_ethernet = try(e.source_interface_type, local.defaults.iosxe.configuration.aaa.tacacs_groups.source_interface_type, null) == "HundredGigabitEthernet" ? try(trimprefix(e.source_interface_id, "$string "), local.defaults.iosxe.configuration.aaa.tacacs_groups.source_interface_id, null) : null
4343
server_names = try(length(e.server_names) == 0, true) ? null : [for s in e.server_names : {
4444
name = s
4545
}]

iosxe_logging.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ resource "iosxe_logging" "logging" {
1818
file_max_size = try(local.device_config[each.value.name].logging.file_max_size, local.defaults.iosxe.configuration.logging.file_max_size, null)
1919
file_min_size = try(local.device_config[each.value.name].logging.file_min_size, local.defaults.iosxe.configuration.logging.file_min_size, null)
2020
file_severity = try(local.device_config[each.value.name].logging.file_severity, local.defaults.iosxe.configuration.logging.file_severity, null)
21-
source_interface = try("${try(local.device_config[each.value.name].logging.source_interface_type, local.defaults.iosxe.configuration.logging.source_interface_type)}${try(local.device_config[each.value.name].logging.source_interface_id, local.defaults.iosxe.configuration.logging.source_interface_id)}", null)
21+
source_interface = try("${try(local.device_config[each.value.name].logging.source_interface_type, local.defaults.iosxe.configuration.logging.source_interface_type)}${try(trimprefix(local.device_config[each.value.name].logging.source_interface_id, "$string "), local.defaults.iosxe.configuration.logging.source_interface_id)}", null)
2222

2323
source_interfaces_vrf = try(length(local.device_config[each.value.name].logging.source_interfaces_vrf) == 0, true) ? null : [for s in local.device_config[each.value.name].logging.source_interfaces_vrf : {
2424
vrf = try(s.vrf, local.defaults.iosxe.configuration.logging.source_interfaces_vrf.vrf, null)
25-
interface_name = try("${try(s.interface_type, local.defaults.iosxe.configuration.logging.source_interfaces_vrf.interface_type)}${try(s.interface_id, local.defaults.iosxe.configuration.logging.source_interfaces_vrf.interface_id)}", null)
25+
interface_name = try("${try(s.interface_type, local.defaults.iosxe.configuration.logging.source_interfaces_vrf.interface_type)}${try(trimprefix(s.interface_id, "$string "), local.defaults.iosxe.configuration.logging.source_interfaces_vrf.interface_id)}", null)
2626
}]
2727

2828
# IPv4 hosts without VRF and without transport

iosxe_msdp.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ resource "iosxe_msdp" "msdp" {
22
for_each = { for device in local.devices : device.name => device if try(local.device_config[device.name].msdp, null) != null || try(local.defaults.iosxe.configuration.msdp, null) != null }
33
device = each.value.name
44

5-
originator_id = try("${try(local.device_config[each.value.name].msdp.originator_id_interface_type, local.defaults.iosxe.configuration.msdp.originator_id_interface_type)}${try(local.device_config[each.value.name].msdp.originator_id_interface_id, local.defaults.iosxe.configuration.msdp.originator_id_interface_id)}", null)
5+
originator_id = try("${try(local.device_config[each.value.name].msdp.originator_id_interface_type, local.defaults.iosxe.configuration.msdp.originator_id_interface_type)}${try(trimprefix(local.device_config[each.value.name].msdp.originator_id_interface_id, "$string "), local.defaults.iosxe.configuration.msdp.originator_id_interface_id)}", null)
66
passwords = try(length(local.device_config[each.value.name].msdp.passwords) == 0, true) ? null : [for password in local.device_config[each.value.name].msdp.passwords : {
77
addr = try(password.host, local.defaults.iosxe.configuration.msdp.passwords.host, null)
88
encryption = try(password.encryption, local.defaults.iosxe.configuration.msdp.passwords.encryption, null)
@@ -15,7 +15,7 @@ resource "iosxe_msdp" "msdp" {
1515
}]
1616
vrfs = try(length(local.device_config[each.value.name].msdp.vrfs) == 0, true) ? null : [for vrf in local.device_config[each.value.name].msdp.vrfs : {
1717
vrf = try(vrf.vrf, null)
18-
originator_id = try("${try(vrf.originator_id_interface_type, local.defaults.iosxe.configuration.msdp.vrfs.originator_id_interface_type)}${try(vrf.originator_id_interface_id, local.defaults.iosxe.configuration.msdp.vrfs.originator_id_interface_id)}", null)
18+
originator_id = try("${try(vrf.originator_id_interface_type, local.defaults.iosxe.configuration.msdp.vrfs.originator_id_interface_type)}${try(trimprefix(vrf.originator_id_interface_id, "$string "), local.defaults.iosxe.configuration.msdp.vrfs.originator_id_interface_id)}", null)
1919
passwords = try(length(vrf.passwords) == 0, true) ? null : [for password in vrf.passwords : {
2020
addr = try(password.host, local.defaults.iosxe.configuration.msdp.passwords.host, null)
2121
encryption = try(password.encryption, local.defaults.iosxe.configuration.msdp.passwords.encryption, null)

iosxe_nat.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ resource "iosxe_nat" "nat" {
77
id = try(isi.id, local.defaults.iosxe.configuration.nat.inside_source_interfaces.id, null)
88
interfaces = try(length(isi.interfaces) == 0, true) ? null : [
99
for iface in isi.interfaces : {
10-
interface = "${try(iface.interface_type, local.defaults.iosxe.configuration.nat.inside_source_interfaces.interfaces.interface_type, "")}${try(iface.interface_id, local.defaults.iosxe.configuration.nat.inside_source_interfaces.interfaces.interface_id, "")}"
10+
interface = "${try(iface.interface_type, local.defaults.iosxe.configuration.nat.inside_source_interfaces.interfaces.interface_type, "")}${try(trimprefix(iface.interface_id, "$string "), local.defaults.iosxe.configuration.nat.inside_source_interfaces.interfaces.interface_id, "")}"
1111
overload = try(iface.overload, local.defaults.iosxe.configuration.nat.inside_source_interfaces.interfaces.overload, null)
1212
}
1313
]

0 commit comments

Comments
 (0)