diff --git a/mmv1/products/compute/Network.yaml b/mmv1/products/compute/Network.yaml index faecf827e85a..ea4d7aed8bb3 100644 --- a/mmv1/products/compute/Network.yaml +++ b/mmv1/products/compute/Network.yaml @@ -116,10 +116,16 @@ properties: immutable: true validation: function: 'verify.ValidateGCEName' + - name: 'networkId' + description: | + The unique identifier for the resource. This identifier is defined by the server. + api_name: id + output: true - name: 'numericId' type: String description: | The unique identifier for the resource. This identifier is defined by the server. + deprecation_message: '`numeric_id` is deprecated and will be removed in a future major release. Use `network_id` instead.' output: true - name: 'autoCreateSubnetworks' type: Boolean diff --git a/mmv1/third_party/terraform/services/compute/data_source_google_compute_network.go.tmpl b/mmv1/third_party/terraform/services/compute/data_source_google_compute_network.go.tmpl index b125e9e960fc..0800230929f7 100644 --- a/mmv1/third_party/terraform/services/compute/data_source_google_compute_network.go.tmpl +++ b/mmv1/third_party/terraform/services/compute/data_source_google_compute_network.go.tmpl @@ -24,12 +24,16 @@ func DataSourceGoogleComputeNetwork() *schema.Resource { Computed: true, }, - // TODO: this should eventually be TypeInt, but leaving as - // string for now to match the resource and to avoid a - // breaking change. + "network_id": { + Type: schema.TypeInt, + Computed: true, + }, + + // Deprecated in favor of network_id "numeric_id": { Type: schema.TypeString, Computed: true, + Deprecated: "`numeric_id` is deprecated and will be removed in a future major release. Use `network_id` instead.", }, "gateway_ipv4": { @@ -100,6 +104,9 @@ func dataSourceGoogleComputeNetworkRead(d *schema.ResourceData, meta interface{} if err := d.Set("description", network.Description); err != nil { return fmt.Errorf("Error setting description: %s", err) } + if err := d.Set("network_id", network.Id); err != nil { + return fmt.Errorf("Error setting network_id: %s", err) + } if err := d.Set("numeric_id", strconv.Itoa(int(network.Id))); err != nil { return fmt.Errorf("Error setting numeric_id: %s", err) } diff --git a/mmv1/third_party/terraform/services/compute/data_source_google_compute_network_test.go b/mmv1/third_party/terraform/services/compute/data_source_google_compute_network_test.go index d54970e576a7..71e6d4f0caa5 100644 --- a/mmv1/third_party/terraform/services/compute/data_source_google_compute_network_test.go +++ b/mmv1/third_party/terraform/services/compute/data_source_google_compute_network_test.go @@ -45,6 +45,7 @@ func testAccDataSourceGoogleNetworkCheck(data_source_name string, resource_name network_attrs_to_test := []string{ "id", "name", + "network_id", "numeric_id", "description", "internal_ipv6_range", diff --git a/mmv1/third_party/terraform/services/compute/resource_compute_network_test.go.tmpl b/mmv1/third_party/terraform/services/compute/resource_compute_network_test.go.tmpl index 45c5f35c9842..1efdc729fc0d 100644 --- a/mmv1/third_party/terraform/services/compute/resource_compute_network_test.go.tmpl +++ b/mmv1/third_party/terraform/services/compute/resource_compute_network_test.go.tmpl @@ -262,6 +262,7 @@ func TestAccComputeNetwork_numericId(t *testing.T) { { Config: testAccComputeNetwork_basic(networkName), Check: resource.ComposeTestCheckFunc( + resource.TestMatchResourceAttr("google_compute_network.bar", "network_id",regexp.MustCompile("^\\d{16,48}$")), resource.TestMatchResourceAttr("google_compute_network.bar", "numeric_id",regexp.MustCompile("^\\d{16,48}$")), resource.TestCheckResourceAttr("google_compute_network.bar", "id", networkId), ), diff --git a/mmv1/third_party/terraform/website/docs/d/compute_network.html.markdown b/mmv1/third_party/terraform/website/docs/d/compute_network.html.markdown index 12ca1874b23a..c35a66159a1a 100644 --- a/mmv1/third_party/terraform/website/docs/d/compute_network.html.markdown +++ b/mmv1/third_party/terraform/website/docs/d/compute_network.html.markdown @@ -36,7 +36,9 @@ In addition to the arguments listed above, the following attributes are exported * `description` - Description of this network. -* `numeric_id` - The numeric unique identifier for the resource. +* `network_id` - The numeric unique identifier for the resource. + +* `numeric_id` - (Deprecated) The numeric unique identifier for the resource. `numeric_id` is deprecated and will be removed in a future major release. Use `network_id` instead. * `gateway_ipv4` - The IP address of the gateway.