azurermSecurityCenterServerVulnerabilityAssessmentVirtualMachine
Manages an Azure Server Vulnerability Assessment (Qualys) to a VM.
-> NOTE Azure Defender has to be enabled on the subscription in order for this resource to work. See this documentation to get started.
Example Usage
/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as azurerm from "./.gen/providers/azurerm";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: azurerm.
For a more precise conversion please use the --provider flag in convert.*/
const azurermResourceGroupExample = new azurerm.resourceGroup.ResourceGroup(
this,
"example",
{
location: "West Europe",
name: "example-resources",
}
);
const azurermVirtualNetworkExample = new azurerm.virtualNetwork.VirtualNetwork(
this,
"example_1",
{
address_space: ["192.168.1.0/24"],
location: azurermResourceGroupExample.location,
name: "example-vnet",
resource_group_name: azurermResourceGroupExample.name,
}
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermVirtualNetworkExample.overrideLogicalId("example");
const azurermSubnetExample = new azurerm.subnet.Subnet(this, "example_2", {
address_prefixes: ["192.168.1.0/24"],
name: "example-subnet",
resource_group_name: azurermResourceGroupExample.name,
virtual_network_name: azurermVirtualNetworkExample.name,
});
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermSubnetExample.overrideLogicalId("example");
const azurermNetworkInterfaceExample =
new azurerm.networkInterface.NetworkInterface(this, "example_3", {
ip_configuration: [
{
name: "vm-example",
private_ip_address_allocation: "Dynamic",
subnet_id: azurermSubnetExample.id,
},
],
location: azurermResourceGroupExample.location,
name: "example-nic",
resource_group_name: azurermResourceGroupExample.name,
});
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermNetworkInterfaceExample.overrideLogicalId("example");
const azurermLinuxVirtualMachineExample =
new azurerm.linuxVirtualMachine.LinuxVirtualMachine(this, "example_4", {
admin_password: "Password1234!",
admin_username: "testadmin",
disable_password_authentication: false,
location: azurermResourceGroupExample.location,
name: "example-vm",
network_interface_ids: [azurermNetworkInterfaceExample.id],
os_disk: [
{
caching: "ReadWrite",
storage_account_type: "Standard_LRS",
},
],
resource_group_name: azurermResourceGroupExample.name,
size: "Standard_B1s",
source_image_reference: [
{
offer: "CentOS",
publisher: "OpenLogic",
sku: "7.5",
version: "latest",
},
],
});
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermLinuxVirtualMachineExample.overrideLogicalId("example");
const azurermSecurityCenterServerVulnerabilityAssessmentVirtualMachineExample =
new azurerm.securityCenterServerVulnerabilityAssessmentVirtualMachine.SecurityCenterServerVulnerabilityAssessmentVirtualMachine(
this,
"example_5",
{
virtual_machine_id: azurermLinuxVirtualMachineExample.id,
}
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermSecurityCenterServerVulnerabilityAssessmentVirtualMachineExample.overrideLogicalId(
"example"
);
Argument Reference
The following arguments are supported:
virtualMachineId
- (Required) The ID of the virtual machine to be monitored by vulnerability assessment. Changing this forces a new resource to be created.
Attributes Reference
In addition to all arguments above, the following attributes are exported:
id
- The ID of the Vulnerability Assessment resource.
Timeouts
The timeouts
block allows you to specify timeouts for certain actions:
create
- (Defaults to 5 minutes) Used when creating the Advanced Threat Protection.read
- (Defaults to 5 minutes) Used when retrieving the Advanced Threat Protection.delete
- (Defaults to 10 minutes) Used when deleting the Advanced Threat Protection.
Import
Server Vulnerability Assessments can be imported using the resourceId
, e.g.
terraform import azurerm_security_center_server_vulnerability_assessment_virtual_machine.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resource-group-name/providers/Microsoft.Compute/virtualMachines/vm-name/providers/Microsoft.Security/serverVulnerabilityAssessments/Default