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

Fix firewall rule to support empty descritpion on update #10950

Merged
merged 3 commits into from
Jun 18, 2024
Merged
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
1 change: 1 addition & 0 deletions mmv1/products/compute/Firewall.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ properties:
description: |
An optional description of this resource. Provide this property when
you create the resource.
send_empty_value: true
- !ruby/object:Api::Type::Array
name: 'destinationRanges'
description: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,17 @@ func TestAccComputeFirewall_update(t *testing.T) {
ImportState: true,
ImportStateVerify: true,
},
{
Config: testAccComputeFirewall_nullDescription(networkName, firewallName),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("google_compute_firewall.foobar", "description", ""),
),
},
{
ResourceName: "google_compute_firewall.foobar",
ImportState: true,
ImportStateVerify: true,
},
{
Config: testAccComputeFirewall_basic(networkName, firewallName),
},
Expand Down Expand Up @@ -392,6 +403,29 @@ resource "google_compute_firewall" "foobar" {
`, network, firewall)
}

func testAccComputeFirewall_nullDescription(network, firewall string) string {
return fmt.Sprintf(`
resource "google_compute_network" "foobar" {
name = "%s"
auto_create_subnetworks = false
}

resource "google_compute_firewall" "foobar" {
name = "%s"
description = null
network = google_compute_network.foobar.self_link
source_tags = ["foo"]
target_tags = ["bar"]

allow {
protocol = "tcp"
ports = ["80-255"]
}
}
`, network, firewall)
}


func testAccComputeFirewall_priority(network, firewall string, priority int) string {
return fmt.Sprintf(`
resource "google_compute_network" "foobar" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
]
}
],
"description": "",
"disabled": false,
"logConfig": {
"enable": false
Expand Down
1 change: 1 addition & 0 deletions mmv1/third_party/tgc/tests/data/firewall.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
]
}
],
"description": "",
"disabled": false,
"logConfig": {
"enable": false
Expand Down
2 changes: 2 additions & 0 deletions mmv1/third_party/tgc/tests/data/full_compute_firewall.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
]
}
],
"description": "",
"disabled": false,
"logConfig": {
"enable": false
Expand Down Expand Up @@ -102,6 +103,7 @@
"IPProtocol": "icmp"
}
],
"description": "",
"disabled": false,
"logConfig": {
"enable": false
Expand Down
Loading