diff --git a/mmv1/products/filestore/Instance.yaml b/mmv1/products/filestore/Instance.yaml index 12ca3ef1d256..64bc35e5274e 100644 --- a/mmv1/products/filestore/Instance.yaml +++ b/mmv1/products/filestore/Instance.yaml @@ -213,6 +213,10 @@ properties: A /29 CIDR block that identifies the range of IP addresses reserved for this instance. default_from_api: true + # When using connectMode=PRIVATE_SERVICE_ACCESS, the returned value + # won't match the sent value as the returned value is an IP range + # from the provided named range. + custom_flatten: templates/terraform/custom_flatten/filestore_instance_networks_reserved_ip_range.go.erb - !ruby/object:Api::Type::Array name: 'ipAddresses' description: | diff --git a/mmv1/templates/terraform/custom_flatten/filestore_instance_networks_reserved_ip_range.go.erb b/mmv1/templates/terraform/custom_flatten/filestore_instance_networks_reserved_ip_range.go.erb new file mode 100644 index 000000000000..fbeda7892254 --- /dev/null +++ b/mmv1/templates/terraform/custom_flatten/filestore_instance_networks_reserved_ip_range.go.erb @@ -0,0 +1,17 @@ +<%# The license inside this block applies to this file. + # Copyright 2018 Google Inc. + # Licensed under the Apache License, Version 2.0 (the "License"); + # you may not use this file except in compliance with the License. + # You may obtain a copy of the License at + # + # http://www.apache.org/licenses/LICENSE-2.0 + # + # Unless required by applicable law or agreed to in writing, software + # distributed under the License is distributed on an "AS IS" BASIS, + # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + # See the License for the specific language governing permissions and + # limitations under the License. +-%> +func flatten<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} { + return d.Get("networks.0.reserved_ip_range") +} diff --git a/mmv1/third_party/terraform/services/filestore/resource_filestore_instance_test.go b/mmv1/third_party/terraform/services/filestore/resource_filestore_instance_test.go index 04ae0db3a6cf..96d44c1c8244 100644 --- a/mmv1/third_party/terraform/services/filestore/resource_filestore_instance_test.go +++ b/mmv1/third_party/terraform/services/filestore/resource_filestore_instance_test.go @@ -134,7 +134,7 @@ func TestAccFilestoreInstance_reservedIpRange_update(t *testing.T) { ResourceName: "google_filestore_instance.instance", ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"zone", "location"}, + ImportStateVerifyIgnore: []string{"zone", "location", "networks.0.reserved_ip_range"}, }, { Config: testAccFilestoreInstance_reservedIpRange_update2(name), @@ -143,7 +143,7 @@ func TestAccFilestoreInstance_reservedIpRange_update(t *testing.T) { ResourceName: "google_filestore_instance.instance", ImportState: true, ImportStateVerify: true, - ImportStateVerifyIgnore: []string{"zone", "location"}, + ImportStateVerifyIgnore: []string{"zone", "location", "networks.0.reserved_ip_range"}, }, }, })