|
| 1 | +# Configure a template |
| 2 | +resource "panos_template" "example" { |
| 3 | + location = { |
| 4 | + panorama = {} |
| 5 | + } |
| 6 | + name = "example-template" |
| 7 | +} |
| 8 | + |
| 9 | +# Configure ethernet interfaces |
| 10 | +resource "panos_ethernet_interface" "eth1" { |
| 11 | + location = { |
| 12 | + template = { |
| 13 | + name = panos_template.example.name |
| 14 | + } |
| 15 | + } |
| 16 | + name = "ethernet1/1" |
| 17 | + layer3 = {} |
| 18 | +} |
| 19 | + |
| 20 | +resource "panos_ethernet_interface" "eth2" { |
| 21 | + location = { |
| 22 | + template = { |
| 23 | + name = panos_template.example.name |
| 24 | + } |
| 25 | + } |
| 26 | + name = "ethernet1/2" |
| 27 | + layer3 = {} |
| 28 | +} |
| 29 | + |
| 30 | +resource "panos_ethernet_interface" "eth3" { |
| 31 | + location = { |
| 32 | + template = { |
| 33 | + name = panos_template.example.name |
| 34 | + } |
| 35 | + } |
| 36 | + name = "ethernet1/3" |
| 37 | + layer3 = {} |
| 38 | +} |
| 39 | + |
| 40 | +resource "panos_ethernet_interface" "eth4" { |
| 41 | + location = { |
| 42 | + template = { |
| 43 | + name = panos_template.example.name |
| 44 | + } |
| 45 | + } |
| 46 | + name = "ethernet1/4" |
| 47 | + layer3 = {} |
| 48 | +} |
| 49 | + |
| 50 | +resource "panos_ethernet_interface" "eth5" { |
| 51 | + location = { |
| 52 | + template = { |
| 53 | + name = panos_template.example.name |
| 54 | + } |
| 55 | + } |
| 56 | + name = "ethernet1/5" |
| 57 | + layer3 = {} |
| 58 | +} |
| 59 | + |
| 60 | +# DHCP Relay configuration |
| 61 | +resource "panos_dhcp" "relay_example" { |
| 62 | + location = { |
| 63 | + template = { |
| 64 | + name = panos_template.example.name |
| 65 | + } |
| 66 | + } |
| 67 | + name = panos_ethernet_interface.eth1.name |
| 68 | + |
| 69 | + relay = { |
| 70 | + ip = { |
| 71 | + enabled = true |
| 72 | + server = ["10.0.0.1", "10.0.0.2"] |
| 73 | + } |
| 74 | + } |
| 75 | +} |
| 76 | + |
| 77 | +# DHCP Relay IPv6 configuration |
| 78 | +resource "panos_dhcp" "relay_ipv6_example" { |
| 79 | + location = { |
| 80 | + template = { |
| 81 | + name = panos_template.example.name |
| 82 | + } |
| 83 | + } |
| 84 | + name = panos_ethernet_interface.eth2.name |
| 85 | + |
| 86 | + relay = { |
| 87 | + ipv6 = { |
| 88 | + enabled = true |
| 89 | + server = [ |
| 90 | + { |
| 91 | + name = "2001:db8::1" |
| 92 | + interface = panos_ethernet_interface.eth1.name |
| 93 | + }, |
| 94 | + { |
| 95 | + name = "2001:db8::2" |
| 96 | + } |
| 97 | + ] |
| 98 | + } |
| 99 | + } |
| 100 | +} |
| 101 | + |
| 102 | +# DHCP Server configuration with various options |
| 103 | +resource "panos_dhcp" "server_example" { |
| 104 | + location = { |
| 105 | + template = { |
| 106 | + name = panos_template.example.name |
| 107 | + } |
| 108 | + } |
| 109 | + name = panos_ethernet_interface.eth3.name |
| 110 | + |
| 111 | + server = { |
| 112 | + ip_pool = ["192.168.1.0/24"] |
| 113 | + mode = "enabled" |
| 114 | + option = { |
| 115 | + dns = { |
| 116 | + primary = "8.8.8.8" |
| 117 | + secondary = "8.8.4.4" |
| 118 | + } |
| 119 | + dns_suffix = "example.com" |
| 120 | + gateway = "192.168.1.1" |
| 121 | + lease = { |
| 122 | + timeout = 720 |
| 123 | + } |
| 124 | + nis = { |
| 125 | + primary = "192.168.1.10" |
| 126 | + secondary = "192.168.1.11" |
| 127 | + } |
| 128 | + ntp = { |
| 129 | + primary = "192.168.1.20" |
| 130 | + secondary = "192.168.1.21" |
| 131 | + } |
| 132 | + pop3_server = "192.168.1.30" |
| 133 | + smtp_server = "192.168.1.25" |
| 134 | + subnet_mask = "255.255.255.0" |
| 135 | + wins = { |
| 136 | + primary = "192.168.1.40" |
| 137 | + secondary = "192.168.1.41" |
| 138 | + } |
| 139 | + user_defined = [ |
| 140 | + { |
| 141 | + name = "custom_ip_option" |
| 142 | + code = 200 |
| 143 | + ip = ["10.0.0.1", "10.0.0.2"] |
| 144 | + inherited = false |
| 145 | + }, |
| 146 | + { |
| 147 | + name = "custom_ascii_option" |
| 148 | + code = 201 |
| 149 | + ascii = ["custom option"] |
| 150 | + inherited = false |
| 151 | + }, |
| 152 | + { |
| 153 | + name = "custom_hex_option" |
| 154 | + code = 202 |
| 155 | + hex = ["0A0B0C"] |
| 156 | + inherited = false |
| 157 | + } |
| 158 | + ] |
| 159 | + } |
| 160 | + reserved = [ |
| 161 | + { |
| 162 | + name = "192.168.1.100" |
| 163 | + mac = "00:11:22:33:44:55" |
| 164 | + description = "reserved-printer" |
| 165 | + } |
| 166 | + ] |
| 167 | + } |
| 168 | +} |
| 169 | + |
| 170 | +# DHCP Server configuration with unlimited lease |
| 171 | +resource "panos_dhcp" "server_unlimited_lease_example" { |
| 172 | + location = { |
| 173 | + template = { |
| 174 | + name = panos_template.example.name |
| 175 | + } |
| 176 | + } |
| 177 | + name = panos_ethernet_interface.eth4.name |
| 178 | + |
| 179 | + server = { |
| 180 | + ip_pool = ["192.168.2.0/24"] |
| 181 | + option = { |
| 182 | + lease = { |
| 183 | + unlimited = {} |
| 184 | + } |
| 185 | + } |
| 186 | + } |
| 187 | +} |
| 188 | + |
| 189 | +# DHCP Server configuration with inheritance |
| 190 | +resource "panos_dhcp" "server_inheritance_example" { |
| 191 | + location = { |
| 192 | + template = { |
| 193 | + name = panos_template.example.name |
| 194 | + } |
| 195 | + } |
| 196 | + name = panos_ethernet_interface.eth5.name |
| 197 | + |
| 198 | + server = { |
| 199 | + ip_pool = ["192.168.3.0/24"] |
| 200 | + option = { |
| 201 | + inheritance = { |
| 202 | + source = panos_ethernet_interface.eth1.name |
| 203 | + } |
| 204 | + } |
| 205 | + } |
| 206 | +} |
0 commit comments