Skip to content

Commit 0c547a6

Browse files
authored
Merge pull request #167 from kadadhic/main
added support for DUAL_ARM
2 parents 709bf52 + 250e782 commit 0c547a6

File tree

3 files changed

+32
-1
lines changed

3 files changed

+32
-1
lines changed

docs/resources/device_vni.md

+3
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ description: |-
1717
multicast_groupaddress = "224.0.0.34"
1818
segment_id = 4011
1919
enable_proxy= false
20+
proxy_type = "DUAL_ARM"
2021
ipv4 {
2122
static {
2223
address = "3.3.3.3"
@@ -47,6 +48,7 @@ resource "fmc_device_vni" "my_fmc_device_vni" {
4748
multicast_groupaddress = "224.0.0.34"
4849
segment_id = 4011
4950
enable_proxy= false
51+
proxy_type = "DUAL_ARM"
5052
ipv4 {
5153
static {
5254
address = "3.3.3.3"
@@ -79,6 +81,7 @@ resource "fmc_device_vni" "my_fmc_device_vni" {
7981
- `ipv4` (Block List) IPV4 information (see [below for nested schema](#nestedblock--ipv4))
8082
- `multicast_groupaddress` (String) MulticastGroupAddress of the VNI
8183
- `priority` (Number) Priority of the VNI
84+
- `proxy_type` (String) Select one from [ SINGLE_ARM, DUAL_ARM, PAIRED ]
8285
- `security_zone_id` (String) securityZone of the VNI
8386
- `segment_id` (Number) SegmentId of the VNI
8487
- `vtep_id` (Number) The Device Id of VNI

fmc/fmc_device_vni.go

+2
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ type VNIRequest struct {
3636
SecurityZone VNISecurityZone `json:"securityZone"`
3737
IPv4 IPv4 `json:"ipv4,omitempty"`
3838
Type string `json:"type"`
39+
ProxyType string `json:"proxyType"`
3940
}
4041

4142
type VNIResponse struct {
@@ -52,6 +53,7 @@ type VNIResponse struct {
5253
Priority int `json:"priority"`
5354
Ifname string `json:"ifname"`
5455
SecurityZone VNISecurityZone `json:"securityZone"`
56+
ProxyType string `json:"proxyType"`
5557
}
5658

5759
/*

fmc/resource_fmc_device_vni.go

+27-1
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@ package fmc
22

33
import (
44
"context"
5+
"fmt"
56
"log"
67
"strconv"
8+
"strings"
79

810
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
911
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
@@ -26,6 +28,7 @@ func resourceVNI() *schema.Resource {
2628
" multicast_groupaddress = \"224.0.0.34\"\n" +
2729
" segment_id = 4011\n" +
2830
" enable_proxy= false\n" +
31+
" proxy_type = \"DUAL_ARM\"\n" +
2932
" ipv4 {\n" +
3033
" static {\n" +
3134
" address = \"3.3.3.3\"\n" +
@@ -104,6 +107,26 @@ func resourceVNI() *schema.Resource {
104107
Optional: true,
105108
Description: "EnableProxy of the VNI",
106109
},
110+
"proxy_type": {
111+
Type: schema.TypeString,
112+
Optional: true,
113+
Default: "SINGLE_ARM",
114+
Description: "Select one from [ SINGLE_ARM, DUAL_ARM, PAIRED ]",
115+
StateFunc: func(val interface{}) string {
116+
return strings.ToUpper(val.(string))
117+
},
118+
ValidateFunc: func(val interface{}, key string) (warns []string, errs []error) {
119+
v := strings.ToUpper(val.(string))
120+
allowedValues := []string{"SINGLE_ARM", "DUAL_ARM", "PAIRED"}
121+
for _, allowed := range allowedValues {
122+
if v == allowed {
123+
return
124+
}
125+
}
126+
errs = append(errs, fmt.Errorf("%q must be in %v, got: %q", key, allowedValues, v))
127+
return
128+
},
129+
},
107130
"ipv4": {
108131
Type: schema.TypeList,
109132
Optional: true,
@@ -198,6 +221,7 @@ func resourceVNICreate(ctx context.Context, d *schema.ResourceData, m interface{
198221
log.Printf("VNI: Creating virtual interface")
199222

200223
device_id := d.Get("device_id").(string)
224+
proxyType := d.Get("proxy_type").(string)
201225
ifname := d.Get("if_name").(string)
202226
description := d.Get("description").(string)
203227
security_zone_id := d.Get("security_zone_id").(string)
@@ -270,6 +294,7 @@ func resourceVNICreate(ctx context.Context, d *schema.ResourceData, m interface{
270294
SecurityZone: securityZone,
271295
IPv4: ipv4,
272296
VtepID: vtepid,
297+
ProxyType: proxyType,
273298
Type: "VNIInterface",
274299
Enabled: d.Get("enabled").(bool),
275300
})
@@ -301,7 +326,7 @@ func resourceVNIUpdate(ctx context.Context, d *schema.ResourceData, m interface{
301326

302327
if len(id) > 0 {
303328
device_id := d.Get("device_id").(string)
304-
329+
proxyType := d.Get("proxy_type").(string)
305330
ifname := d.Get("if_name").(string)
306331
description := d.Get("description").(string)
307332
security_zone_id := d.Get("security_zone_id").(string)
@@ -386,6 +411,7 @@ func resourceVNIUpdate(ctx context.Context, d *schema.ResourceData, m interface{
386411
SecurityZone: securityZone,
387412
IPv4: ipv4,
388413
VtepID: vtepid,
414+
ProxyType: proxyType,
389415
Type: "VNIInterface",
390416
Enabled: d.Get("enabled").(bool),
391417
})

0 commit comments

Comments
 (0)