CiscoDevNet / terraform-provider-cml2

Terraform provider repository for Cisco Modeling Labs
https://www.cisco.com/go/cml
Mozilla Public License 2.0
15 stars 1 forks source link
automation cisco network-simulation networking simulation terraform terraform-provider virl

CodeQL Go Coverage Status

Terraform Provider for Cisco CML2

This repository implements a Terraform provider for Cisco Modeling Labs version 2.4 and later. It's current state is "beta". Changes can be expected, for example:

Note: The provider needs CML 2.4 or newer. This is due to some additional API capabilities which were introduced with 2.4.0. Older versions are blocked within by the gocmlclient.

The current implementation provides:

Requirements

Building The Provider

  1. Clone the repository
  2. Enter the repository directory
  3. Build the provider using the Go install command:
go install

Using the provider

Please refer to the examples directory and look at the built-in documentation provided via the registry.

HCL

For some basic examples look in the examples directory

Developing the Provider

If you wish to work on the provider, you'll first need Go installed on your machine (see Requirements above).

To compile the provider, run go install. This will build the provider and put the provider binary in the $GOPATH/bin directory.

To generate or update documentation, run go generate.

In order to run the full suite of Acceptance tests, run make testacc. For this to work, the provider needs to be configured via environment variables. Here's an example:

# for testing purposes, suggest to use direnv

TF_VAR_username="admin"
TF_VAR_password="secret"
TF_VAR_address="https://cml-controller.cml.lab"

export TF_VAR_username TF_VAR_password TF_VAR_address

Those variables are referenced for acceptance testing in internal/provider/testing.

make testacc

Acceptance testing with Github actions can be achieved using the provided tunnel.sh script which uses tools like gh CLI and ngrok to forward the API calls to a locally installed CML instance. See tunnel.sh and the ghsecret CLI tool for additional details.