A Terraform module to configure Cisco NX-OS devices using Network as Code. The desired configuration of one or more switches is described in YAML and translated by the module into NX-OS provider resources, which are applied via NX-API.
- Introduction: concepts and architecture
- First Steps: step-by-step guide from a single switch to multi-device deployments
- Data Model Reference: all supported YAML attributes including types, ranges and examples
- Supported Features
- Changelog and Tested Versions
- NX-API enabled on each device (
feature nxapi) - Device credentials provided via the
NXOS_USERNAMEandNXOS_PASSWORDenvironment variables
This module supports an inventory driven approach, where a complete NX-OS configuration or parts of it are either modeled in one or more YAML files (yaml_files, yaml_directories) or natively using Terraform variables (model).
Configuration is defined per device under nxos.devices. Settings shared across devices can be defined once using global configuration, device groups, templates, template instances and interface groups. The managed_devices and managed_device_groups variables can be used to limit which devices are managed by a Terraform run.
Configuring an NX-OS system configuration using YAML (see the system data model for all available attributes):
nxos: devices: - name: Switch1 url: https://1.2.3.4 configuration: system: hostname: Switch1 mtu: 9216
module "nxos" { source = "netascode/nac-nxos/nxos" version = ">= 0.1.0" yaml_files = ["system.nac.yaml"] }
| Name | Version |
|---|---|
| terraform | >= 1.9.0 |
| local | >= 2.7.0, < 3.0.0 |
| nxos | ~> 0.23.0 |
| utils | >= 2.3.0, < 3.0.0 |
| Name | Description | Type | Default | Required |
|---|---|---|---|---|
| managed_device_groups | List of device group names to be managed. By default all device groups will be managed. | list(string) |
[] |
no |
| managed_devices | List of device names to be managed. By default all devices will be managed. | list(string) |
[] |
no |
| model | As an alternative to YAML files, a native Terraform data structure can be provided as well. | map(any) |
{} |
no |
| save_config | Write changes to startup-config on all devices. | bool |
false |
no |
| template_directories | List of paths to directories containing template files. | list(string) |
[] |
no |
| template_files | List of paths to template files. | list(string) |
[] |
no |
| write_model_file | Write the rendered data model to a single YAML file, e.g. for validation, testing and troubleshooting. Value is a path relative to the root module. Set to an empty string to disable. | string |
"model.yaml" |
no |
| yaml_directories | List of paths to YAML directories. | list(string) |
[] |
no |
| yaml_files | List of paths to YAML files. | list(string) |
[] |
no |
No outputs.
No modules.