Skip to content

Commit b669860

Browse files
committed
network profiles and RDMA v1 support
1 parent 8765b37 commit b669860

11 files changed

+12
-33
lines changed

.github/PULL_REQUEST_TEMPLATE.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ For example: Fixes https://github.com/hashicorp/terraform-provider-google/issues
1111

1212
See [Write release notes](https://googlecloudplatform.github.io/magic-modules/contribute/release-notes/) for guidance.
1313

14-
```release-note:REPLACEME
15-
14+
```release-note:enhancement
15+
compute: added `network_profile` field to `google_compute_network` resource. Added support for MRDMA and IRDMA nic types.
1616
```

mmv1/products/compute/Network.yaml

+1-2
Original file line numberDiff line numberDiff line change
@@ -230,10 +230,9 @@ properties:
230230
- name: 'networkProfile'
231231
type: String
232232
immutable: true
233-
min_version: 'beta'
234233
description: |
235234
A full or partial URL of the network profile to apply to this network.
236235
This field can be set only at resource creation time. For example, the
237236
following are valid URLs:
238-
* https://www.googleapis.com/compute/beta/projects/{projectId}/global/networkProfiles/{network_profile_name}
237+
* https://www.googleapis.com/compute/{api_version}/projects/{projectId}/global/networkProfiles/{network_profile_name}
239238
* projects/{projectId}/global/networkProfiles/{network_profile_name}

mmv1/third_party/terraform/services/compute/data_source_google_compute_network.go.tmpl

-4
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,10 @@ func DataSourceGoogleComputeNetwork() *schema.Resource {
4242
Computed: true,
4343
},
4444

45-
{{- if ne $.TargetVersionName "ga" }}
4645
"network_profile": {
4746
Type: schema.TypeString,
4847
Optional: true,
4948
},
50-
{{- end }}
5149

5250
"self_link": {
5351
Type: schema.TypeString,
@@ -93,11 +91,9 @@ func dataSourceGoogleComputeNetworkRead(d *schema.ResourceData, meta interface{}
9391
if err := d.Set("internal_ipv6_range", network.InternalIpv6Range); err != nil {
9492
return fmt.Errorf("Error setting internal_ipv6_range: %s", err)
9593
}
96-
{{- if ne $.TargetVersionName "ga" }}
9794
if err := d.Set("network_profile", network.NetworkProfile); err != nil {
9895
return fmt.Errorf("Error setting network_profile: %s", err)
9996
}
100-
{{- end }}
10197
if err := d.Set("self_link", network.SelfLink); err != nil {
10298
return fmt.Errorf("Error setting self_link: %s", err)
10399
}

mmv1/third_party/terraform/services/compute/resource_compute_instance.go.tmpl

-5
Original file line numberDiff line numberDiff line change
@@ -467,13 +467,8 @@ func ResourceComputeInstance() *schema.Resource {
467467
Type: schema.TypeString,
468468
Optional: true,
469469
ForceNew: true,
470-
{{- if eq $.TargetVersionName `ga` }}
471-
ValidateFunc: validation.StringInSlice([]string{"GVNIC", "VIRTIO_NET", "IDPF"}, false),
472-
Description: `The type of vNIC to be used on this interface. Possible values:GVNIC, VIRTIO_NET, IDPF`,
473-
{{- else }}
474470
ValidateFunc: validation.StringInSlice([]string{"GVNIC", "VIRTIO_NET", "IDPF", "MRDMA", "IRDMA"}, false),
475471
Description: `The type of vNIC to be used on this interface. Possible values:GVNIC, VIRTIO_NET, IDPF, MRDMA, and IRDMA`,
476-
{{- end }}
477472
},
478473
"access_config": {
479474
Type: schema.TypeList,

mmv1/third_party/terraform/services/compute/resource_compute_instance_template.go.tmpl

-5
Original file line numberDiff line numberDiff line change
@@ -487,13 +487,8 @@ Google Cloud KMS.`,
487487
Type: schema.TypeString,
488488
Optional: true,
489489
ForceNew: true,
490-
{{- if eq $.TargetVersionName `ga` }}
491-
ValidateFunc: validation.StringInSlice([]string{"GVNIC", "VIRTIO_NET"}, false),
492-
Description: `The type of vNIC to be used on this interface. Possible values:GVNIC, VIRTIO_NET`,
493-
{{- else }}
494490
ValidateFunc: validation.StringInSlice([]string{"GVNIC", "VIRTIO_NET", "MRDMA", "IRDMA"}, false),
495491
Description: `The type of vNIC to be used on this interface. Possible values:GVNIC, VIRTIO_NET, MRDMA, and IRDMA`,
496-
{{- end }}
497492
},
498493
"access_config": {
499494
Type: schema.TypeList,

mmv1/third_party/terraform/services/compute/resource_compute_network_test.go.tmpl

+5-6
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,7 @@ func TestAccComputeNetwork_bgpInterRegionCostAndUpdate(t *testing.T) {
218218
},
219219
})
220220
}
221+
{{- end }}
221222

