Skip to content

Commit

Permalink
Add billingType attribute to Apigee Organization resource (#5796) (#1…
Browse files Browse the repository at this point in the history
…1285)

Co-authored-by: Stephen Lewis (Burrows) <stephen.r.burrows@gmail.com>
Signed-off-by: Modular Magician <magic-modules@google.com>

Co-authored-by: Stephen Lewis (Burrows) <stephen.r.burrows@gmail.com>
  • Loading branch information
modular-magician and melinath committed Mar 15, 2022
1 parent be9af86 commit f37276b
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .changelog/5796.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:new-resource
Add billingType attribute to Apigee Organization resource.
```
30 changes: 30 additions & 0 deletions google/resource_apigee_organization.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,13 @@ func resourceApigeeOrganization() *schema.Resource {
See [Getting started with the Service Networking API](https://cloud.google.com/service-infrastructure/docs/service-networking/getting-started).
Valid only when 'RuntimeType' is set to CLOUD. The value can be updated only when there are no runtime instances. For example: "default".`,
},
"billing_type": {
Type: schema.TypeString,
Computed: true,
Optional: true,
ForceNew: true,
Description: `Billing type of the Apigee organization. See [Apigee pricing](https://cloud.google.com/apigee/pricing).`,
},
"description": {
Type: schema.TypeString,
Optional: true,
Expand Down Expand Up @@ -148,6 +155,12 @@ func resourceApigeeOrganizationCreate(d *schema.ResourceData, meta interface{})
} else if v, ok := d.GetOkExists("runtime_type"); !isEmptyValue(reflect.ValueOf(runtimeTypeProp)) && (ok || !reflect.DeepEqual(v, runtimeTypeProp)) {
obj["runtimeType"] = runtimeTypeProp
}
billingTypeProp, err := expandApigeeOrganizationBillingType(d.Get("billing_type"), d, config)
if err != nil {
return err
} else if v, ok := d.GetOkExists("billing_type"); !isEmptyValue(reflect.ValueOf(billingTypeProp)) && (ok || !reflect.DeepEqual(v, billingTypeProp)) {
obj["billingType"] = billingTypeProp
}
runtimeDatabaseEncryptionKeyNameProp, err := expandApigeeOrganizationRuntimeDatabaseEncryptionKeyName(d.Get("runtime_database_encryption_key_name"), d, config)
if err != nil {
return err
Expand Down Expand Up @@ -258,6 +271,9 @@ func resourceApigeeOrganizationRead(d *schema.ResourceData, meta interface{}) er
if err := d.Set("subscription_type", flattenApigeeOrganizationSubscriptionType(res["subscriptionType"], d, config)); err != nil {
return fmt.Errorf("Error reading Organization: %s", err)
}
if err := d.Set("billing_type", flattenApigeeOrganizationBillingType(res["billingType"], d, config)); err != nil {
return fmt.Errorf("Error reading Organization: %s", err)
}
if err := d.Set("ca_certificate", flattenApigeeOrganizationCaCertificate(res["caCertificate"], d, config)); err != nil {
return fmt.Errorf("Error reading Organization: %s", err)
}
Expand Down Expand Up @@ -308,6 +324,12 @@ func resourceApigeeOrganizationUpdate(d *schema.ResourceData, meta interface{})
} else if v, ok := d.GetOkExists("runtime_type"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, runtimeTypeProp)) {
obj["runtimeType"] = runtimeTypeProp
}
billingTypeProp, err := expandApigeeOrganizationBillingType(d.Get("billing_type"), d, config)
if err != nil {
return err
} else if v, ok := d.GetOkExists("billing_type"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, billingTypeProp)) {
obj["billingType"] = billingTypeProp
}
runtimeDatabaseEncryptionKeyNameProp, err := expandApigeeOrganizationRuntimeDatabaseEncryptionKeyName(d.Get("runtime_database_encryption_key_name"), d, config)
if err != nil {
return err
Expand Down Expand Up @@ -461,6 +483,10 @@ func flattenApigeeOrganizationSubscriptionType(v interface{}, d *schema.Resource
return v
}

func flattenApigeeOrganizationBillingType(v interface{}, d *schema.ResourceData, config *Config) interface{} {
return v
}

func flattenApigeeOrganizationCaCertificate(v interface{}, d *schema.ResourceData, config *Config) interface{} {
return v
}
Expand Down Expand Up @@ -489,6 +515,10 @@ func expandApigeeOrganizationRuntimeType(v interface{}, d TerraformResourceData,
return v, nil
}

func expandApigeeOrganizationBillingType(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
return v, nil
}

func expandApigeeOrganizationRuntimeDatabaseEncryptionKeyName(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
return v, nil
}
Expand Down
4 changes: 4 additions & 0 deletions website/docs/r/apigee_organization.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,10 @@ The following arguments are supported:
Default value is `CLOUD`.
Possible values are `CLOUD` and `HYBRID`.

* `billing_type` -
(Optional)
Billing type of the Apigee organization. See [Apigee pricing](https://cloud.google.com/apigee/pricing).

* `runtime_database_encryption_key_name` -
(Optional)
Cloud KMS key name used for encrypting the data that is stored and replicated across runtime instances.
Expand Down

0 comments on commit f37276b

Please sign in to comment.