Fabric
NDFC Terraform

Fabric Configuration with Terraform

In this section you will be creating the Terraform configuration for the Fabric

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


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


resource is the Terraform keyword used to declare that you are defining an infrastructure resource.

  • ndfc_fabric_vxlan_evpn indicates the specific type of resource within that provider, in this case, a VXLAN EVPN fabric configuration managed by NDFC.
  • nac_fabric1 is the local name or identifier for this particular instance of the resource within your Terraform configuration. You'll use this name to refer to this specific fabric in other parts of your configuration (e.g., ndfc_fabric_vxlan_evpn.nac_fabric1.fabric_name). This name must be unique within its resource type in the current module.
    • fabric_name is the argument that sets the name of the VXLAN EVPN fabric in NDFC.
    • var.fabric_name indicates that the value for this argument is coming from a Terraform input variable named fabric_name. You defined this variable in the previous section in the variables.tf file. This is a best practice for making your configurations flexible and reusable, as you can define this variable in variables.tf and provide its value at runtime or in a terraform.tfvars file.


resource "ndfc_fabric_vxlan_evpn" "nac_fabric1" {
  fabric_name                                 = var.fabric_name
  anycast_gw_mac                              = "2020.0000.00aa"
  grfield_debug_flag                          = "Enable"
  bgp_as                                      = "65000"
  ospf_area_id                                = "0.0.0.0"
  ospf_auth_enable                            = false
  overlay_mode                                = "cli"
  deploy                                      = false
}


Step 2 - Close All Open VSCode Tabs for Next Terraform Section

In your VSCode application; on the keyword press Ctrl + K + W. This should close all open tabs to clear your workspace.