@@ -86,6 +86,13 @@ it cannot be an IP address from Google Compute Engine.`,
86
86
},
87
87
},
88
88
},
89
+ "labels" : {
90
+ Type : schema .TypeMap ,
91
+ Optional : true ,
92
+ ForceNew : true ,
93
+ Description : `Labels for the external VPN gateway resource.` ,
94
+ Elem : & schema.Schema {Type : schema .TypeString },
95
+ },
89
96
"redundancy_type" : {
90
97
Type : schema .TypeString ,
91
98
Optional : true ,
@@ -122,6 +129,12 @@ func resourceComputeExternalVpnGatewayCreate(d *schema.ResourceData, meta interf
122
129
} else if v , ok := d .GetOkExists ("description" ); ! isEmptyValue (reflect .ValueOf (descriptionProp )) && (ok || ! reflect .DeepEqual (v , descriptionProp )) {
123
130
obj ["description" ] = descriptionProp
124
131
}
132
+ labelsProp , err := expandComputeExternalVpnGatewayLabels (d .Get ("labels" ), d , config )
133
+ if err != nil {
134
+ return err
135
+ } else if v , ok := d .GetOkExists ("labels" ); ! isEmptyValue (reflect .ValueOf (labelsProp )) && (ok || ! reflect .DeepEqual (v , labelsProp )) {
136
+ obj ["labels" ] = labelsProp
137
+ }
125
138
nameProp , err := expandComputeExternalVpnGatewayName (d .Get ("name" ), d , config )
126
139
if err != nil {
127
140
return err
@@ -224,6 +237,9 @@ func resourceComputeExternalVpnGatewayRead(d *schema.ResourceData, meta interfac
224
237
if err := d .Set ("description" , flattenComputeExternalVpnGatewayDescription (res ["description" ], d , config )); err != nil {
225
238
return fmt .Errorf ("Error reading ExternalVpnGateway: %s" , err )
226
239
}
240
+ if err := d .Set ("labels" , flattenComputeExternalVpnGatewayLabels (res ["labels" ], d , config )); err != nil {
241
+ return fmt .Errorf ("Error reading ExternalVpnGateway: %s" , err )
242
+ }
227
243
if err := d .Set ("name" , flattenComputeExternalVpnGatewayName (res ["name" ], d , config )); err != nil {
228
244
return fmt .Errorf ("Error reading ExternalVpnGateway: %s" , err )
229
245
}
@@ -309,6 +325,10 @@ func flattenComputeExternalVpnGatewayDescription(v interface{}, d *schema.Resour
309
325
return v
310
326
}
311
327
328
+ func flattenComputeExternalVpnGatewayLabels (v interface {}, d * schema.ResourceData , config * Config ) interface {} {
329
+ return v
330
+ }
331
+
312
332
func flattenComputeExternalVpnGatewayName (v interface {}, d * schema.ResourceData , config * Config ) interface {} {
313
333
return v
314
334
}
@@ -361,6 +381,17 @@ func expandComputeExternalVpnGatewayDescription(v interface{}, d TerraformResour
361
381
return v , nil
362
382
}
363
383
384
+ func expandComputeExternalVpnGatewayLabels (v interface {}, d TerraformResourceData , config * Config ) (map [string ]string , error ) {
385
+ if v == nil {
386
+ return map [string ]string {}, nil
387
+ }
388
+ m := make (map [string ]string )
389
+ for k , val := range v .(map [string ]interface {}) {
390
+ m [k ] = val .(string )
391
+ }
392
+ return m , nil
393
+ }
394
+
364
395
func expandComputeExternalVpnGatewayName (v interface {}, d TerraformResourceData , config * Config ) (interface {}, error ) {
365
396
return v , nil
366
397
}
0 commit comments