/terraform-provider-iosxe

Primary LanguageGoMozilla Public License 2.0MPL-2.0

Terraform logo

Terraform Provider for Cisco IOS XE

The terraform-provider-iosxe is a plugin for Terraform that one can use to manage the configuration and state on Cisco Catalyst IOS XE devices including switches, routers, and wireless LAN controllers.

The provider was build and tested with Cisco Catalyst IOS XE and all subsequent releases are supported

  • Cisco IOS XE 17.7

Getting Started

The primary usecase for the Cisco IOS XE provider is managing the following features:

Features examples:
aaa-authentication aaa-authorization aaa-accounting acl bgp
cdp dhcp emp etherChannel hsrp
igmp igmp-proxy l3-subinterface line mdt
nat ntp ospf pim poe
radius snmp span-rspan vlan vlan-trunk
vlan-voice vtp ipsec crypto tunnel

Creating Additional Terraform Resources

Any feature or Remote Procedure Call (RPC) supported by RESTCONF & YANG is supported by this Terraform provider. If a particular feature example is not yet in this GitHub repository, you can create the necessary Terraform file using these steps

  1. Configure the feature as per the CLI config guide, if needed.

  2. You can find the JSON for features currently configured device using show run | format restconf-json

    • An alternate approach to find the RESTCONF JSON can be done using YANG Suite, a tool to visualize and understand YANG models
  3. The resulting JSON found from executing RESTCONF can be used to create the .tf file. For example, replace each of the values in angle brackets (<>) in the example Terraform file below with the corresponding Xpath and JSON:

    example.tf

    resource "iosxe_rest" "feature_put" {
        method = "PUT"
        path   = <RESTCONF_XPATH>
        payload = jsonencode(    
            {
                <JSON_RESPONSE>
            }
        )
    }