@@ -128,6 +128,16 @@ all instances.`,
128
128
},
129
129
},
130
130
},
131
+ "type" : {
132
+ Type : schema .TypeString ,
133
+ Computed : true ,
134
+ Optional : true ,
135
+ ValidateFunc : verify .ValidateEnum ([]string {"ENVIRONMENT_TYPE_UNSPECIFIED" , "BASE" , "INTERMEDIATE" , "COMPREHENSIVE" , "" }),
136
+ Description : `Types that can be selected for an Environment. Each of the types are
137
+ limited by capability and capacity. Refer to Apigee's public documentation
138
+ to understand about each of these types in details.
139
+ An Apigee org can support heterogeneous Environments. Possible values: ["ENVIRONMENT_TYPE_UNSPECIFIED", "BASE", "INTERMEDIATE", "COMPREHENSIVE"]` ,
140
+ },
131
141
},
132
142
UseJSONNumber : true ,
133
143
}
@@ -177,6 +187,12 @@ func resourceApigeeEnvironmentCreate(d *schema.ResourceData, meta interface{}) e
177
187
} else if v , ok := d .GetOkExists ("node_config" ); ! tpgresource .IsEmptyValue (reflect .ValueOf (nodeConfigProp )) && (ok || ! reflect .DeepEqual (v , nodeConfigProp )) {
178
188
obj ["nodeConfig" ] = nodeConfigProp
179
189
}
190
+ typeProp , err := expandApigeeEnvironmentType (d .Get ("type" ), d , config )
191
+ if err != nil {
192
+ return err
193
+ } else if v , ok := d .GetOkExists ("type" ); ! tpgresource .IsEmptyValue (reflect .ValueOf (typeProp )) && (ok || ! reflect .DeepEqual (v , typeProp )) {
194
+ obj ["type" ] = typeProp
195
+ }
180
196
181
197
url , err := tpgresource .ReplaceVars (d , config , "{{ApigeeBasePath}}{{org_id}}/environments" )
182
198
if err != nil {
@@ -288,6 +304,9 @@ func resourceApigeeEnvironmentRead(d *schema.ResourceData, meta interface{}) err
288
304
if err := d .Set ("node_config" , flattenApigeeEnvironmentNodeConfig (res ["nodeConfig" ], d , config )); err != nil {
289
305
return fmt .Errorf ("Error reading Environment: %s" , err )
290
306
}
307
+ if err := d .Set ("type" , flattenApigeeEnvironmentType (res ["type" ], d , config )); err != nil {
308
+ return fmt .Errorf ("Error reading Environment: %s" , err )
309
+ }
291
310
292
311
return nil
293
312
}
@@ -308,6 +327,12 @@ func resourceApigeeEnvironmentUpdate(d *schema.ResourceData, meta interface{}) e
308
327
} else if v , ok := d .GetOkExists ("node_config" ); ! tpgresource .IsEmptyValue (reflect .ValueOf (v )) && (ok || ! reflect .DeepEqual (v , nodeConfigProp )) {
309
328
obj ["nodeConfig" ] = nodeConfigProp
310
329
}
330
+ typeProp , err := expandApigeeEnvironmentType (d .Get ("type" ), d , config )
331
+ if err != nil {
332
+ return err
333
+ } else if v , ok := d .GetOkExists ("type" ); ! tpgresource .IsEmptyValue (reflect .ValueOf (v )) && (ok || ! reflect .DeepEqual (v , typeProp )) {
334
+ obj ["type" ] = typeProp
335
+ }
311
336
312
337
url , err := tpgresource .ReplaceVars (d , config , "{{ApigeeBasePath}}{{org_id}}/environments/{{name}}" )
313
338
if err != nil {
@@ -320,6 +345,10 @@ func resourceApigeeEnvironmentUpdate(d *schema.ResourceData, meta interface{}) e
320
345
if d .HasChange ("node_config" ) {
321
346
updateMask = append (updateMask , "nodeConfig" )
322
347
}
348
+
349
+ if d .HasChange ("type" ) {
350
+ updateMask = append (updateMask , "type" )
351
+ }
323
352
// updateMask is a URL parameter but not present in the schema, so ReplaceVars
324
353
// won't set it
325
354
url , err = transport_tpg .AddQueryParams (url , map [string ]string {"updateMask" : strings .Join (updateMask , "," )})
@@ -503,6 +532,10 @@ func flattenApigeeEnvironmentNodeConfigCurrentAggregateNodeCount(v interface{},
503
532
return v
504
533
}
505
534
535
+ func flattenApigeeEnvironmentType (v interface {}, d * schema.ResourceData , config * transport_tpg.Config ) interface {} {
536
+ return v
537
+ }
538
+
506
539
func expandApigeeEnvironmentName (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
507
540
return v , nil
508
541
}
@@ -567,3 +600,7 @@ func expandApigeeEnvironmentNodeConfigMaxNodeCount(v interface{}, d tpgresource.
567
600
func expandApigeeEnvironmentNodeConfigCurrentAggregateNodeCount (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
568
601
return v , nil
569
602
}
603
+
604
+ func expandApigeeEnvironmentType (v interface {}, d tpgresource.TerraformResourceData , config * transport_tpg.Config ) (interface {}, error ) {
605
+ return v , nil
606
+ }
0 commit comments