Terraform Automation for Cisco Catalyst Switches via Meraki and IOS XE Providers

This repository contains Terraform configurations for retrieving Cisco Catalyst switches from the Meraki Dashboard using the Meraki provider and for managing these devices with the IOS XE provider. The project streamlines the process of network provisioning and configuration, harnessing the power of Infrastructure as Code (IaC) to automate these tasks through Terraform.
Use Case Description
The Terraform configurations in this project enable network administrators to automate the provisioning and configuration of Cisco Catalyst switches. By integrating with the Meraki Dashboard through the Meraki provider and configuring the switches using the IOS XE provider, this project streamlines network management and ensures consistent infrastructure deployment.

Installation
To install and configure the project:
-
Clone the repository:
git clone https://github.com/pamosima/meraki-terraform-iosxe.git
-
Navigate to the repository directory:
cd meraki-terraform-iosxe
-
Create a bash script named setup_env.sh
with the following content to set up the environment variables for the Meraki API key and other Terraform variables:
#!/bin/bash
# This script sets up environment variables for Meraki API key and other Terraform variables
export TF_VAR_device_password="your_device_password"
export TF_VAR_organization_id="your_organization_id"
export MERAKI_DASHBOARD_API_KEY="your_meraki_api_key"
Replace your_device_password
, your_organization_id
, and your_meraki_api_key
with your actual credentials.
-
Make the script executable:
-
Run the script to set the environment variables:
-
Navigate to the infra directory:
-
Initialize Terraform to download the necessary providers:
Usage
The Terraform configurations are located in the infra
directory. To use them:
-
Modify the Terraform variable file (terraform.tfvars
) to match your network infrastructure requirements.
-
Run terraform plan
and terraform apply
to provision and configure your network devices.
The modules
directory contains reusable Terraform modules for switchport and VLAN management that can be referenced in your main Terraform configurations.
Main Terraform Configuration (main.tf
)
The main.tf
file in the infra
directory is the entry point for the Terraform configuration. It includes the following key components:
-
Provider Declaration: Specifies the required providers for Meraki and IOS XE. The Meraki provider is used to retrieve the list of Catalyst switches from the Meraki Dashboard, while the IOS XE provider is used to configure the switches.
-
Local Values: Defines a set of local values to organize device information into a structured format. This includes lists of Catalyst switches with their respective names and URLs.
Known issues
Currently, there are no known issues. Please report any bugs or problems using the GitHub Issues section.
Getting help
If you encounter any issues or need assistance, please create an issue in the GitHub repository for support.
Getting involved
Contributions to this project are welcome! Please refer to the CONTRIBUTING guidelines for instructions on how to contribute.
Author(s)
This project was written and is maintained by the following individuals: