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

firewall_resource: support threat_intel_mode #7437

Merged
merged 2 commits into from Jun 23, 2020
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 13 additions & 0 deletions azurerm/internal/services/network/firewall_resource.go
Expand Up @@ -79,6 +79,17 @@ func resourceArmFirewall() *schema.Resource {
},
},

"threat_intel_mode": {
Type: schema.TypeString,
Optional: true,
Default: string(network.AzureFirewallThreatIntelModeAlert),
ValidateFunc: validation.StringInSlice([]string{
string(network.AzureFirewallThreatIntelModeOff),
string(network.AzureFirewallThreatIntelModeAlert),
string(network.AzureFirewallThreatIntelModeDeny),
}, false),
},

"zones": azure.SchemaMultipleZones(),

"tags": tags.Schema(),
Expand Down Expand Up @@ -135,6 +146,7 @@ func resourceArmFirewallCreateUpdate(d *schema.ResourceData, meta interface{}) e
Tags: tags.Expand(t),
AzureFirewallPropertiesFormat: &network.AzureFirewallPropertiesFormat{
IPConfigurations: ipConfigs,
ThreatIntelMode: network.AzureFirewallThreatIntelMode(d.Get("threat_intel_mode").(string)),
},
Zones: zones,
}
Expand Down Expand Up @@ -212,6 +224,7 @@ func resourceArmFirewallRead(d *schema.ResourceData, meta interface{}) error {
if err := d.Set("ip_configuration", flattenArmFirewallIPConfigurations(props.IPConfigurations)); err != nil {
return fmt.Errorf("Error setting `ip_configuration`: %+v", err)
}
d.Set("threat_intel_mode", string(props.ThreatIntelMode))
}

if err := d.Set("zones", azure.FlattenZones(read.Zones)); err != nil {
Expand Down
Expand Up @@ -326,6 +326,7 @@ resource "azurerm_firewall" "test" {
subnet_id = azurerm_subnet.test.id
public_ip_address_id = azurerm_public_ip.test.id
}
threat_intel_mode = "Deny"
}
`, data.RandomInteger, data.Locations.Primary, data.RandomInteger, data.RandomInteger, data.RandomInteger)
}
Expand Down Expand Up @@ -405,6 +406,7 @@ resource "azurerm_firewall" "import" {
subnet_id = azurerm_subnet.test.id
public_ip_address_id = azurerm_public_ip.test.id
}
threat_intel_mode = azurerm_firewall.test.threat_intel_mode
}
`, template)
}
Expand Down
2 changes: 2 additions & 0 deletions website/docs/r/firewall.html.markdown
Expand Up @@ -66,6 +66,8 @@ The following arguments are supported:

* `ip_configuration` - (Required) A `ip_configuration` block as documented below.

* `threat_intel_mode` - (Optional) The operation mode for threat intelligence-based filtering. Possible values are: `Off`, `Alert` and `Deny`. Defaults to `Alert`

* `zones` - (Optional) Specifies the availability zones in which the Azure Firewall should be created.

-> **Please Note**: Availability Zones are [only supported in several regions at this time](https://docs.microsoft.com/en-us/azure/availability-zones/az-overview).
Expand Down