Skip to content

Commit b788478

Browse files
Add billingType attribute to Apigee Organization resource (#5796) (#4126)
Co-authored-by: Stephen Lewis (Burrows) <[email protected]> Signed-off-by: Modular Magician <[email protected]> Co-authored-by: Stephen Lewis (Burrows) <[email protected]>
1 parent da5fbf1 commit b788478

File tree

4 files changed

+38
-0
lines changed

4 files changed

+38
-0
lines changed

.changelog/5796.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:new-resource
2+
Add billingType attribute to Apigee Organization resource.
3+
```

google-beta/resource_apigee_organization.go

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,13 @@ func resourceApigeeOrganization() *schema.Resource {
6161
See [Getting started with the Service Networking API](https://cloud.google.com/service-infrastructure/docs/service-networking/getting-started).
6262
Valid only when 'RuntimeType' is set to CLOUD. The value can be updated only when there are no runtime instances. For example: "default".`,
6363
},
64+
"billing_type": {
65+
Type: schema.TypeString,
66+
Computed: true,
67+
Optional: true,
68+
ForceNew: true,
69+
Description: `Billing type of the Apigee organization. See [Apigee pricing](https://cloud.google.com/apigee/pricing).`,
70+
},
6471
"description": {
6572
Type: schema.TypeString,
6673
Optional: true,
@@ -148,6 +155,12 @@ func resourceApigeeOrganizationCreate(d *schema.ResourceData, meta interface{})
148155
} else if v, ok := d.GetOkExists("runtime_type"); !isEmptyValue(reflect.ValueOf(runtimeTypeProp)) && (ok || !reflect.DeepEqual(v, runtimeTypeProp)) {
149156
obj["runtimeType"] = runtimeTypeProp
150157
}
158+
billingTypeProp, err := expandApigeeOrganizationBillingType(d.Get("billing_type"), d, config)
159+
if err != nil {
160+
return err
161+
} else if v, ok := d.GetOkExists("billing_type"); !isEmptyValue(reflect.ValueOf(billingTypeProp)) && (ok || !reflect.DeepEqual(v, billingTypeProp)) {
162+
obj["billingType"] = billingTypeProp
163+
}
151164
runtimeDatabaseEncryptionKeyNameProp, err := expandApigeeOrganizationRuntimeDatabaseEncryptionKeyName(d.Get("runtime_database_encryption_key_name"), d, config)
152165
if err != nil {
153166
return err
@@ -258,6 +271,9 @@ func resourceApigeeOrganizationRead(d *schema.ResourceData, meta interface{}) er
258271
if err := d.Set("subscription_type", flattenApigeeOrganizationSubscriptionType(res["subscriptionType"], d, config)); err != nil {
259272
return fmt.Errorf("Error reading Organization: %s", err)
260273
}
274+
if err := d.Set("billing_type", flattenApigeeOrganizationBillingType(res["billingType"], d, config)); err != nil {
275+
return fmt.Errorf("Error reading Organization: %s", err)
276+
}
261277
if err := d.Set("ca_certificate", flattenApigeeOrganizationCaCertificate(res["caCertificate"], d, config)); err != nil {
262278
return fmt.Errorf("Error reading Organization: %s", err)
263279
}
@@ -308,6 +324,12 @@ func resourceApigeeOrganizationUpdate(d *schema.ResourceData, meta interface{})
308324
} else if v, ok := d.GetOkExists("runtime_type"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, runtimeTypeProp)) {
309325
obj["runtimeType"] = runtimeTypeProp
310326
}
327+
billingTypeProp, err := expandApigeeOrganizationBillingType(d.Get("billing_type"), d, config)
328+
if err != nil {
329+
return err
330+
} else if v, ok := d.GetOkExists("billing_type"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, billingTypeProp)) {
331+
obj["billingType"] = billingTypeProp
332+
}
311333
runtimeDatabaseEncryptionKeyNameProp, err := expandApigeeOrganizationRuntimeDatabaseEncryptionKeyName(d.Get("runtime_database_encryption_key_name"), d, config)
312334
if err != nil {
313335
return err
@@ -461,6 +483,10 @@ func flattenApigeeOrganizationSubscriptionType(v interface{}, d *schema.Resource
461483
return v
462484
}
463485

486+
func flattenApigeeOrganizationBillingType(v interface{}, d *schema.ResourceData, config *Config) interface{} {
487+
return v
488+
}
489+
464490
func flattenApigeeOrganizationCaCertificate(v interface{}, d *schema.ResourceData, config *Config) interface{} {
465491
return v
466492
}
@@ -489,6 +515,10 @@ func expandApigeeOrganizationRuntimeType(v interface{}, d TerraformResourceData,
489515
return v, nil
490516
}
491517

518+
func expandApigeeOrganizationBillingType(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
519+
return v, nil
520+
}
521+
492522
func expandApigeeOrganizationRuntimeDatabaseEncryptionKeyName(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
493523
return v, nil
494524
}

google-beta/resource_apigee_organization_generated_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,7 @@ resource "google_apigee_organization" "org" {
246246
analytics_region = "us-central1"
247247
project_id = google_project.project.project_id
248248
authorized_network = google_compute_network.apigee_network.id
249+
billing_type = "EVALUATION"
249250
runtime_database_encryption_key_name = google_kms_crypto_key.apigee_key.id
250251
251252
depends_on = [

website/docs/r/apigee_organization.html.markdown

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,10 @@ The following arguments are supported:
167167
Default value is `CLOUD`.
168168
Possible values are `CLOUD` and `HYBRID`.
169169

170+
* `billing_type` -
171+
(Optional)
172+
Billing type of the Apigee organization. See [Apigee pricing](https://cloud.google.com/apigee/pricing).
173+
170174
* `runtime_database_encryption_key_name` -
171175
(Optional)
172176
Cloud KMS key name used for encrypting the data that is stored and replicated across runtime instances.

0 commit comments

Comments
 (0)