The Meraki Terraform Provider is a declarative tool that enables teams and individuals to automate their workflows and manage Cisco Meraki network infrastructure using Terraform. With this provider, you can define and manage Meraki organizations, networks, devices, and other resources as code, providing simplicity, scalability, and repeatability in your automation strategy.
Additional provider information available on the Terraform Registry.
To start using the Meraki Terraform Provider, follow these steps:
Install Terraform: Make sure you have Terraform installed on your local machine. You can download and install Terraform from the official website.
Configure the Meraki Terraform Provider: Set up the provider block in your Terraform configuration file, specifying your Meraki API key and base URL.
Define Meraki resources: Create resource blocks in your configuration file to describe the desired state of your Meraki infrastructure. You can create organizations, networks, devices, and more.
Initialize and apply changes: Run terraform init
to initialize your Terraform configuration. Then, use terraform plan
to preview the changes that will be applied, and terraform apply
to apply the changes and provision the resources.
To use the Meraki Terraform Provider in your Terraform configuration, you need to configure the required provider and define resources specific to the Meraki platform. Follow the steps below to get started:
Add the provider block to your Terraform configuration file (e.g., main.tf
):
terraform { required_providers { meraki = { source = "core-infra-svcs/meraki" } } } provider "meraki" { api_key = var.MERAKI_DASHBOARD_API_KEY base_url = var.MERAKI_DASHBOARD_API_URL }
Replace var.MERAKI_DASHBOARD_API_KEY
and var.MERAKI_DASHBOARD_API_URL
with your own API key and base URL values.
Define Meraki resources in your configuration file. For example, you can create a new Meraki organization and network:
// Create new Meraki organization resource "meraki_organization" "demo" { name = "example" api_enabled = true licensing_model = "co-term" } // Create a new Network resource "meraki_network" "demo" { depends_on = [meraki_organization.demo] organization_id = resource.meraki_organization.demo.organization_id product_types = ["appliance", "switch", "wireless"] tags = ["cisco", "meraki", "terraform"] name = "Main Office" timezone = "America/Los_Angeles" notes = "example demo network" }
Customize the configuration according to your requirements, such as providing the appropriate values for the organization name, product types, tags, etc.
Initialize the Terraform configuration by running the following command in your project directory:
terraform init
Plan and preview the changes that will be applied to your Meraki environment:
terraform plan
Apply the changes to create the Meraki organization and network:
terraform apply
Review the changes and confirm by typing yes
when prompted.
Monitor the Terraform output for any errors or warnings. Once the process completes successfully, the Meraki organization and network will be created according to your configuration.
Now you have successfully used the Meraki Terraform Provider to provision resources in your Meraki environment. You can further customize your configuration to manage additional Meraki resources or update existing ones by modifying the Terraform configuration file.
Remember to always review and verify the changes before applying them to your production environment.
For even more detailed information and usage examples, please refer to the following documentation resources:
Contributions are welcome! If you are interested in contributing to the Meraki Terraform Provider, please refer to the Contributing Guidelines for detailed instructions on how to get started.
See the Getting Started Document for detailed instructions.
The Meraki Terraform Provider is open-source and licensed under the Mozilla Public License Version 2.0. Feel free to use, modify, and distribute the provider according to the terms of the license.
If you encounter any issues, have questions, or need assistance, please create an issue on the GitHub repository. Our community and maintainers will be happy to help you.
We would like to express our gratitude to the contributors who have made this project possible. Your contributions and feedback are highly appreciated and valuable to the Meraki Terraform Provider community.
This project is not officially supported by Cisco or Meraki. It is maintained and supported by a community of enthusiastic engineers and developers.
Code Exchange Community
Get help, share code, and collaborate with other developers in the Code Exchange community.View Community