Manages the Vulnerability Assessment for a Synapse SQL Pool.
resource "azurerm_resource_group" "example" {
name = "example-resources"
location = "West Europe"
}
resource "azurerm_storage_account" "example" {
name = "examplestorageacc"
resource_group_name = azurerm_resource_group.example.name
location = azurerm_resource_group.example.location
account_tier = "Standard"
account_replication_type = "LRS"
account_kind = "StorageV2"
is_hns_enabled = "true"
}
resource "azurerm_storage_container" "example" {
name = "example"
storage_account_name = azurerm_storage_account.example.name
}
resource "azurerm_storage_data_lake_gen2_filesystem" "example" {
name = "example"
storage_account_id = azurerm_storage_account.example.id
}
resource "azurerm_synapse_workspace" "example" {
name = "example"
resource_group_name = azurerm_resource_group.example.name
location = azurerm_resource_group.example.location
storage_data_lake_gen2_filesystem_id = azurerm_storage_data_lake_gen2_filesystem.example.id
sql_administrator_login = "sqladminuser"
sql_administrator_login_password = "H@Sh1CoR3!"
aad_admin {
login = "AzureAD Admin"
object_id = "00000000-0000-0000-0000-000000000000"
tenant_id = "00000000-0000-0000-0000-000000000000"
}
identity {
type = "SystemAssigned"
}
tags = {
Env = "production"
}
}
resource "azurerm_synapse_sql_pool" "example" {
name = "examplesqlpool"
synapse_workspace_id = azurerm_synapse_workspace.example.id
sku_name = "DW100c"
create_mode = "Default"
}
resource "azurerm_storage_account" "audit_logs" {
name = "examplesa"
resource_group_name = azurerm_resource_group.example.name
location = azurerm_resource_group.example.location
account_tier = "Standard"
account_replication_type = "LRS"
}
resource "azurerm_synapse_sql_pool_security_alert_policy" "example" {
sql_pool_id = azurerm_synapse_sql_pool.example.id
policy_state = "Enabled"
storage_endpoint = azurerm_storage_account.audit_logs.primary_blob_endpoint
storage_account_access_key = azurerm_storage_account.audit_logs.primary_access_key
disabled_alerts = [
"Sql_Injection",
"Data_Exfiltration"
]
retention_days = 20
}
resource "azurerm_synapse_sql_pool_vulnerability_assessment" "example" {
sql_pool_security_alert_policy_id = azurerm_synapse_sql_pool_security_alert_policy.example.id
storage_container_path = "${azurerm_storage_account.example.primary_blob_endpoint}${azurerm_storage_container.example.name}/"
storage_account_access_key = azurerm_storage_account.example.primary_access_key
recurring_scans {
enabled = true
email_subscription_admins_enabled = true
emails = [
"email@example1.com",
"email@example2.com"
]
}
}
The following arguments are supported:
sql_pool_security_alert_policy_id
- (Required) The ID of the security alert policy of the Synapse SQL Pool. Changing this forces a new resource to be created.
storage_container_path
- (Required) A blob storage container path to hold the scan results (e.g. https://example.blob.core.windows.net/VaScans/).
storage_account_access_key
- (Optional) Specifies the identifier key of the storage account for vulnerability assessment scan results. If storage_container_sas_key
isn't specified, storage_account_access_key
is required.
storage_container_sas_key
- (Optional) A shared access signature (SAS Key) that has write access to the blob container specified in storage_container_path
parameter. If storage_account_access_key
isn't specified, storage_container_sas_key
is required.
recurring_scans
- (Optional) The recurring scans settings. The recurring_scans
block supports fields documented below.
The recurring_scans
block supports the following:
enabled
- (Optional) Boolean flag which specifies if recurring scans is enabled or disabled. Defaults to false
.email_subscription_admins_enabled
- (Optional) Boolean flag which specifies if the schedule scan notification will be sent to the subscription administrators. Defaults to false
.emails
- (Optional) Specifies an array of email addresses to which the scan notification is sent.In addition to the Arguments listed above - the following Attributes are exported:
id
- The ID of the Synapse SQL Pool Vulnerability Assessment.The timeouts
block allows you to specify timeouts for certain actions:
create
- (Defaults to 30 minutes) Used when creating the Synapse SQL Pool Vulnerability Assessment.update
- (Defaults to 30 minutes) Used when updating the Synapse SQL Pool Vulnerability Assessment.read
- (Defaults to 5 minutes) Used when retrieving the Synapse SQL Pool Vulnerability Assessment.delete
- (Defaults to 30 minutes) Used when deleting the Synapse SQL Pool Vulnerability Assessment.Synapse SQL Pool Vulnerability Assessment can be imported using the resource id
, e.g.
terraform import azurerm_synapse_sql_pool_vulnerability_assessment.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Synapse/workspaces/workspace1/sqlPools/sqlPool1/vulnerabilityAssessments/default