Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Promote port mapping negs to ga #12551

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions mmv1/products/compute/RegionNetworkEndpoint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ examples:
network_name: 'network'
- name: 'region_network_endpoint_portmap'
primary_resource_id: 'region_network_endpoint_portmap'
min_version: 'beta'
vars:
network_name: 'network'
subnetwork_name: 'subnetwork'
Expand Down Expand Up @@ -140,7 +139,6 @@ properties:
type: Integer
description: |
Client destination port for the `GCE_VM_IP_PORTMAP` NEG.
min_version: 'beta'
custom_flatten: 'templates/terraform/custom_flatten/float64_to_int.go.tmpl'
- name: 'instance'
type: ResourceRef
Expand All @@ -149,4 +147,3 @@ properties:
This is required for network endpoints of type GCE_VM_IP_PORTMAP.
resource: 'Instance'
imports: 'name'
min_version: 'beta'
1 change: 0 additions & 1 deletion mmv1/products/compute/RegionNetworkEndpointGroup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ examples:
network_name: 'network'
- name: 'region_network_endpoint_group_portmap'
primary_resource_id: 'region_network_endpoint_group_portmap'
min_version: 'beta'
vars:
network_name: 'network'
subnetwork_name: 'subnetwork'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,15 @@ resource "google_compute_region_network_endpoint_group" "{{$.PrimaryResourceId}}
subnetwork = google_compute_subnetwork.default.id

network_endpoint_type = "GCE_VM_IP_PORTMAP"
provider = google-beta
}

resource "google_compute_network" "default" {
name = "{{index $.Vars "network_name"}}"
provider = google-beta
}

resource "google_compute_subnetwork" "default" {
name = "{{index $.Vars "subnetwork_name"}}"
ip_cidr_range = "10.0.0.0/16"
region = "us-central1"
network = google_compute_network.default.id
provider = google-beta
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
resource "google_compute_network" "default" {
name = "{{index $.Vars "network_name"}}"
auto_create_subnetworks = false
provider = google-beta
}

resource "google_compute_subnetwork" "default" {
name = "{{index $.Vars "subnetwork_name"}}"
ip_cidr_range = "10.0.0.0/16"
region = "us-central1"
network = google_compute_network.default.id
provider = google-beta
}

resource "google_compute_region_network_endpoint_group" default {
Expand All @@ -19,7 +17,6 @@ resource "google_compute_region_network_endpoint_group" default {
subnetwork = google_compute_subnetwork.default.id

network_endpoint_type = "GCE_VM_IP_PORTMAP"
provider = google-beta
}

resource "google_compute_region_network_endpoint" "{{$.PrimaryResourceId}}" {
Expand All @@ -29,13 +26,11 @@ resource "google_compute_region_network_endpoint" "{{$.PrimaryResourceId}}" {
port = 80
ip_address = google_compute_instance.default.network_interface[0].network_ip
client_destination_port = 8080
provider = google-beta
}

data "google_compute_image" "my_image" {
family = "debian-11"
project = "debian-cloud"
provider = google-beta
}

resource "google_compute_instance" "default" {
Expand All @@ -54,5 +49,4 @@ resource "google_compute_instance" "default" {
access_config {
}
}
provider = google-beta
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ if fqdnProp != "" {
toDelete["fqdn"] = fqdnProp
}

{{- if ne $.TargetVersionName "ga" }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: for this file and possibly the test file, if they no longer need beta-only behavior, you could change them to just be .go files. Of course, if you will just be adding more beta fields again soon, then it might be easier just to keep them this way.

// Instance
instanceProp, err := expandNestedComputeRegionNetworkEndpointInstance(d.Get("instance"), d, config)
if err != nil {
Expand All @@ -45,7 +44,6 @@ if err != nil {
if clientDestinationPortProp != "" && d.Get("client_destination_port").(int) > 0 {
toDelete["clientDestinationPort"] = clientDestinationPortProp
}
{{- end }}

obj = map[string]interface{}{
"networkEndpoints": []map[string]interface{}{toDelete},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,6 @@ resource "google_compute_region_network_endpoint" "add2" {
`, context) + testAccComputeRegionNetworkEndpoint_noRegionNetworkEndpoints(context)
}

{{- if ne $.TargetVersionName "ga" }}

func TestAccComputeRegionNetworkEndpoint_regionNetworkEndpointPortmapExample(t *testing.T) {
t.Parallel()

Expand All @@ -161,7 +159,7 @@ func TestAccComputeRegionNetworkEndpoint_regionNetworkEndpointPortmapExample(t *

acctest.VcrTest(t, resource.TestCase{
PreCheck: func() { acctest.AccTestPreCheck(t) },
ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t),
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You'll need to remove the references to provider = google-beta in these configs to fix the check

Steps: []resource.TestStep{
{
Config: testAccComputeRegionNetworkEndpoint_regionNetworkEndpointPortmapExample(context),
Expand Down Expand Up @@ -249,7 +247,6 @@ resource "google_compute_region_network_endpoint" "region_network_endpoint_portm
}
`, context) + testAccComputeRegionNetworkEndpoint_regionNetworkEndpointPortmapNoEndpointExample(context)
}
{{- end }}

func testAccComputeRegionNetworkEndpoint_noRegionNetworkEndpoints(context map[string]interface{}) string {
return acctest.Nprintf(`
Expand Down
Loading