azurerm_resource_policy_remediation

Manages an Azure Resource Policy Remediation.

Example Usage

resource "azurerm_resource_group" "example" {
  name     = "resourcegroup1"
  location = "West US"
}

resource "azurerm_virtual_network" "example" {
  name                = "vnet1"
  resource_group_name = azurerm_resource_group.example.name
  location            = azurerm_resource_group.example.location
  address_space       = ["10.0.0.0/16"]
}

resource "azurerm_policy_definition" "example" {
  name         = "only-deploy-in-westeurope"
  policy_type  = "Custom"
  mode         = "All"
  display_name = "my-policy-definition"
}

resource "azurerm_resource_policy_assignment" "example" {
  name                 = "assignment1"
  resource_id          = azurerm_virtual_network.example.id
  policy_definition_id = azurerm_policy_definition.example.id
  parameters = jsonencode({
    "listOfAllowedLocations" = {
      "value" = [azurerm_resource_group.example.location, "East US"]
    }
  })
}

resource "azurerm_resource_group_policy_assignment" "example" {
  name                 = "example"
  resource_group_id    = azurerm_resource_group.example.id
  policy_definition_id = azurerm_policy_definition.example.id
}

resource "azurerm_resource_policy_remediation" "example" {
  name                 = "remediation1"
  resource_id          = azurerm_virtual_network.example.id
  policy_assignment_id = azurerm_resource_group_policy_assignment.example.id
}

Argument Reference

The following arguments are supported:

Attributes Reference

In addition to the Arguments listed above - the following Attributes are exported:

Timeouts

The timeouts block allows you to specify timeouts for certain actions:

Import

Policy Remediations can be imported using the resource id, e.g.

terraform import azurerm_resource_policy_remediation.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Compute/virtualMachines/vm1/providers/Microsoft.PolicyInsights/remediations/remediation1