@@ -196,6 +196,27 @@ The default is 20.`,
196
196
Description : `Indicates if a router is dedicated for use with encrypted VLAN
197
197
attachments (interconnectAttachments).` ,
198
198
},
199
+ "md5_authentication_keys" : {
200
+ Type : schema .TypeList ,
201
+ Optional : true ,
202
+ Description : `Keys used for MD5 authentication.` ,
203
+ MaxItems : 1 ,
204
+ Elem : & schema.Resource {
205
+ Schema : map [string ]* schema.Schema {
206
+ "key" : {
207
+ Type : schema .TypeString ,
208
+ Required : true ,
209
+ Description : `Value of the key used for MD5 authentication.` ,
210
+ },
211
+ "name" : {
212
+ Type : schema .TypeString ,
213
+ Required : true ,
214
+ Description : `Name used to identify the key. Must be unique within a router.
215
+ Must be referenced by exactly one bgpPeer. Must comply with RFC1035.` ,
216
+ },
217
+ },
218
+ },
219
+ },
199
220
"region" : {
200
221
Type : schema .TypeString ,
201
222
Computed : true ,
@@ -262,6 +283,12 @@ func resourceComputeRouterCreate(d *schema.ResourceData, meta interface{}) error
262
283
} else if v , ok := d .GetOkExists ("encrypted_interconnect_router" ); ! tpgresource .IsEmptyValue (reflect .ValueOf (encryptedInterconnectRouterProp )) && (ok || ! reflect .DeepEqual (v , encryptedInterconnectRouterProp )) {
263
284
obj ["encryptedInterconnectRouter" ] = encryptedInterconnectRouterProp
264
285
}
286
+ md5AuthenticationKeysProp , err := expandComputeRouterMd5AuthenticationKeys (d .Get ("md5_authentication_keys" ), d , config )
287
+ if err != nil {
288
+ return err
289
+ } else if v , ok := d .GetOkExists ("md5_authentication_keys" ); ! tpgresource .IsEmptyValue (reflect .ValueOf (md5AuthenticationKeysProp )) && (ok || ! reflect .DeepEqual (v , md5AuthenticationKeysProp )) {
290
+ obj ["md5AuthenticationKeys" ] = md5AuthenticationKeysProp
291
+ }
265
292
regionProp , err := expandComputeRouterRegion (d .Get ("region" ), d , config )
266
293
if err != nil {
267
294
return err
@@ -430,6 +457,12 @@ func resourceComputeRouterUpdate(d *schema.ResourceData, meta interface{}) error
430
457
} else if v , ok := d .GetOkExists ("bgp" ); ok || ! reflect .DeepEqual (v , bgpProp ) {
431
458
obj ["bgp" ] = bgpProp
432
459
}
460
+ md5AuthenticationKeysProp , err := expandComputeRouterMd5AuthenticationKeys (d .Get ("md5_authentication_keys" ), d , config )
461
+ if err != nil {
462
+ return err
463
+ } else if v , ok := d .GetOkExists ("md5_authentication_keys" ); ! tpgresource .IsEmptyValue (reflect .ValueOf (v )) && (ok || ! reflect .DeepEqual (v , md5AuthenticationKeysProp )) {
464
+ obj ["md5AuthenticationKeys" ] = md5AuthenticationKeysProp
465
+ }
433
466
434
467
lockName , err := tpgresource .ReplaceVars (d , config , "router/{{region}}/{{name}}" )
435
468
if err != nil {
@@ -824,6 +857,40 @@ func expandComputeRouterEncryptedInterconnectRouter(v interface{}, d tpgresource
824
857
return v , nil
825
858
}
826
859
860
+ func expandComputeRouterMd5AuthenticationKeys (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
861
+ l := v .([]interface {})
862
+ if len (l ) == 0 || l [0 ] == nil {
863
+ return nil , nil
864
+ }
865
+ raw := l [0 ]
866
+ original := raw .(map [string ]interface {})
867
+ transformed := make (map [string ]interface {})
868
+
869
+ transformedName , err := expandComputeRouterMd5AuthenticationKeysName (original ["name" ], d , config )
870
+ if err != nil {
871
+ return nil , err
872
+ } else if val := reflect .ValueOf (transformedName ); val .IsValid () && ! tpgresource .IsEmptyValue (val ) {
873
+ transformed ["name" ] = transformedName
874
+ }
875
+
876
+ transformedKey , err := expandComputeRouterMd5AuthenticationKeysKey (original ["key" ], d , config )
877
+ if err != nil {
878
+ return nil , err
879
+ } else if val := reflect .ValueOf (transformedKey ); val .IsValid () && ! tpgresource .IsEmptyValue (val ) {
880
+ transformed ["key" ] = transformedKey
881
+ }
882
+
883
+ return transformed , nil
884
+ }
885
+
886
+ func expandComputeRouterMd5AuthenticationKeysName (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
887
+ return v , nil
888
+ }
889
+
890
+ func expandComputeRouterMd5AuthenticationKeysKey (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
891
+ return v , nil
892
+ }
893
+
827
894
func expandComputeRouterRegion (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
828
895
f , err := tpgresource .ParseGlobalFieldValue ("regions" , v .(string ), "project" , d , config , true )
829
896
if err != nil {
0 commit comments