Skip to content

Commit

Permalink
Add support for apiConsumerDataLocation, apiConsumerDataEncryptionKey…
Browse files Browse the repository at this point in the history
…Name, and controlPlaneEncryptionKeyName in Apigee Organization. (#10412) (#17874)

[upstream:afc8edcc2789e270a220de2f39e0586a42e9f1ad]

Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
modular-magician authored Apr 16, 2024
1 parent 691c9ee commit d27b66c
Show file tree
Hide file tree
Showing 3 changed files with 108 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .changelog/10412.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
apigee: add support for `api_consumer_data_location`, `api_consumer_data_encryption_key_name`, and `control_plane_encryption_key_name` in `google_apigee_organization`
```
90 changes: 90 additions & 0 deletions google/services/apigee/resource_apigee_organization.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,20 @@ func ResourceApigeeOrganization() *schema.Resource {
ForceNew: true,
Description: `Primary GCP region for analytics data storage. For valid values, see [Create an Apigee organization](https://cloud.google.com/apigee/docs/api-platform/get-started/create-org).`,
},
"api_consumer_data_encryption_key_name": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Description: `Cloud KMS key name used for encrypting API consumer data.`,
},
"api_consumer_data_location": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Description: `This field is needed only for customers using non-default data residency regions.
Apigee stores some control plane data only in single region.
This field determines which single region Apigee should use.`,
},
"authorized_network": {
Type: schema.TypeString,
Optional: true,
Expand All @@ -76,6 +90,13 @@ Valid only when 'RuntimeType' is set to CLOUD. The value can be updated only whe
ForceNew: true,
Description: `Billing type of the Apigee organization. See [Apigee pricing](https://cloud.google.com/apigee/pricing).`,
},
"control_plane_encryption_key_name": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Description: `Cloud KMS key name used for encrypting control plane data that is stored in a multi region.
Only used for the data residency region "US" or "EU".`,
},
"description": {
Type: schema.TypeString,
Optional: true,
Expand Down Expand Up @@ -205,6 +226,24 @@ func resourceApigeeOrganizationCreate(d *schema.ResourceData, meta interface{})
} else if v, ok := d.GetOkExists("analytics_region"); !tpgresource.IsEmptyValue(reflect.ValueOf(analyticsRegionProp)) && (ok || !reflect.DeepEqual(v, analyticsRegionProp)) {
obj["analyticsRegion"] = analyticsRegionProp
}
apiConsumerDataLocationProp, err := expandApigeeOrganizationApiConsumerDataLocation(d.Get("api_consumer_data_location"), d, config)
if err != nil {
return err
} else if v, ok := d.GetOkExists("api_consumer_data_location"); !tpgresource.IsEmptyValue(reflect.ValueOf(apiConsumerDataLocationProp)) && (ok || !reflect.DeepEqual(v, apiConsumerDataLocationProp)) {
obj["apiConsumerDataLocation"] = apiConsumerDataLocationProp
}
apiConsumerDataEncryptionKeyNameProp, err := expandApigeeOrganizationApiConsumerDataEncryptionKeyName(d.Get("api_consumer_data_encryption_key_name"), d, config)
if err != nil {
return err
} else if v, ok := d.GetOkExists("api_consumer_data_encryption_key_name"); !tpgresource.IsEmptyValue(reflect.ValueOf(apiConsumerDataEncryptionKeyNameProp)) && (ok || !reflect.DeepEqual(v, apiConsumerDataEncryptionKeyNameProp)) {
obj["apiConsumerDataEncryptionKeyName"] = apiConsumerDataEncryptionKeyNameProp
}
controlPlaneEncryptionKeyNameProp, err := expandApigeeOrganizationControlPlaneEncryptionKeyName(d.Get("control_plane_encryption_key_name"), d, config)
if err != nil {
return err
} else if v, ok := d.GetOkExists("control_plane_encryption_key_name"); !tpgresource.IsEmptyValue(reflect.ValueOf(controlPlaneEncryptionKeyNameProp)) && (ok || !reflect.DeepEqual(v, controlPlaneEncryptionKeyNameProp)) {
obj["controlPlaneEncryptionKeyName"] = controlPlaneEncryptionKeyNameProp
}
authorizedNetworkProp, err := expandApigeeOrganizationAuthorizedNetwork(d.Get("authorized_network"), d, config)
if err != nil {
return err
Expand Down Expand Up @@ -355,6 +394,15 @@ func resourceApigeeOrganizationRead(d *schema.ResourceData, meta interface{}) er
if err := d.Set("analytics_region", flattenApigeeOrganizationAnalyticsRegion(res["analyticsRegion"], d, config)); err != nil {
return fmt.Errorf("Error reading Organization: %s", err)
}
if err := d.Set("api_consumer_data_location", flattenApigeeOrganizationApiConsumerDataLocation(res["apiConsumerDataLocation"], d, config)); err != nil {
return fmt.Errorf("Error reading Organization: %s", err)
}
if err := d.Set("api_consumer_data_encryption_key_name", flattenApigeeOrganizationApiConsumerDataEncryptionKeyName(res["apiConsumerDataEncryptionKeyName"], d, config)); err != nil {
return fmt.Errorf("Error reading Organization: %s", err)
}
if err := d.Set("control_plane_encryption_key_name", flattenApigeeOrganizationControlPlaneEncryptionKeyName(res["controlPlaneEncryptionKeyName"], d, config)); err != nil {
return fmt.Errorf("Error reading Organization: %s", err)
}
if err := d.Set("authorized_network", flattenApigeeOrganizationAuthorizedNetwork(res["authorizedNetwork"], d, config)); err != nil {
return fmt.Errorf("Error reading Organization: %s", err)
}
Expand Down Expand Up @@ -414,6 +462,24 @@ func resourceApigeeOrganizationUpdate(d *schema.ResourceData, meta interface{})
} else if v, ok := d.GetOkExists("analytics_region"); !tpgresource.IsEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, analyticsRegionProp)) {
obj["analyticsRegion"] = analyticsRegionProp
}
apiConsumerDataLocationProp, err := expandApigeeOrganizationApiConsumerDataLocation(d.Get("api_consumer_data_location"), d, config)
if err != nil {
return err
} else if v, ok := d.GetOkExists("api_consumer_data_location"); !tpgresource.IsEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, apiConsumerDataLocationProp)) {
obj["apiConsumerDataLocation"] = apiConsumerDataLocationProp
}
apiConsumerDataEncryptionKeyNameProp, err := expandApigeeOrganizationApiConsumerDataEncryptionKeyName(d.Get("api_consumer_data_encryption_key_name"), d, config)
if err != nil {
return err
} else if v, ok := d.GetOkExists("api_consumer_data_encryption_key_name"); !tpgresource.IsEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, apiConsumerDataEncryptionKeyNameProp)) {
obj["apiConsumerDataEncryptionKeyName"] = apiConsumerDataEncryptionKeyNameProp
}
controlPlaneEncryptionKeyNameProp, err := expandApigeeOrganizationControlPlaneEncryptionKeyName(d.Get("control_plane_encryption_key_name"), d, config)
if err != nil {
return err
} else if v, ok := d.GetOkExists("control_plane_encryption_key_name"); !tpgresource.IsEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, controlPlaneEncryptionKeyNameProp)) {
obj["controlPlaneEncryptionKeyName"] = controlPlaneEncryptionKeyNameProp
}
authorizedNetworkProp, err := expandApigeeOrganizationAuthorizedNetwork(d.Get("authorized_network"), d, config)
if err != nil {
return err
Expand Down Expand Up @@ -598,6 +664,18 @@ func flattenApigeeOrganizationAnalyticsRegion(v interface{}, d *schema.ResourceD
return v
}

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

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

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

func flattenApigeeOrganizationAuthorizedNetwork(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
return v
}
Expand Down Expand Up @@ -684,6 +762,18 @@ func expandApigeeOrganizationAnalyticsRegion(v interface{}, d tpgresource.Terraf
return v, nil
}

func expandApigeeOrganizationApiConsumerDataLocation(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}

func expandApigeeOrganizationApiConsumerDataEncryptionKeyName(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}

func expandApigeeOrganizationControlPlaneEncryptionKeyName(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}

func expandApigeeOrganizationAuthorizedNetwork(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
return v, nil
}
Expand Down
15 changes: 15 additions & 0 deletions website/docs/r/apigee_organization.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,21 @@ The following arguments are supported:
(Optional)
Primary GCP region for analytics data storage. For valid values, see [Create an Apigee organization](https://cloud.google.com/apigee/docs/api-platform/get-started/create-org).

* `api_consumer_data_location` -
(Optional)
This field is needed only for customers using non-default data residency regions.
Apigee stores some control plane data only in single region.
This field determines which single region Apigee should use.

* `api_consumer_data_encryption_key_name` -
(Optional)
Cloud KMS key name used for encrypting API consumer data.

* `control_plane_encryption_key_name` -
(Optional)
Cloud KMS key name used for encrypting control plane data that is stored in a multi region.
Only used for the data residency region "US" or "EU".

* `authorized_network` -
(Optional)
Compute Engine network used for Service Networking to be peered with Apigee runtime instances.
Expand Down

0 comments on commit d27b66c

Please sign in to comment.