Forum Discussion

ganeshkumar12's avatar
ganeshkumar12
Icon for Nimbostratus rankNimbostratus
Apr 12, 2024

create multiple VIPs on F5 using AS3 JSON File and Dynamic Variables

I want to create multiple VIPs using a single piece of code - example dynamic variables in TFVARS.

resources like application name , VIP Name, VIP IP Address, Irule, Profile, Backend Pool should be taken as input in the Tfvars file.

Does anyone have a sample code for the same- 

I am using the following .tf file-

================

# Terraform code for AS3

 

 

resource "bigip_as3" "as3-f5-VIPS" {

 

as3_json = file("as3.json")

 

}

  • the sample JSON file used by me is as follows-

    ====================================

    {
      "$schema": "https://raw.githubusercontent.com/F5Networks/f5-appsvcs-extension/main/schema/latest/as3-schema.json",
      "class": "AS3",
      "action": "deploy",
      "persist": true,
      "declaration": {
        "class": "ADC",
        "schemaVersion": "3.0.0",
        "id": "123abc",
        "label": "Sample AS3-V8 Tenant5",
        "remark": "HTTPS with predictive-node pool",
        "Tenant5": {
          "class": "Tenant",
          "app1": {
            "class": "Application",
            
              "apitest.abc.com_http": {
              "class": "Service_HTTP",
              "remark": "apitest.abc.com_http",
              "iRules":[
                {"bigip":"/Common/New-X-Forwarded-For"}
                ],
               "profileTCP": {"bigip": "/Common/mptcp-mobile-optimized"},
               "virtualAddresses": [
                "192.0.2.11"
              ],
              
           
            "serviceAddress": {
              "class": "Service_Address",
              "virtualAddress": "192.0.2.11",
              "arpEnabled": true,
              "icmpEcho": "enable",
              "trafficGroup": "none",
              "routeAdvertisement": "disable"
              },
              "pool": {"bigip": "/Common/Shared/api_pool"}
            }
          },
              
            "app2": {
            "class": "Application",  

            "apitest.abc.com_https": {
              "class": "Service_HTTPS",
              "remark": "apitest.abc.com_https",
              "profileHTTP": {"bigip": "/Common/http_hsts_xf"},
              "iRules":[
                {"bigip":"/Common/New-X-Forwarded-For"}
                ],
               "profileTCP": {"bigip": "/Common/mptcp-mobile-optimized"},
               "virtualAddresses": [
                "192.0.2.11"
              ],
              "pool": {"bigip": "/Common/gcpane2ews_443"},
              "serverTLS": {"bigip": "/Common/certsvcgcpandev3.lab-us.gcpint.abc.com"},
              "redirect80": false 
              }
           }
         }
       }
    }