@@ -2,8 +2,10 @@ package fmc
2
2
3
3
import (
4
4
"context"
5
+ "fmt"
5
6
"log"
6
7
"strconv"
8
+ "strings"
7
9
8
10
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
9
11
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
@@ -26,6 +28,7 @@ func resourceVNI() *schema.Resource {
26
28
" multicast_groupaddress = \" 224.0.0.34\" \n " +
27
29
" segment_id = 4011\n " +
28
30
" enable_proxy= false\n " +
31
+ " proxy_type = \" DUAL_ARM\" \n " +
29
32
" ipv4 {\n " +
30
33
" static {\n " +
31
34
" address = \" 3.3.3.3\" \n " +
@@ -104,6 +107,26 @@ func resourceVNI() *schema.Resource {
104
107
Optional : true ,
105
108
Description : "EnableProxy of the VNI" ,
106
109
},
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
+ },
107
130
"ipv4" : {
108
131
Type : schema .TypeList ,
109
132
Optional : true ,
@@ -198,6 +221,7 @@ func resourceVNICreate(ctx context.Context, d *schema.ResourceData, m interface{
198
221
log .Printf ("VNI: Creating virtual interface" )
199
222
200
223
device_id := d .Get ("device_id" ).(string )
224
+ proxyType := d .Get ("proxy_type" ).(string )
201
225
ifname := d .Get ("if_name" ).(string )
202
226
description := d .Get ("description" ).(string )
203
227
security_zone_id := d .Get ("security_zone_id" ).(string )
@@ -270,6 +294,7 @@ func resourceVNICreate(ctx context.Context, d *schema.ResourceData, m interface{
270
294
SecurityZone : securityZone ,
271
295
IPv4 : ipv4 ,
272
296
VtepID : vtepid ,
297
+ ProxyType : proxyType ,
273
298
Type : "VNIInterface" ,
274
299
Enabled : d .Get ("enabled" ).(bool ),
275
300
})
@@ -301,7 +326,7 @@ func resourceVNIUpdate(ctx context.Context, d *schema.ResourceData, m interface{
301
326
302
327
if len (id ) > 0 {
303
328
device_id := d .Get ("device_id" ).(string )
304
-
329
+ proxyType := d . Get ( "proxy_type" ).( string )
305
330
ifname := d .Get ("if_name" ).(string )
306
331
description := d .Get ("description" ).(string )
307
332
security_zone_id := d .Get ("security_zone_id" ).(string )
@@ -386,6 +411,7 @@ func resourceVNIUpdate(ctx context.Context, d *schema.ResourceData, m interface{
386
411
SecurityZone : securityZone ,
387
412
IPv4 : ipv4 ,
388
413
VtepID : vtepid ,
414
+ ProxyType : proxyType ,
389
415
Type : "VNIInterface" ,
390
416
Enabled : d .Get ("enabled" ).(bool ),
391
417
})
0 commit comments