Skip to content

Commit

Permalink
Migrate compute firewall policy rule in GA (#12310)
Browse files Browse the repository at this point in the history
  • Loading branch information
trodge authored Nov 13, 2024
1 parent 7936dcc commit a39b355
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 26 deletions.
1 change: 0 additions & 1 deletion mmv1/products/compute/FirewallPolicyRule.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ name: 'FirewallPolicyRule'
kind: 'compute#firewallPolicyRule'
description: |
Represents a rule that describes one or more match conditions along with the action to be taken when traffic matches this condition (allow or deny).
min_version: 'beta'
references:
guides:
api: 'https://cloud.google.com/compute/docs/reference/rest/v1/firewallPolicies/addRule'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
resource "google_network_security_address_group" "basic_global_networksecurity_address_group" {
provider = google-beta

name = "{{index $.Vars "address"}}"
parent = "organizations/{{index $.TestEnvVars "org_id"}}"
description = "Sample global networksecurity_address_group"
Expand All @@ -11,24 +9,18 @@ resource "google_network_security_address_group" "basic_global_networksecurity_a
}

resource "google_folder" "folder" {
provider = google-beta

display_name = "{{index $.Vars "folder"}}"
parent = "organizations/{{index $.TestEnvVars "org_id"}}"
deletion_protection = false
}

resource "google_compute_firewall_policy" "default" {
provider = google-beta

parent = google_folder.folder.id
short_name = "{{index $.Vars "fw_policy"}}"
description = "Resource created for Terraform acceptance testing"
}

resource "google_compute_firewall_policy_rule" "{{$.PrimaryResourceId}}" {
provider = google-beta

firewall_policy = google_compute_firewall_policy.default.name
description = "Resource created for Terraform acceptance testing"
priority = 9000
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ package compute
import (
"bytes"
"context"
{{- if ne $.TargetVersionName "ga" }}
"encoding/json"
{{- end }}
"errors"
"fmt"
"io"
Expand All @@ -27,9 +25,7 @@ type ComputeOperationWaiter struct {
Op *compute.Operation
Context context.Context
Project string
{{- if ne $.TargetVersionName "ga" }}
Parent string
{{- end }}
}

func (w *ComputeOperationWaiter) State() string {
Expand Down Expand Up @@ -86,10 +82,8 @@ func (w *ComputeOperationWaiter) QueryOp() (interface{}, error) {
} else if w.Op.Region != "" {
region := tpgresource.GetResourceNameFromSelfLink(w.Op.Region)
return w.Service.RegionOperations.Get(w.Project, region, w.Op.Name).Do()
{{- if ne $.TargetVersionName "ga" }}
} else if w.Parent != "" {
return w.Service.GlobalOrganizationOperations.Get(w.Op.Name).ParentId(w.Parent).Do()
{{- end }}
}
return w.Service.GlobalOperations.Get(w.Project, w.Op.Name).Do()
}
Expand Down Expand Up @@ -130,7 +124,6 @@ func ComputeOperationWaitTime(config *transport_tpg.Config, res interface{}, pro
return tpgresource.OperationWait(w, activity, timeout, config.PollInterval)
}

{{ if ne $.TargetVersionName `ga` -}}
func ComputeOrgOperationWaitTimeWithResponse(config *transport_tpg.Config, res interface{}, response *map[string]interface{}, parent, activity, userAgent string, timeout time.Duration) error {
op := &compute.Operation{}
err := tpgresource.Convert(res, op)
Expand All @@ -157,8 +150,6 @@ func ComputeOrgOperationWaitTimeWithResponse(config *transport_tpg.Config, res i
return json.Unmarshal(e, response)
}

{{ end }}

// ComputeOperationError wraps compute.OperationError and implements the
// error interface so it can be returned.
type ComputeOperationError compute.OperationError
Expand Down
8 changes: 0 additions & 8 deletions tpgtools/overrides/compute/firewall_policy_rule.yaml

This file was deleted.

0 comments on commit a39b355

Please sign in to comment.