Task03
Fabric Variables

Create Fabric Variables

We'll use the same configuration for our staging fabric fabric-stage and our production fabric fabric-prod. While the functional configuration is identical, specifics like the switch inventory (hostnames, ip addresses) and fabric name differ. We'll split the shared/common functional configuration and fabric-specific configuration into separate files. We'll put the shared configurations into common.tfvars , and the fabric-specific configurations into stage.env.tfvars (fabric-stage) and prod.env.tfvars (fabric-prod). Our fabric devices will comprise Nexus 9300V and 9500v virtual machine instances to avoid having to physically rack/stack and cable. We're also reducing our carbon footprint and saving on energy bills since the virtual fabrics are destroyed after each pipeline run.

Step 1 - Common input variables

Let's create the new interfaces, VRF and network. These are common to both fabrics. Review the file common.tfvars:

    
code -r /home/cisco/CiscoLive/DEVWKS-3320/common.tfvars
    
    
loopbacks = [
  {
    loopback_id   = 20
    switch_id     = 101
    loopback_ipv4 = "100.100.100.1"
    vrf           = "vrf_app1"
    route_tag     = 12345
  },
  {
    loopback_id   = 20
    switch_id     = 102
    loopback_ipv4 = "100.100.100.1"
    vrf           = "vrf_app1"
    route_tag     = 12345
    route_tag     = 12345
  }
]

vpcs = [
  {
    vpc_id          = 30
    switch1_id      = 101
    switch2_id      = 102
    mode            = "active"
    bpdu_guard_flag = "true"
    mtu             = "jumbo"
    peer1_members   = ["eth1/3"]
    peer2_members   = ["eth1/3"]
  },
  {
    vpc_id          = 40
    switch1_id      = 101
    switch2_id      = 102
    mode            = "active"
    bpdu_guard_flag = "true"
    mtu             = "jumbo"
    peer1_members   = ["eth1/4"]
    peer2_members   = ["eth1/4"]
  }
]

vrfs = [
  {
    name        = "vrf_app1"
    segment_id  = 50001
    vlan_id     = 2010
    description = "application1"
    attachments = [
      {
        switch_id = 101
      },
      {
        switch_id = 102
      }
    ]
  }
]

networks = [
  {
    name         = "network_web"
    network_id   = 30001
    vlan_id      = 2311
    description  = "network for web tier"
    vrf_name     = "vrf_app1"
    ipv4_gateway = "10.1.1.1/24"
    attachments = [
      {
        switch_id = 101
        switch_ports = [
          "Port-channel30",
          "Port-channel40",
        ]
      },
      {
        switch_id = 102
        switch_ports = [
          "Port-channel30",
          "Port-channel40",
        ]
      }
    ]
  }
]
    

Step 2 - Create the fabric-specific variables for fabric-stage

Open stage.env.tfvars:

    
code -r /home/cisco/CiscoLive/DEVWKS-3320/stage.env.tfvars
    

Copy the content below to the file and press Ctrl+s to it.

    
    ndfc = {
      url      = "https://10.15.0.14",
      platform = "nd"
    }

    fabric_name = "fabric-stage"

    inventory = {
      101 = "staging-leaf1",
      102 = "staging-leaf2",
      201 = "staging-spine1",
    }
    

Step 3 - Create the fabric-specifc variables for fabric-prod

Open prod.env.tfvars:

    
code -r /home/cisco/CiscoLive/DEVWKS-3320/prod.env.tfvars
    

Copy the content below to the file and press Ctrl+s to it.

    
    ndfc = {
      url      = "https://10.15.0.14",
      platform = "nd"
    }

    fabric_name = "fabric-prod"

    inventory = {
      101 = "prod-leaf1",
      102 = "prod-leaf2",
      201 = "prod-spine1",
    }
    
  • Introduction
  • NDFC and Terraform
  • Envrionment and Topology
  • Task01 Interface Module
  • Task02 Overlay Module
  • Task03 CI/CD Pipeline
  • Bonus: Policy Module
  • Thanks