222223
func TestAccComputeNetwork_networkProfile(t *testing.T) {
223224
t.Parallel()
@@ -226,11 +227,11 @@ func TestAccComputeNetwork_networkProfile(t *testing.T) {
226227
suffixName := acctest.RandString(t, 10)
227228
networkName := fmt.Sprintf("tf-test-network-profile-%s", suffixName)
228229
projectId := envvar.GetTestProjectFromEnv()
229-
profileURL := fmt.Sprintf("https://www.googleapis.com/compute/beta/projects/%s/global/networkProfiles/europe-west1-b-vpc-roce", projectId)
230+
profileURL := fmt.Sprintf("https://www.googleapis.com/compute/v1/projects/%s/global/networkProfiles/europe-west1-b-vpc-roce", projectId)
230231

231232
acctest.VcrTest(t, resource.TestCase{
232233
PreCheck: func() { acctest.AccTestPreCheck(t) },
233-
ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t),
234+
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),
234235
CheckDestroy: testAccCheckComputeNetworkDestroyProducer(t),
235236
Steps: []resource.TestStep{
236237
{
@@ -245,7 +246,6 @@ func TestAccComputeNetwork_networkProfile(t *testing.T) {
245246
},
246247
})
247248
}
248-
{{- end }}
249249

250250
func TestAccComputeNetwork_numericId(t *testing.T) {
251251
t.Parallel()
@@ -650,6 +650,7 @@ func testAccCheckComputeNetworkHasBgpInterRegionCost(t *testing.T, n string, net
650650
return nil
651651
}
652652
}
653+
{{- end }}
653654

654655
func testAccCheckComputeNetworkHasNetworkProfile(t *testing.T, n string, network *compute.Network, networkProfile string) resource.TestCheckFunc {
655656
return func(s *terraform.State) error {
@@ -679,7 +680,6 @@ func testAccCheckComputeNetworkHasNetworkProfile(t *testing.T, n string, network
679680
return nil
680681
}
681682
}
682-
{{- end }}
683683

684684
func testAccCheckComputeNetworkHasNetworkFirewallPolicyEnforcementOrder(t *testing.T, n string, network *compute.Network, order string) resource.TestCheckFunc {
685685
return func(s *terraform.State) error {
@@ -791,19 +791,18 @@ resource "google_compute_network" "acc_network_bgp_inter_region_cost" {
791791
}
792792
`, networkName, bgpInterRegionCost)
793793
}
794+
{{- end }}
794795

795796
func testAccComputeNetwork_network_profile(networkName, networkProfile string) string {
796797
return fmt.Sprintf(`
797798
resource "google_compute_network" "acc_network_network_profile" {
798-
provider = google-beta
799799
name = "%s"
800800
routing_mode = "REGIONAL"
801801
network_profile = "%s"
802802
auto_create_subnetworks = false
803803
}
804804
`, networkName, networkProfile)
805805
}
806-
{{- end }}
807806

808807
func testAccComputeNetwork_deleteDefaultRoute(networkName string) string {
809808
return fmt.Sprintf(`

mmv1/third_party/terraform/services/compute/resource_compute_region_instance_template.go.tmpl

-5
Original file line numberDiff line numberDiff line change
@@ -455,13 +455,8 @@ Google Cloud KMS.`,
455455
Type: schema.TypeString,
456456
Optional: true,
457457
ForceNew: true,
458-
{{- if eq $.TargetVersionName `ga` }}
459-
ValidateFunc: validation.StringInSlice([]string{"GVNIC", "VIRTIO_NET"}, false),
460-
Description: `The type of vNIC to be used on this interface. Possible values:GVNIC, VIRTIO_NET`,
461-
{{- else }}
462458
ValidateFunc: validation.StringInSlice([]string{"GVNIC", "VIRTIO_NET", "MRDMA", "IRDMA"}, false),
463459
Description: `The type of vNIC to be used on this interface. Possible values:GVNIC, VIRTIO_NET, MRDMA, and IRDMA`,
464-
{{- end }}
465460
},
466461
"access_config": {
467462
Type: schema.TypeList,

mmv1/third_party/terraform/website/docs/d/compute_network.html.markdown

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ In addition to the arguments listed above, the following attributes are exported
4242

4343
* `internal_ipv6_range` - The ula internal ipv6 range assigned to this network.
4444

45-
* `network_profile` - [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html) A full or partial URL of the network profile to apply to this network.
45+
* `network_profile` - A full or partial URL of the network profile to apply to this network.
4646

4747
* `subnetworks_self_links` - the list of subnetworks which belong to the network
4848

mmv1/third_party/terraform/website/docs/r/compute_instance.html.markdown

+1-1
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ is desired, you will need to modify your state file manually using
397397
array of alias IP ranges for this network interface. Can only be specified for network
398398
interfaces on subnet-mode networks. Structure [documented below](#nested_alias_ip_range).
399399

400-
* `nic_type` - (Optional) The type of vNIC to be used on this interface. Possible values: GVNIC, VIRTIO_NET, IDPF. In the beta provider the additional values of MRDMA and IRDMA are supported.
400+
* `nic_type` - (Optional) The type of vNIC to be used on this interface. Possible values: GVNIC, VIRTIO_NET, IDPF, MRDMA, IRDMA.
401401

402402
* `network_attachment` - (Optional) [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html) The URL of the network attachment that this interface should connect to in the following format: `projects/{projectNumber}/regions/{region_name}/networkAttachments/{network_attachment_name}`.
403403

mmv1/third_party/terraform/website/docs/r/compute_instance_template.html.markdown

+1-1
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,7 @@ The following arguments are supported:
561561
array of alias IP ranges for this network interface. Can only be specified for network
562562
interfaces on subnet-mode networks. Structure [documented below](#nested_alias_ip_range).
563563

564-
* `nic_type` - (Optional) The type of vNIC to be used on this interface. Possible values: GVNIC, VIRTIO_NET. In the beta provider the additional values of MRDMA and IRDMA are supported.
564+
* `nic_type` - (Optional) The type of vNIC to be used on this interface. Possible values: GVNIC, VIRTIO_NET, MRDMA, IRDMA.
565565

566566
* `stack_type` - (Optional) The stack type for this network interface to identify whether the IPv6 feature is enabled or not. Values are IPV4_IPV6 or IPV4_ONLY. If not specified, IPV4_ONLY will be used.
567567

mmv1/third_party/terraform/website/docs/r/compute_region_instance_template.html.markdown

+1-1
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,7 @@ The following arguments are supported:
527527
array of alias IP ranges for this network interface. Can only be specified for network
528528
interfaces on subnet-mode networks. Structure [documented below](#nested_alias_ip_range).
529529

530-
* `nic_type` - (Optional) The type of vNIC to be used on this interface. Possible values: GVNIC, VIRTIO_NET. In the beta provider the additional values of MRDMA and IRDMA are supported.
530+
* `nic_type` - (Optional) The type of vNIC to be used on this interface. Possible values: GVNIC, VIRTIO_NET, MRDMA, IRDMA.
531531

532532
* `stack_type` - (Optional) The stack type for this network interface to identify whether the IPv6 feature is enabled or not. Values are IPV4_IPV6 or IPV4_ONLY. If not specified, IPV4_ONLY will be used.
533533

0 commit comments

Comments
 (0)