Open BasLangenberg opened 2 years ago
Just for other people having the same problem an stumbling on this issue, we fixed it by using the AzApi module.
resource "azapi_resource" "continuous_export" {
type = "Microsoft.Security/automations@2019-01-01-preview"
name = "ExportToWorkspace"
parent_id = data.azurerm_resource_group.security_center_automation_resource_group.id
location = data.azurerm_resource_group.security_center_automation_resource_group.location
body = jsonencode({
properties = {
description = "",
isEnabled = true,
scopes = [
{
description = "Security Export for the subscription",
scopePath = data.azurerm_resource_group.security_center_automation_resource_group.id
}
],
sources = [
{
eventSource = "Assessments",
ruleSets = [
{
rules = [
{
propertyJPath = "type",
propertyType = "String",
expectedValue = "Microsoft.Security/assessments",
operator = "Contains"
}
]
}
]
},
{
eventSource = "AssessmentsSnapshot",
ruleSets = [
{
rules = [
{
propertyJPath = "type",
propertyType = "String",
expectedValue = "Microsoft.Security/assessments",
operator = "Contains"
}
]
}
]
},
{
eventSource = "SubAssessments"
},
{
eventSource = "SubAssessmentsSnapshot"
},
{
eventSource = "Alerts",
ruleSets = [
{
rules = [
{
propertyJPath = "Severity",
propertyType = "String",
expectedValue = "low",
operator = "Equals"
}
]
},
{
rules = [
{
propertyJPath = "Severity",
propertyType = "String",
expectedValue = "medium",
operator = "Equals"
}
]
},
{
rules = [
{
propertyJPath = "Severity",
propertyType = "String",
expectedValue = "high",
operator = "Equals"
}
]
},
{
rules = [
{
propertyJPath = "Severity",
propertyType = "String",
expectedValue = "informational",
operator = "Equals"
}
]
}
]
},
{
eventSource = "SecureScores"
},
{
eventSource = "SecureScoresSnapshot"
},
{
eventSource = "SecureScoreControls"
},
{
eventSource = "SecureScoreControlsSnapshot"
},
{
eventSource = "RegulatoryComplianceAssessment"
},
{
eventSource = "RegulatoryComplianceAssessmentSnapshot"
}
],
actions = [
{
workspaceResourceId = data.azurerm_log_analytics_workspace.workspace.id
actionType = "Workspace"
}
]
}
})
}
Is there an existing issue for this?
Community Note
Description
We'd like to have support to add continuous exports from Defender for Cloud for the AssessmentSnapshot and SubAssessmentSnapshot type. I tried to implement this myself, but I was blocked by the azure-sdk-for-go module.
I've checked the upstream branch and could not find the references for these 2 types implemented there. I assume we need to get them to do the actual work, but I'm logging this issue with this repository anyway because I want to make sure I understand the issue correctly, and people here might have better ways to get this resolved in the azure sdk repo by regenerating the service files there using autorest. (Which I have never done)
New or Affected Resource(s)/Data Source(s)
azurerm_security_center_automation
Potential Terraform Configuration
References
I noticed this PR containing the references was not merged. https://github.com/Azure/azure-sdk-for-go/pull/17559/files#diff-6a6b4f45d5baa543d107ab6d37aa122b30c56dd06f97c1b35ec94340ddc98b07L4989