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 2e3d521ac945..da19428452ad 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 @@ -2,6 +2,7 @@ package compute import ( "fmt" + "strconv" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-provider-google/google/tpgresource" @@ -23,6 +24,14 @@ 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. + "numeric_id": { + Type: schema.TypeString, + Computed: true, + }, + "gateway_ipv4": { Type: schema.TypeString, Computed: true, @@ -95,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("numeric_id", strconv.Itoa(int(network.Id))); err != nil { + return fmt.Errorf("Error setting numeric_id: %s", err) + } if err := d.Set("subnetworks_self_links", network.Subnetworks); err != nil { return fmt.Errorf("Error setting subnetworks_self_links: %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 53b4d5152553..d54970e576a7 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", + "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 87dd65016fc7..8939a15df920 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,7 +262,7 @@ func TestAccComputeNetwork_numericId(t *testing.T) { { Config: testAccComputeNetwork_basic(networkName), Check: resource.ComposeTestCheckFunc( - resource.TestMatchResourceAttr("google_compute_network.bar", "numeric_id",regexp.MustCompile("^\\d{1,}$")), + 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 7ed18f65fe4a..dfe8b1f4cb35 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,6 +36,8 @@ 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. + * `gateway_ipv4` - The IP address of the gateway. * `internal_ipv6_range` - The ula internal ipv6 range assigned to this network.