Skip to content

Commit f232bff

Browse files
authored
Merge pull request #8 from kumarvna/develop
adding terraform v0.15 support
2 parents cc42da6 + 333964a commit f232bff

File tree

8 files changed

+85
-12
lines changed

8 files changed

+85
-12
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*.tfstate
66
*.tfstate.*
77
*.vscode/*
8+
*.terraform.lock.hcl
89

910
# Crash log files
1011
crash.log

README.md

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,18 @@ Security Center collects data from the Azure virtual machines (VMs), virtual mac
99
```hcl
1010
module "security-center" {
1111
source = "kumarvna/security-center/azurerm"
12-
version = "1.0.0"
12+
version = "1.1.0"
1313
1414
# Resource Group, location, log analytics details
1515
resource_group_name = "rg-shared-westeurope-01"
16-
log_analytics_workspace_name = "loganalytics-we-sharedtest"
16+
log_analytics_workspace_name = "loganalytics-we-sharedtest2"
17+
18+
# Enable Security Center API Setting
19+
enable_security_center_setting = true
20+
security_center_setting_name = "MCAS"
21+
22+
# Enable auto provision of log analytics agents on VM's if they doesn't exist.
23+
enable_security_center_auto_provisioning = on
1724
1825
# Subscription Security Center contacts
1926
# One or more email addresses seperated by commas not supported by Azure proivider currently
@@ -26,18 +33,30 @@ module "security-center" {
2633
}
2734
```
2835

36+
## Security Center API Settings
37+
38+
This module support enable/disable Microsoft Cloud App Security data access (MCAS) and Windows Defender ATP data access (WDATP). Use `enable_security_center_setting` and `security_center_setting_name` to use this feature.
39+
40+
## Agents Auto Provisioning
41+
42+
Security Center collects data from your Azure virtual machines (VMs), virtual machine scale sets, IaaS containers, and non-Azure (including on-premises) machines to monitor for security vulnerabilities and threats.
43+
44+
Data collection is required to provide visibility into missing updates, misconfigured OS security settings, endpoint protection status, and health and threat protection. Data collection is only needed for compute resources such as VMs, virtual machine scale sets, IaaS containers, and non-Azure computers.
45+
46+
Auto provisioning reduces management overhead by installing all required agents and extensions on existing - and new - machines to ensure faster security coverage for all supported resources. To enable this feature with this module declare the `enable_security_center_auto_provisioning = "On"` variable.
47+
2948
## Requirements
3049

3150
Name | Version
3251
-----|--------
3352
terraform | >= 0.13
34-
azurerm | ~> 2.27
53+
azurerm | >= 2.59.0
3554

3655
## Providers
3756

3857
| Name | Version |
3958
|------|---------|
40-
azurerm | 2.27.0
59+
azurerm | >= 2.59.0
4160

4261
## Inputs
4362

@@ -47,6 +66,11 @@ Name | Description | Type | Default
4766
`log_analytics_workspace_name`|The name of log analytics workspace name|string|`""`
4867
`security_center_contacts`|Manages the subscription's Security Center Contact|object|{}
4968
`scope_resource_id`|The scope of VMs to send their security data to the desired workspace, unless overridden by a setting with more specific scope|string|`current Subscripion id`
69+
`security_center_subscription_pricing`| The pricing tier to use. Possible values are `Free` and `Standard`|string|`Standard`
70+
`resource_type`|The resource type this setting affects. Possible values are `AppServices`, `ContainerRegistry`, `KeyVaults`, `KubernetesService`, `SqlServers`, `SqlServerVirtualMachines`, `StorageAccounts`, `VirtualMachines`, `Arm` and `Dns`|string|`VirtualMachines`
71+
`enable_security_center_setting`|Boolean flag to enable/disable data access|string|`false`
72+
`security_center_setting_name`|The setting to manage. Possible values are `MCAS` and `WDAT`|string|`MCAS`
73+
`enable_security_center_auto_provisioning`|Should the security agent be automatically provisioned on Virtual Machines in this subscription? Possible values are `On` (to install the security agent automatically, if it's missing) or `Off` (to not install the security agent automatically).|string|`"Off"`
5074

5175
## Outputs
5276

@@ -67,4 +91,4 @@ Originally created by [Kumaraswamy Vithanala](mailto:kumarvna@gmail.com)
6791
## Other resources
6892

6993
* [Azure Security Center](https://docs.microsoft.com/en-us/azure/security-center/security-center-introduction)
70-
* [Terraform AzureRM Provider Documentation](https://www.terraform.io/docs/providers/azurerm/index.html)
94+
* [Terraform AzureRM Provider Documentation](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs)

examples/complete/README.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,20 @@ Terraform module to create Azure Security Center resources for Azure Landing Zon
66

77
```hcl
88
module "security-center" {
9-
source = "kumarvna/security-center/azurerm"
10-
version = "1.0.0"
9+
source = "kumarvna/security-center/azurerm"
10+
version = "1.1.0"
11+
1112
1213
# Resource Group, location, log analytics details
1314
resource_group_name = "rg-shared-westeurope-01"
14-
log_analytics_workspace_name = "loganalytics-we-sharedtest"
15+
log_analytics_workspace_name = "loganalytics-we-sharedtest2"
16+
17+
# Enable Security Center API Setting
18+
enable_security_center_setting = true
19+
security_center_setting_name = "MCAS"
20+
21+
# Enable auto provision of log analytics agents on VM's if they doesn't exist.
22+
enable_security_center_auto_provisioning = on
1523
1624
# Subscription Security Center contacts
1725
# One or more email addresses seperated by commas not supported by Azure proivider currently

examples/complete/main.tf

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
11
module "security-center" {
22
source = "kumarvna/security-center/azurerm"
3-
version = "1.0.0"
3+
version = "1.1.0"
4+
45

56
# Resource Group, location, log analytics details
67
resource_group_name = "rg-shared-westeurope-01"
7-
log_analytics_workspace_name = "loganalytics-we-sharedtest"
8+
log_analytics_workspace_name = "loganalytics-we-sharedtest2"
9+
10+
# Enable Security Center API Setting
11+
enable_security_center_setting = true
12+
security_center_setting_name = "MCAS"
13+
14+
# Enable auto provision of log analytics agents on VM's if they doesn't exist.
15+
enable_security_center_auto_provisioning = on
816

917
# Subscription Security Center contacts
1018
# One or more email addresses seperated by commas not supported by Azure proivider currently

graph.png

37.9 KB
Loading

main.tf

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ resource "azurerm_security_center_workspace" "main" {
3030
#----------------------------------------------------------
3131

3232
resource "azurerm_security_center_subscription_pricing" "main" {
33-
tier = var.security_center_subscription_pricing
33+
tier = var.security_center_subscription_pricing
34+
resource_type = var.resource_type
3435
}
3536

3637
#----------------------------------------------------------
@@ -42,3 +43,14 @@ resource "azurerm_security_center_contact" "main" {
4243
alert_notifications = lookup(var.security_center_contacts, "alert_notifications", true)
4344
alerts_to_admins = lookup(var.security_center_contacts, "alerts_to_admins", true)
4445
}
46+
47+
resource "azurerm_security_center_setting" "main" {
48+
count = var.enable_security_center_setting ? 1 : 0
49+
setting_name = var.security_center_setting_name
50+
enabled = var.enable_security_center_setting
51+
}
52+
53+
resource "azurerm_security_center_auto_provisioning" "main" {
54+
count = var.enable_security_center_auto_provisioning == "On" ? 1 : 0
55+
auto_provision = var.enable_security_center_auto_provisioning
56+
}

variables.tf

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ variable "security_center_subscription_pricing" {
1313
default = "Standard"
1414
}
1515

16+
variable "resource_type" {
17+
description = "The resource type this setting affects"
18+
default = "VirtualMachines"
19+
}
20+
1621
variable "security_center_contacts" {
1722
type = map(string)
1823
description = "Manages the subscription's Security Center Contact"
@@ -23,3 +28,18 @@ variable "scope_resource_id" {
2328
description = "The scope of VMs to send their security data to the desired workspace, unless overridden by a setting with more specific scope"
2429
default = null
2530
}
31+
32+
variable "security_center_setting_name" {
33+
description = "The setting to manage. Possible values are `MCAS` and `WDAT`"
34+
default = "MCAS"
35+
}
36+
37+
variable "enable_security_center_setting" {
38+
description = "Boolean flag to enable/disable data access"
39+
default = false
40+
}
41+
42+
variable "enable_security_center_auto_provisioning" {
43+
description = "Should the security agent be automatically provisioned on Virtual Machines in this subscription?"
44+
default = "Off"
45+
}

versions.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ terraform {
22
required_providers {
33
azurerm = {
44
source = "hashicorp/azurerm"
5-
version = "~>2.27.0"
5+
version = ">= 2.59.0"
66
}
77
}
88
required_version = ">= 0.13"

0 commit comments

Comments
 (0)