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

azurerm_firewall: supports dns_setting #8878

Merged

Conversation

magodo
Copy link
Collaborator

@magodo magodo commented Oct 14, 2020

azurerm_firewall supports dns_setting and azurerm_firewall_network_rule_collection supports destination_fqdns.

Test Result

💢 make testacc TEST=./azurerm/internal/services/network/tests TESTARGS='-run "TestAccAzureRMFirewallNetworkRuleCollection_fqdns|TestAccAzureRMFirewallNetworkRuleCollection_noDestination|TestAccAzureRMFirewall_enableDNS"'

==> Checking that code complies with gofmt requirements...
==> Checking that Custom Timeouts are used...
==> Checking that acceptance test packages are used...
TF_ACC=1 go test ./azurerm/internal/services/network/tests -v -run "TestAccAzureRMFirewallNetworkRuleCollection_fqdns|TestAccAzureRMFirewallNetworkRuleCollection_noDestination|TestAccAzureRMFirewall_enableDNS" -timeout 180m -ldflags="-X=github.com/terraform-providers/terraform-provider-azurerm/version.ProviderVersion=acc"
=== RUN   TestAccAzureRMFirewallNetworkRuleCollection_fqdns
=== PAUSE TestAccAzureRMFirewallNetworkRuleCollection_fqdns
=== RUN   TestAccAzureRMFirewallNetworkRuleCollection_noDestination
=== PAUSE TestAccAzureRMFirewallNetworkRuleCollection_noDestination
=== RUN   TestAccAzureRMFirewall_enableDNS
=== PAUSE TestAccAzureRMFirewall_enableDNS
=== CONT  TestAccAzureRMFirewallNetworkRuleCollection_fqdns
=== CONT  TestAccAzureRMFirewall_enableDNS
=== CONT  TestAccAzureRMFirewallNetworkRuleCollection_noDestination
--- PASS: TestAccAzureRMFirewallNetworkRuleCollection_fqdns (2213.69s)
--- PASS: TestAccAzureRMFirewall_enableDNS (2222.99s)
--- PASS: TestAccAzureRMFirewallNetworkRuleCollection_noDestination (2234.54s)
PASS
ok      github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/network/tests       2234.580s

Fixes #8312, fixes #7743.

`azurerm_firewall` supports `dns_setting` and
`azurerm_firewall_network_rule_collection` supports `destination_fqdns`.
Copy link
Contributor

@tombuildsstuff tombuildsstuff left a comment

Choose a reason for hiding this comment

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

hey @magodo

Thanks for this PR - I've taken a look through and left a few comments inline but if we can fix those up then this is otherwise looking good 👍

Thanks!


return map[string]*string{
"Network.DNS.EnableProxy": utils.String(fmt.Sprintf("%t", v["enabled"].(bool))),
"Network.DNS.Servers": utils.String(strings.Join(servers, ",")),
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we file a Swagger bug about these? Since this is a dictionary there's no guarantees there won't be breaking changes here

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Copy link
Collaborator

Choose a reason for hiding this comment

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

could we link to this in the code?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, I have added them in my last commit.

}

return map[string]*string{
"Network.DNS.EnableProxy": utils.String(fmt.Sprintf("%t", v["enabled"].(bool))),
Copy link
Contributor

Choose a reason for hiding this comment

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

presumably this is a String to handle the Tri-state (True, False, Unset) here - is this defaulted/planned to be defaulted going forward? In general we're removing "enabled" fields and using the presence/omission of the block to infer that - but that won't work for tri-state fields, can we reach out to the service team and confirm the intention here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I will reply here later once I got the update from service team.

Copy link
Collaborator

Choose a reason for hiding this comment

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

any update @magodo ?

Copy link
Collaborator Author

@magodo magodo Oct 29, 2020

Choose a reason for hiding this comment

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

Just got the update that the absense of Network.DNS.EnableProxy is identical to setting it to false, which means there is no "Unset" state. So I guess we can use the precense of the dns_servers as an indicator whether to enable the proxy or not?

Copy link
Contributor

@hazzik hazzik Nov 20, 2020

Choose a reason for hiding this comment

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

@magodo no, it is not. Firewall supports DNS Proxy to "nowhere" aka Azure default DNS. Also DNS proxy could be disabled even if the proxy servers are set. These options are really independent of each other. The first implementation was more correct than the one which was committed.

@magodo
Copy link
Collaborator Author

magodo commented Oct 29, 2020

@katbyte I have updated the dns_settings to be simply a dns_servers list. Please take another look. Thanks!

@manicminer
Copy link
Contributor

Test results:

Screenshot 2020-11-05 at 06 59 28

@manicminer manicminer merged commit d435272 into hashicorp:master Nov 5, 2020
manicminer added a commit that referenced this pull request Nov 5, 2020
@jackofallops jackofallops added this to the v2.35.0 milestone Nov 5, 2020
@ghost
Copy link

ghost commented Nov 5, 2020

This has been released in version 2.35.0 of the provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. As an example:

provider "azurerm" {
    version = "~> 2.35.0"
}
# ... other configuration ...

@ghost
Copy link

ghost commented Dec 5, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks!

@ghost ghost locked as resolved and limited conversation to collaborators Dec 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Azure Firewall Network Rule collection Compatibility FQDN for azurerm_firewall_network_rule_collection
6 participants