Deploy
NDFC Terraform

Deploy Configuration to NDFC Using Terraform

In this section you will be deploying the Terraform configuration to the fabric

Step 1 - Create modules/fabric/deploy.tf file


touch ~/workspace/ndfclab/terraform/modules/fabric/deploy.tf
code-server -r ~/workspace/ndfclab/terraform/modules/fabric/deploy.tf

Finally, you will leverage the ndfc_configuration_deploy resource to deploy the configuration to the fabric. This resource allows you to trigger the deployment of the configuration to the devices in the fabric. The serial_numbers argument is set to ["ALL"], which means that the configuration will be deployed to all devices in the fabric.

This resource depends on the previously defined resources, ensuring that the fabric, interfaces, VRFs, and networks are created before the deployment is triggered.


resource "ndfc_configuration_deploy" "nac_configuration_deploy_1" {
  fabric_name    = var.fabric_name
  trigger_deploy_on_update = true
  serial_numbers = ["ALL"]
  config_save    = true

  depends_on = [
    ndfc_fabric_vxlan_evpn.nac_fabric1,
    ndfc_inventory_devices.nac_inventory_devices_1,
    ndfc_vpc_pair.nac_vpc_pair_1,
    ndfc_interface_ethernet.nac_interface_ethernet_1,
    ndfc_interface_loopback.nac_interface_loopback_1,
    ndfc_interface_portchannel.nac_interface_portchannel_1,
    ndfc_vrfs.nac_vrfs_1,
    ndfc_networks.nac_networks_1,
  ]
}


Step 2 - Run the terraform apply command to create and configure the fabric using Terraform


terraform apply

NOTE: When prompted to confirm the action, type yes and press Enter.
Plan: 10 to add, 0 to change, 0 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

Once you enter "yes" to approve the plan, Terraform will start creating the resources as defined in your configuration. The output will show the progress of each resource being created, including any dependencies that need to be satisfied before a resource can be created like so:

