diff --git a/README.md b/README.md index a5342cf..5477dfa 100644 --- a/README.md +++ b/README.md @@ -28,17 +28,12 @@ A virtual machine or virtual machine scale set. |------|---------| | [azurerm](#provider\_azurerm) | n/a | | [azurerm.cnp](#provider\_azurerm.cnp) | n/a | -| [azurerm.dcr](#provider\_azurerm.dcr) | n/a | | [azurerm.soc](#provider\_azurerm.soc) | n/a | ## Resources | Name | Type | |------|------| -| [azurerm_monitor_data_collection_rule_association.linux_vm_dcra](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/monitor_data_collection_rule_association) | resource | -| [azurerm_monitor_data_collection_rule_association.linux_vmss_dcra](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/monitor_data_collection_rule_association) | resource | -| [azurerm_monitor_data_collection_rule_association.windows_vm_dcra](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/monitor_data_collection_rule_association) | resource | -| [azurerm_monitor_data_collection_rule_association.windows_vmss_dcra](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/monitor_data_collection_rule_association) | resource | | [azurerm_virtual_machine_extension.azure_monitor](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/virtual_machine_extension) | resource | | [azurerm_virtual_machine_extension.azure_vm_run_command](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/virtual_machine_extension) | resource | | [azurerm_virtual_machine_extension.custom_script](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/virtual_machine_extension) | resource | @@ -56,9 +51,6 @@ A virtual machine or virtual machine scale set. | [azurerm_key_vault_secret.splunk_password](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/key_vault_secret) | data source | | [azurerm_key_vault_secret.splunk_username](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/key_vault_secret) | data source | | [azurerm_key_vault_secret.token](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/key_vault_secret) | data source | -| [azurerm_monitor_data_collection_rule.linux_data_collection_rule](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/monitor_data_collection_rule) | data source | -| [azurerm_monitor_data_collection_rule.windows_data_collection_rule](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/monitor_data_collection_rule) | data source | -| [azurerm_resource_group.la_rg](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/resource_group) | data source | ## Inputs @@ -89,7 +81,6 @@ A virtual machine or virtual machine scale set. | [endpoint\_protection\_upgrade\_minor\_version](#input\_endpoint\_protection\_upgrade\_minor\_version) | Specifies if the platform deploys the latest minor version Endpoint Protection update to the type\_handler\_version specified. | `bool` | `true` | no | | [env](#input\_env) | Environment name. | `string` | n/a | yes | | [install\_azure\_monitor](#input\_install\_azure\_monitor) | Install Azure Monitor Agent. | `bool` | `true` | no | -| [install\_docker](#input\_install\_docker) | Should Docker and Docker Compose be installed -- Ubuntu only | `bool` | `false` | no | | [install\_dynatrace\_oneagent](#input\_install\_dynatrace\_oneagent) | Install Dynatrace OneAgent. | `bool` | `true` | no | | [install\_endpoint\_protection](#input\_install\_endpoint\_protection) | Install Endpoint Protection. | `bool` | `true` | no | | [install\_nessus\_agent](#input\_install\_nessus\_agent) | Install Nessus Agent. | `bool` | `true` | no | diff --git a/azure_monitor.tf b/azure_monitor.tf index 49d4534..162ff7b 100644 --- a/azure_monitor.tf +++ b/azure_monitor.tf @@ -26,56 +26,55 @@ resource "azurerm_virtual_machine_extension" "azure_monitor" { tags = var.common_tags } -data "azurerm_resource_group" "la_rg" { - provider = azurerm.dcr - name = "oms-automation" -} - -data "azurerm_monitor_data_collection_rule" "linux_data_collection_rule" { - provider = azurerm.dcr - name = "ama-linux-vm-logs" - resource_group_name = data.azurerm_resource_group.la_rg.name -} - -data "azurerm_monitor_data_collection_rule" "windows_data_collection_rule" { - provider = azurerm.dcr - name = "ama-windows-vm-logs" - resource_group_name = data.azurerm_resource_group.la_rg.name -} - - -resource "azurerm_monitor_data_collection_rule_association" "linux_vm_dcra" { - count = var.install_azure_monitor == true && lower(var.os_type) == "linux" && var.virtual_machine_type == "vm" ? 1 : 0 - - name = "vm-${local.vm_name}-dcra" - target_resource_id = var.virtual_machine_id - data_collection_rule_id = data.azurerm_monitor_data_collection_rule.linux_data_collection_rule.id - description = "Association between a linux VM and the appropriate data collection rule." -} - -resource "azurerm_monitor_data_collection_rule_association" "linux_vmss_dcra" { - count = var.install_azure_monitor == true && lower(var.os_type) == "linux" && var.virtual_machine_type == "vmss" ? 1 : 0 - - name = "vmss-${local.vmss_name}-dcra" - target_resource_id = var.virtual_machine_scale_set_id - data_collection_rule_id = data.azurerm_monitor_data_collection_rule.linux_data_collection_rule.id - description = "Association between a linux VMSS and the appropriate data collection rule." -} - -resource "azurerm_monitor_data_collection_rule_association" "windows_vm_dcra" { - count = var.install_azure_monitor == true && lower(var.os_type) == "windows" && var.virtual_machine_type == "vm" ? 1 : 0 - - name = "vm-${local.vm_name}-dcra" - target_resource_id = var.virtual_machine_id - data_collection_rule_id = data.azurerm_monitor_data_collection_rule.windows_data_collection_rule.id - description = "Association between a windows VM and the appropriate data collection rule." -} - -resource "azurerm_monitor_data_collection_rule_association" "windows_vmss_dcra" { - count = var.install_azure_monitor == true && lower(var.os_type) == "windows" && var.virtual_machine_type == "vmss" ? 1 : 0 - - name = "vmss-${local.vmss_name}-dcra" - target_resource_id = var.virtual_machine_scale_set_id - data_collection_rule_id = data.azurerm_monitor_data_collection_rule.windows_data_collection_rule.id - description = "Association between a windows VMSS and the appropriate data collection rule." -} +# data "azurerm_resource_group" "la_rg" { +# name = "oms-automation" +# } + +# data "azurerm_monitor_data_collection_rule" "linux_data_collection_rule" { +# provider = azurerm.dcr +# name = "ama-linux-vm-logs" +# resource_group_name = data.azurerm_resource_group.la_rg.name +# } + +# data "azurerm_monitor_data_collection_rule" "windows_data_collection_rule" { +# provider = azurerm.dcr +# name = "ama-windows-vm-logs" +# resource_group_name = data.azurerm_resource_group.la_rg.name +# } + + +# resource "azurerm_monitor_data_collection_rule_association" "linux_vm_dcra" { +# count = var.install_azure_monitor == true && lower(var.os_type) == "linux" && var.virtual_machine_type == "vm" ? 1 : 0 + +# name = "vm-${local.vm_name}-dcra" +# target_resource_id = var.virtual_machine_id +# data_collection_rule_id = data.azurerm_monitor_data_collection_rule.linux_data_collection_rule.id +# description = "Association between a linux VM and the appropriate data collection rule." +# } + +# resource "azurerm_monitor_data_collection_rule_association" "linux_vmss_dcra" { +# count = var.install_azure_monitor == true && lower(var.os_type) == "linux" && var.virtual_machine_type == "vmss" ? 1 : 0 + +# name = "vmss-${local.vmss_name}-dcra" +# target_resource_id = var.virtual_machine_scale_set_id +# data_collection_rule_id = data.azurerm_monitor_data_collection_rule.linux_data_collection_rule.id +# description = "Association between a linux VMSS and the appropriate data collection rule." +# } + +# resource "azurerm_monitor_data_collection_rule_association" "windows_vm_dcra" { +# count = var.install_azure_monitor == true && lower(var.os_type) == "windows" && var.virtual_machine_type == "vm" ? 1 : 0 + +# name = "vm-${local.vm_name}-dcra" +# target_resource_id = var.virtual_machine_id +# data_collection_rule_id = data.azurerm_monitor_data_collection_rule.windows_data_collection_rule.id +# description = "Association between a windows VM and the appropriate data collection rule." +# } + +# resource "azurerm_monitor_data_collection_rule_association" "windows_vmss_dcra" { +# count = var.install_azure_monitor == true && lower(var.os_type) == "windows" && var.virtual_machine_type == "vmss" ? 1 : 0 + +# name = "vmss-${local.vmss_name}-dcra" +# target_resource_id = var.virtual_machine_scale_set_id +# data_collection_rule_id = data.azurerm_monitor_data_collection_rule.windows_data_collection_rule.id +# description = "Association between a windows VMSS and the appropriate data collection rule." +# } diff --git a/providers.tf b/providers.tf index 4bb08bf..ad637bf 100644 --- a/providers.tf +++ b/providers.tf @@ -2,7 +2,7 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - configuration_aliases = [azurerm.cnp, azurerm.soc, azurerm.dcr] + configuration_aliases = [azurerm.cnp, azurerm.soc] } } } diff --git a/run_command.tf b/run_command.tf index 7c4784e..45c926c 100644 --- a/run_command.tf +++ b/run_command.tf @@ -14,7 +14,6 @@ resource "azurerm_virtual_machine_scale_set_extension" "azure_vmss_run_command" RUN_XDR_AGENT = var.run_xdr_agent ? "true" : "false" ENV = var.xdr_env == "prod" ? var.xdr_env : "nonprod" XDR_TAGS = lower(local.xdr_tags_list) - INSTALL_DOCKER = var.install_docker ? "true" : "false" })) }) : jsonencode({ script = compact(tolist([templatefile("${path.module}/scripts/windows_run_script.ps1", { STORAGE_ACCOUNT_KEY = var.run_command_sa_key RUN_CIS = var.rc_script_file == "scripts/windows_cis.ps1" || var.run_cis ? "true" : "false" @@ -45,7 +44,6 @@ resource "azurerm_virtual_machine_extension" "azure_vm_run_command" { RUN_XDR_AGENT = var.run_xdr_agent ? "true" : "false" ENV = var.xdr_env == "prod" ? var.xdr_env : "nonprod" XDR_TAGS = lower(local.xdr_tags_list) - INSTALL_DOCKER = var.install_docker ? "true" : "false" })) }) : jsonencode({ script = compact(tolist([templatefile("${path.module}/scripts/windows_run_script.ps1", { STORAGE_ACCOUNT_KEY = var.run_command_sa_key RUN_CIS = var.rc_script_file == "scripts/windows_cis.ps1" || var.run_cis ? "true" : "false" diff --git a/tests/linux_vm_extensions.tftest.hcl b/tests/linux_vm_extensions.tftest.hcl index f5d1b82..fd0a46c 100644 --- a/tests/linux_vm_extensions.tftest.hcl +++ b/tests/linux_vm_extensions.tftest.hcl @@ -17,13 +17,6 @@ provider "azurerm" { skip_provider_registration = true } -provider "azurerm" { - alias = "dcr" - features {} - subscription_id = var.env=="prod" || var.env=="production" ? "8999dec3-0104-4a27-94ee-6588559729d1" : var.env=="sbox" || var.env=="sandbox" ? "bf308a5c-0624-4334-8ff8-8dca9fd43783" : "1c4f0704-a29e-403d-b719-b90c34ef14c9" - skip_provider_registration = true -} - # Default variables for this test variables { env = "nonprod" diff --git a/tests/linux_vmss_extensions.tftest.hcl b/tests/linux_vmss_extensions.tftest.hcl index 0a0012f..876b78a 100644 --- a/tests/linux_vmss_extensions.tftest.hcl +++ b/tests/linux_vmss_extensions.tftest.hcl @@ -17,13 +17,6 @@ provider "azurerm" { skip_provider_registration = true } -provider "azurerm" { - alias = "dcr" - features {} - subscription_id = var.env=="prod" || var.env=="production" ? "8999dec3-0104-4a27-94ee-6588559729d1" : var.env=="sbox" || var.env=="sandbox" ? "bf308a5c-0624-4334-8ff8-8dca9fd43783" : "1c4f0704-a29e-403d-b719-b90c34ef14c9" - skip_provider_registration = true -} - # Default variables for this test variables { env = "nonprod" diff --git a/tests/windows_vm_extensions.tftest.hcl b/tests/windows_vm_extensions.tftest.hcl index 903eacd..db68e75 100644 --- a/tests/windows_vm_extensions.tftest.hcl +++ b/tests/windows_vm_extensions.tftest.hcl @@ -17,13 +17,6 @@ provider "azurerm" { skip_provider_registration = true } -provider "azurerm" { - alias = "dcr" - features {} - subscription_id = var.env=="prod" || var.env=="production" ? "8999dec3-0104-4a27-94ee-6588559729d1" : var.env=="sbox" || var.env=="sandbox" ? "bf308a5c-0624-4334-8ff8-8dca9fd43783" : "1c4f0704-a29e-403d-b719-b90c34ef14c9" - skip_provider_registration = true -} - # Default variables for this test variables { env = "nonprod" diff --git a/tests/windows_vmss_extensions.tftest.hcl b/tests/windows_vmss_extensions.tftest.hcl index 570fe31..e1cf907 100644 --- a/tests/windows_vmss_extensions.tftest.hcl +++ b/tests/windows_vmss_extensions.tftest.hcl @@ -17,13 +17,6 @@ provider "azurerm" { skip_provider_registration = true } -provider "azurerm" { - alias = "dcr" - features {} - subscription_id = var.env=="prod" || var.env=="production" ? "8999dec3-0104-4a27-94ee-6588559729d1" : var.env=="sbox" || var.env=="sandbox" ? "bf308a5c-0624-4334-8ff8-8dca9fd43783" : "1c4f0704-a29e-403d-b719-b90c34ef14c9" - skip_provider_registration = true -} - # Default variables for this test variables { env = "nonprod" diff --git a/variables.tf b/variables.tf index da0613d..b536c8b 100644 --- a/variables.tf +++ b/variables.tf @@ -341,6 +341,7 @@ variable "run_xdr_collector" { description = "Install XDR collectors using run command script?" } + variable "run_xdr_agent" { type = bool default = false @@ -353,12 +354,6 @@ variable "xdr_env" { default = "prod" } -variable "install_docker" { - description = "Should Docker and Docker Compose be installed -- Ubuntu only" - type = bool - default = false -} - variable "location" { description = "The region in Azure that the Data collection rule will be deployed to." type = string