Skip to content

Commit

Permalink
Merge pull request #7437 from magodo/firewall_threat_intel
Browse files Browse the repository at this point in the history
firewall_resource: support `threat_intel_mode`
  • Loading branch information
tombuildsstuff committed Jun 23, 2020
2 parents e334a15 + 0e138b9 commit 6ca8e56
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
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

0 comments on commit 6ca8e56

Please sign in to comment.