vyOS 1.4 - cloud-init [vyos_config_commands] for BGP network statements overwite each other

Using cloud-init, vyos_config_commands, and having the following two BGP network statements

- set vrf name customer protocols bgp address-family ipv4-unicast network '10.180.0.0/25'
- set vrf name customer protocols bgp address-family ipv4-unicast network '10.180.2.0/24'

The last overwrites the first during cc_vyos_userdata.py processing of the cloud-init userdata. The resulting /config/config.boot file contains only the last statement.

 bgp {
                address-family {
                    ipv4-unicast {
                        route-target {
                            vpn {
                                import "1:1"
                                export "2:1"
                            }
                        }
                        rd {
                            vpn {
                                export "1:2"
                            }
                        }
                        network "10.180.2.0/24"
                        label {
                            vpn {
                                export "auto"
                            }
                        }
                        import {
                            vpn { }
                        }
                        export {
                            vpn { }
                        }
                    }
                }
...

Both commands are processed as per the cloud-init.log

2022-11-25 09:20:14,962 - cc_vyos_userdata.py[DEBUG]: Configuring command: "set vrf name customer protocols bgp address-family ipv4-unicast network '10.180.0.0/25'"
2022-11-25 09:20:14,962 - cc_vyos_userdata.py[DEBUG]: Marking node as tag: "['vrf', 'name']"
2022-11-25 09:20:14,963 - cc_vyos_userdata.py[DEBUG]: Marking node as tag: "['vrf', 'name', 'customer', 'protocols', 'bgp', 'address-family', 'ipv4-unicast', 'network']"
2022-11-25 09:20:14,963 - cc_vyos_userdata.py[DEBUG]: Configuring command: "set vrf name customer protocols bgp address-family ipv4-unicast network '10.180.2.0/24'"
2022-11-25 09:20:14,963 - cc_vyos_userdata.py[DEBUG]: Marking node as tag: "['vrf', 'name']"
2022-11-25 09:20:14,964 - cc_vyos_userdata.py[DEBUG]: Marking node as tag: "['vrf', 'name', 'customer', 'protocols', 'bgp', 'address-family', 'ipv4-unicast', 'network']"

Currently using the - set vrf name customer protocols bgp address-family ipv4-unicast redistribute connected to workaround, but not a favored approach as network statements provide more control and implicit definition of intent, and also network statements have the route tagged as IGP and not incomplete.

Second workaround is to add the two statements into the write_files section of cloud-init user_data instead.

Version

Version:          VyOS 1.4-rolling-202211180318
Release train:    current

Built by:         autobuild@vyos.net
Built on:         Fri 18 Nov 2022 03:18 UTC
Build UUID:       7d903365-be97-4d56-865b-ca8560ae24aa
Build commit ID:  594c99e012fd66

Architecture:     x86_64
Boot via:         installed image
System type:      VMware guest

Hardware vendor:  VMware, Inc.
Hardware model:   VMware Virtual Platform
Hardware S/N:     VMware-42 08 b8 f8 67 2e c1 b0-74 c9 38 13 c2 a4 02 07
Hardware UUID:    f8b80842-2e67-b0c1-74c9-3813c2a40207

In relation to vyOS 1.4 - L3VPN BGP import/export nexthop incorrect - General questions - VyOS Platform Community Forums, the network statements in BGP do not correctly pickup connected interfaces, so this issue for the use of network statements for connected interfaces is less relevant, but would still have relevance for routes in the route table that are not connected that need advertising via BGP.