module.fabric.ndfc_fabric_vxlan_evpn.nac_fabric1: Creating...
module.fabric.ndfc_fabric_vxlan_evpn.nac_fabric1: Creation complete after 7s [id=fabric-terraform]
module.fabric.ndfc_inventory_devices.nac_inventory_devices_1: Creating...
module.fabric.ndfc_inventory_devices.nac_inventory_devices_1: Still creating... [00m10s elapsed]
module.fabric.ndfc_inventory_devices.nac_inventory_devices_1: Still creating... [00m20s elapsed]
module.fabric.ndfc_inventory_devices.nac_inventory_devices_1: Still creating... [00m30s elapsed]
module.fabric.ndfc_inventory_devices.nac_inventory_devices_1: Still creating... [00m40s elapsed]
module.fabric.ndfc_inventory_devices.nac_inventory_devices_1: Still creating... [00m50s elapsed]
module.fabric.ndfc_inventory_devices.nac_inventory_devices_1: Still creating... [01m00s elapsed]
module.fabric.ndfc_inventory_devices.nac_inventory_devices_1: Still creating... [01m10s elapsed]
module.fabric.ndfc_inventory_devices.nac_inventory_devices_1: Still creating... [01m20s elapsed]
module.fabric.ndfc_inventory_devices.nac_inventory_devices_1: Still creating... [01m30s elapsed]
module.fabric.ndfc_inventory_devices.nac_inventory_devices_1: Still creating... [01m40s elapsed]
module.fabric.ndfc_inventory_devices.nac_inventory_devices_1: Still creating... [01m50s elapsed]
module.fabric.ndfc_inventory_devices.nac_inventory_devices_1: Still creating... [02m00s elapsed]
module.fabric.ndfc_inventory_devices.nac_inventory_devices_1: Still creating... [02m10s elapsed]
module.fabric.ndfc_inventory_devices.nac_inventory_devices_1: Still creating... [02m20s elapsed]
module.fabric.ndfc_inventory_devices.nac_inventory_devices_1: Still creating... [02m30s elapsed]
module.fabric.ndfc_inventory_devices.nac_inventory_devices_1: Still creating... [02m40s elapsed]
module.fabric.ndfc_inventory_devices.nac_inventory_devices_1: Still creating... [02m50s elapsed]
module.fabric.ndfc_inventory_devices.nac_inventory_devices_1: Still creating... [03m00s elapsed]
module.fabric.ndfc_inventory_devices.nac_inventory_devices_1: Still creating... [03m10s elapsed]
module.fabric.ndfc_inventory_devices.nac_inventory_devices_1: Still creating... [03m20s elapsed]
module.fabric.ndfc_inventory_devices.nac_inventory_devices_1: Still creating... [03m30s elapsed]
module.fabric.ndfc_inventory_devices.nac_inventory_devices_1: Still creating... [03m40s elapsed]
module.fabric.ndfc_inventory_devices.nac_inventory_devices_1: Still creating... [03m50s elapsed]
module.fabric.ndfc_inventory_devices.nac_inventory_devices_1: Still creating... [04m00s elapsed]
module.fabric.ndfc_inventory_devices.nac_inventory_devices_1: Still creating... [04m10s elapsed]
module.fabric.ndfc_inventory_devices.nac_inventory_devices_1: Still creating... [04m20s elapsed]
module.fabric.ndfc_inventory_devices.nac_inventory_devices_1: Still creating... [04m30s elapsed]
module.fabric.ndfc_inventory_devices.nac_inventory_devices_1: Still creating... [04m40s elapsed]
module.fabric.ndfc_inventory_devices.nac_inventory_devices_1: Still creating... [04m50s elapsed]
module.fabric.ndfc_inventory_devices.nac_inventory_devices_1: Creation complete after 4m58s [id=fabric-terraform]
module.fabric.ndfc_vpc_pair.nac_vpc_pair_1: Creating...
module.fabric.ndfc_vpc_pair.nac_vpc_pair_1: Creation complete after 0s [id=9TYOJN2DXOW/9Y33RJS95NN]
module.fabric.ndfc_interface_ethernet.nac_interface_ethernet_1: Creating...
module.fabric.ndfc_interface_portchannel.nac_interface_portchannel_1: Creating...
module.fabric.ndfc_interface_loopback.nac_interface_loopback_1: Creating...
module.fabric.ndfc_interface_ethernet.nac_interface_ethernet_1: Creation complete after 6s [id=9Y33RJS95NN[Ethernet1/20]]
module.fabric.ndfc_interface_portchannel.nac_interface_portchannel_1: Creation complete after 8s [id=9Y33RJS95NN[port-channel100]]
module.fabric.ndfc_interface_loopback.nac_interface_loopback_1: Creation complete after 8s [id=9Y33RJS95NN[loopback101,loopback102,loopback100]]
module.fabric.ndfc_vrfs.nac_vrfs_1: Creating...
module.fabric.ndfc_vrfs.nac_vrfs_1: Creation complete after 1s [id=fabric-terraform/[NAC_TF_VRF1{9Y33RJS95NN,9TYOJN2DXOW}]]
module.fabric.ndfc_networks.nac_networks_1: Creating...
module.fabric.ndfc_networks.nac_networks_2: Creating...
module.fabric.ndfc_networks.nac_networks_1: Creation complete after 1s [id=fabric-terraform/[NAC_TF_NET1]]
module.fabric.ndfc_configuration_deploy.nac_configuration_deploy_1: Creating...
module.fabric.ndfc_networks.nac_networks_2: Creation complete after 1s [id=fabric-terraform/[NAC_TF_NET2]]
module.fabric.ndfc_configuration_deploy.nac_configuration_deploy_1: Still creating... [00m10s elapsed]
module.fabric.ndfc_configuration_deploy.nac_configuration_deploy_1: Still creating... [00m20s elapsed]
module.fabric.ndfc_configuration_deploy.nac_configuration_deploy_1: Still creating... [00m30s elapsed]
module.fabric.ndfc_configuration_deploy.nac_configuration_deploy_1: Still creating... [00m40s elapsed]
module.fabric.ndfc_configuration_deploy.nac_configuration_deploy_1: Still creating... [00m50s elapsed]
module.fabric.ndfc_configuration_deploy.nac_configuration_deploy_1: Still creating... [01m00s elapsed]
module.fabric.ndfc_configuration_deploy.nac_configuration_deploy_1: Still creating... [01m10s elapsed]
module.fabric.ndfc_configuration_deploy.nac_configuration_deploy_1: Still creating... [01m20s elapsed]
module.fabric.ndfc_configuration_deploy.nac_configuration_deploy_1: Still creating... [01m30s elapsed]
module.fabric.ndfc_configuration_deploy.nac_configuration_deploy_1: Still creating... [01m40s elapsed]
module.fabric.ndfc_configuration_deploy.nac_configuration_deploy_1: Still creating... [01m50s elapsed]
module.fabric.ndfc_configuration_deploy.nac_configuration_deploy_1: Still creating... [02m00s elapsed]
module.fabric.ndfc_configuration_deploy.nac_configuration_deploy_1: Still creating... [02m10s elapsed]
module.fabric.ndfc_configuration_deploy.nac_configuration_deploy_1: Still creating... [02m20s elapsed]
module.fabric.ndfc_configuration_deploy.nac_configuration_deploy_1: Still creating... [02m30s elapsed]
module.fabric.ndfc_configuration_deploy.nac_configuration_deploy_1: Still creating... [02m40s elapsed]
module.fabric.ndfc_configuration_deploy.nac_configuration_deploy_1: Still creating... [02m50s elapsed]
module.fabric.ndfc_configuration_deploy.nac_configuration_deploy_1: Still creating... [03m00s elapsed]
module.fabric.ndfc_configuration_deploy.nac_configuration_deploy_1: Still creating... [03m10s elapsed]
module.fabric.ndfc_configuration_deploy.nac_configuration_deploy_1: Creation complete after 3m19s [id=fabric-terraform]

Apply complete! Resources: 10 added, 0 changed, 0 destroyed.

Step 3 - Return to NDFC & Verify Deployment

Return to your NDFC browser window and verify the deployment of the fabric configuration.

  1. Once you login, verify your fabric-terraform has been created



  2. Double click on the fabric-terraform to open the fabric details page

  3. Verify your overall fabric deployment status in the Overview page

  4. Click the Switches tab in the top navigation bar

  5. Verify you see you switches in the Config Status as In-Sync. If not, please click the refresh button to the right of the Actions button



  6. Click the VRFs tab in the top navigation bar
  7. Verify you see the VRF NAC_TF_VRF1 with a Deployed status



  8. Click the Networks tab in the top navigation bar
  9. Verify you see the Networks NAC_TF_NET1 and NAC_TF_NET2 with a Deployed status

Congratulations! You have automated the build of a functional VXLAN EVPN Fabric using Terraform

If you still want to learn more, continue on to the next Bonus section where you will use Postman as a learning and testing tool for REST API's!