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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

azurerm_firewall_policy - deprecate dns.network_rule_fqdn_enabled #9332

Merged
merged 3 commits into from
Nov 19, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,6 @@ func dataSourceArmFirewallPolicy() *schema.Resource {
Type: schema.TypeBool,
Computed: true,
},
"network_rule_fqdn_enabled": {
katbyte marked this conversation as resolved.
Show resolved Hide resolved
Type: schema.TypeBool,
Computed: true,
},
},
},
},
Expand Down
23 changes: 9 additions & 14 deletions azurerm/internal/services/network/firewall_policy_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,12 @@ func resourceArmFirewallPolicy() *schema.Resource {
Optional: true,
Default: false,
},
// TODO 3.0 - remove this property
"network_rule_fqdn_enabled": {
Type: schema.TypeBool,
Optional: true,
Default: false,
Type: schema.TypeBool,
Optional: true,
Computed: true,
Deprecated: "This property is deprecated since service no longer support it since Nov.2020",
magodo marked this conversation as resolved.
Show resolved Hide resolved
},
},
},
Expand Down Expand Up @@ -319,9 +321,8 @@ func expandFirewallPolicyDNSSetting(input []interface{}) *network.DNSSettings {

raw := input[0].(map[string]interface{})
output := &network.DNSSettings{
Servers: utils.ExpandStringSlice(raw["servers"].(*schema.Set).List()),
EnableProxy: utils.Bool(raw["proxy_enabled"].(bool)),
RequireProxyForNetworkRules: utils.Bool(raw["network_rule_fqdn_enabled"].(bool)),
Servers: utils.ExpandStringSlice(raw["servers"].(*schema.Set).List()),
EnableProxy: utils.Bool(raw["proxy_enabled"].(bool)),
}

return output
Expand Down Expand Up @@ -350,16 +351,10 @@ func flattenFirewallPolicyDNSSetting(input *network.DNSSettings) []interface{} {
proxyEnabled = *input.EnableProxy
}

networkRulesFqdnEnabled := false
if input.RequireProxyForNetworkRules != nil {
networkRulesFqdnEnabled = *input.RequireProxyForNetworkRules
}

return []interface{}{
map[string]interface{}{
"servers": utils.FlattenStringSlice(input.Servers),
"proxy_enabled": proxyEnabled,
"network_rule_fqdn_enabled": networkRulesFqdnEnabled,
"servers": utils.FlattenStringSlice(input.Servers),
"proxy_enabled": proxyEnabled,
},
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ func TestAccDataSourceFirewallPolicy_basic(t *testing.T) {
resource.TestCheckResourceAttrSet(data.ResourceName, "base_policy_id"),
resource.TestCheckResourceAttr(dataParent.ResourceName, "child_policies.#", "1"),
resource.TestCheckResourceAttr(data.ResourceName, "dns.0.proxy_enabled", "true"),
resource.TestCheckResourceAttr(data.ResourceName, "dns.0.network_rule_fqdn_enabled", "true"),
resource.TestCheckResourceAttr(data.ResourceName, "dns.0.servers.#", "2"),
resource.TestCheckResourceAttr(data.ResourceName, "threat_intelligence_mode", string(network.AzureFirewallThreatIntelModeAlert)),
resource.TestCheckResourceAttr(data.ResourceName, "threat_intelligence_allowlist.0.ip_addresses.#", "2"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,8 @@ resource "azurerm_firewall_policy" "test" {
fqdns = ["foo.com", "bar.com"]
}
dns {
servers = ["1.1.1.1", "2.2.2.2"]
proxy_enabled = true
network_rule_fqdn_enabled = true
servers = ["1.1.1.1", "2.2.2.2"]
proxy_enabled = true
}
tags = {
env = "Test"
Expand Down Expand Up @@ -248,9 +247,8 @@ resource "azurerm_firewall_policy" "test" {
fqdns = ["foo.com", "bar.com"]
}
dns {
servers = ["1.1.1.1", "2.2.2.2"]
proxy_enabled = true
network_rule_fqdn_enabled = true
servers = ["1.1.1.1", "2.2.2.2"]
proxy_enabled = true
}
tags = {
env = "Test"
Expand Down
2 changes: 0 additions & 2 deletions website/docs/r/firewall_policy.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ A `dns` block supports the following:

* `proxy_enabled` - (Optional) Whether to enable DNS proxy on Firewalls attached to this Firewall Policy? Defaults to `false`.

* `network_rule_fqdn_enabled` - (Optional) Whether FQDNS in Network Rules belongs to this Firewall Policy are supported? Defaults to `false`.

---

A `threat_intelligence_allowlist` block supports the following:
Expand Down