Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add billingType attribute to Apigee Organization resource #4126

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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-beta/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
1 change: 1 addition & 0 deletions google-beta/resource_apigee_organization_generated_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ resource "google_apigee_organization" "org" {
analytics_region = "us-central1"
project_id = google_project.project.project_id
authorized_network = google_compute_network.apigee_network.id
billing_type = "EVALUATION"
runtime_database_encryption_key_name = google_kms_crypto_key.apigee_key.id

depends_on = [
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