Skip to content

Commit

Permalink
Chashea v0.2.1 (#49)
Browse files Browse the repository at this point in the history
* adding new example and log analytics solution submodule

* adding new examples

* changed version
  • Loading branch information
cshea-msft authored Jun 11, 2024
1 parent 414e891 commit e051221
Show file tree
Hide file tree
Showing 15 changed files with 611 additions and 1 deletion.
151 changes: 151 additions & 0 deletions examples/deploy_security_insights/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
<!-- BEGIN_TF_DOCS -->
# Deploy Security Insights with Log Analytics Solution

This examples deploys Security Insights with Log Analytics Solution.

- Log Analytics Workspace
- Log Analytics Solution
- Security Insights

```hcl
terraform {
required_version = ">= 1.3.0"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = ">= 3.7.0, < 4.0.0"
}
random = {
source = "hashicorp/random"
version = ">= 3.5.0, < 4.0.0"
}
}
}
provider "azurerm" {
features {}
}
# This ensures we have unique CAF compliant names for our resources.
module "naming" {
source = "Azure/naming/azurerm"
version = "0.3.0"
}
# This picks a random region from the list of regions.
resource "random_integer" "region_index" {
max = length(local.azure_regions) - 1
min = 0
}
# This is required for resource modules
resource "azurerm_resource_group" "rg" {
location = local.azure_regions[random_integer.region_index.result]
name = module.naming.resource_group.name_unique
}
# This is the module call
module "log_analytics_workspace" {
source = "../../"
# source = "Azure/avm-res-operationalinsights-workspace/azurerm"
enable_telemetry = var.enable_telemetry
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
name = "thislaworkspace"
log_analytics_workspace_retention_in_days = 30
log_analytics_workspace_sku = "PerGB2018"
log_analytics_workspace_identity = {
type = "SystemAssigned"
}
}
module "log_analytics_solution" {
source = "../../modules/log_analytics_solution"
log_analytics_solution_solution_name = "SecurityInsights"
log_analytics_solution_workspace_name = module.log_analytics_workspace.resource.name
log_analytics_solution_workspace_resource_id = module.log_analytics_workspace.resource_id
log_analytics_solution_resource_group_name = azurerm_resource_group.rg.name
log_analytics_solution_location = azurerm_resource_group.rg.location
log_analytics_solution_plan = {
publisher = "Microsoft"
product = "OMSGallery/SecurityInsights"
}
}
```

<!-- markdownlint-disable MD033 -->
## Requirements

The following requirements are needed by this module:

- <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) (>= 1.3.0)

- <a name="requirement_azurerm"></a> [azurerm](#requirement\_azurerm) (>= 3.7.0, < 4.0.0)

- <a name="requirement_random"></a> [random](#requirement\_random) (>= 3.5.0, < 4.0.0)

## Providers

The following providers are used by this module:

- <a name="provider_azurerm"></a> [azurerm](#provider\_azurerm) (>= 3.7.0, < 4.0.0)

- <a name="provider_random"></a> [random](#provider\_random) (>= 3.5.0, < 4.0.0)

## Resources

The following resources are used by this module:

- [azurerm_resource_group.rg](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/resource_group) (resource)
- [random_integer.region_index](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/integer) (resource)

<!-- markdownlint-disable MD013 -->
## Required Inputs

No required inputs.

## Optional Inputs

The following input variables are optional (have default values):

### <a name="input_enable_telemetry"></a> [enable\_telemetry](#input\_enable\_telemetry)

Description: This variable controls whether or not telemetry is enabled for the module.
For more information see https://aka.ms/avm/telemetryinfo.
If it is set to false, then no telemetry will be collected.

Type: `bool`

Default: `true`

## Outputs

No outputs.

## Modules

The following Modules are called:

### <a name="module_log_analytics_solution"></a> [log\_analytics\_solution](#module\_log\_analytics\_solution)

Source: ../../modules/log_analytics_solution

Version:

### <a name="module_log_analytics_workspace"></a> [log\_analytics\_workspace](#module\_log\_analytics\_workspace)

Source: ../../

Version:

### <a name="module_naming"></a> [naming](#module\_naming)

Source: Azure/naming/azurerm

Version: 0.3.0

<!-- markdownlint-disable-next-line MD041 -->
## Data Collection

The software may collect information about you and your use of the software and send it to Microsoft. Microsoft may use this information to provide services and improve our products and services. You may turn off the telemetry as described in the repository. There are also some features in the software that may enable you and Microsoft to collect data from users of your applications. If you use these features, you must comply with applicable law, including providing appropriate notices to users of your applications together with a copy of Microsoft’s privacy statement. Our privacy statement is located at <https://go.microsoft.com/fwlink/?LinkID=824704>. You can learn more about data collection and use in the help documentation and our privacy statement. Your use of the software operates as your consent to these practices.
<!-- END_TF_DOCS -->
4 changes: 4 additions & 0 deletions examples/deploy_security_insights/_footer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<!-- markdownlint-disable-next-line MD041 -->
## Data Collection

The software may collect information about you and your use of the software and send it to Microsoft. Microsoft may use this information to provide services and improve our products and services. You may turn off the telemetry as described in the repository. There are also some features in the software that may enable you and Microsoft to collect data from users of your applications. If you use these features, you must comply with applicable law, including providing appropriate notices to users of your applications together with a copy of Microsoft’s privacy statement. Our privacy statement is located at <https://go.microsoft.com/fwlink/?LinkID=824704>. You can learn more about data collection and use in the help documentation and our privacy statement. Your use of the software operates as your consent to these practices.
7 changes: 7 additions & 0 deletions examples/deploy_security_insights/_header.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Deploy Security Insights with Log Analytics Solution

This examples deploys Security Insights with Log Analytics Solution.

- Log Analytics Workspace
- Log Analytics Solution
- Security Insights
15 changes: 15 additions & 0 deletions examples/deploy_security_insights/locals.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
locals {
azure_regions = [
"westeurope",
"northeurope",
"eastus",
"eastus2",
"westus",
"westus2",
"southcentralus",
"northcentralus",
"centralus",
"eastasia",
"southeastasia",
]
}
63 changes: 63 additions & 0 deletions examples/deploy_security_insights/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
terraform {
required_version = ">= 1.3.0"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = ">= 3.7.0, < 4.0.0"
}
random = {
source = "hashicorp/random"
version = ">= 3.5.0, < 4.0.0"
}
}
}

provider "azurerm" {
features {}
}

# This ensures we have unique CAF compliant names for our resources.
module "naming" {
source = "Azure/naming/azurerm"
version = "0.3.0"
}

# This picks a random region from the list of regions.
resource "random_integer" "region_index" {
max = length(local.azure_regions) - 1
min = 0
}

# This is required for resource modules
resource "azurerm_resource_group" "rg" {
location = local.azure_regions[random_integer.region_index.result]
name = module.naming.resource_group.name_unique
}

# This is the module call
module "log_analytics_workspace" {
source = "../../"
# source = "Azure/avm-res-operationalinsights-workspace/azurerm"
enable_telemetry = var.enable_telemetry
location = azurerm_resource_group.rg.location
resource_group_name = azurerm_resource_group.rg.name
name = "thislaworkspace"
log_analytics_workspace_retention_in_days = 30
log_analytics_workspace_sku = "PerGB2018"
log_analytics_workspace_identity = {
type = "SystemAssigned"
}
}

module "log_analytics_solution" {
source = "../../modules/log_analytics_solution"
log_analytics_solution_solution_name = "SecurityInsights"
log_analytics_solution_workspace_name = module.log_analytics_workspace.resource.name
log_analytics_solution_workspace_resource_id = module.log_analytics_workspace.resource_id
log_analytics_solution_resource_group_name = azurerm_resource_group.rg.name
log_analytics_solution_location = azurerm_resource_group.rg.location
log_analytics_solution_plan = {
publisher = "Microsoft"
product = "OMSGallery/SecurityInsights"
}
}
9 changes: 9 additions & 0 deletions examples/deploy_security_insights/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
variable "enable_telemetry" {
type = bool
default = true
description = <<DESCRIPTION
This variable controls whether or not telemetry is enabled for the module.
For more information see https://aka.ms/avm/telemetryinfo.
If it is set to false, then no telemetry will be collected.
DESCRIPTION
}
2 changes: 1 addition & 1 deletion locals.version.tf.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"locals": {
"module_version": "0.2.0"
"module_version": "0.2.1"
}
}
70 changes: 70 additions & 0 deletions modules/.terraform-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
### To generate the output file to partially incorporate in the README.md,
### Execute this command in the Terraform module's code folder:
# terraform-docs -c .terraform-docs.yml .

formatter: "markdown document" # this is required

version: "~> 0.17.0"

header-from: "_header.md"
footer-from: "_footer.md"

recursive:
enabled: false
path: modules

sections:
hide: []
show: []

content: |-
{{ .Header }}
```hcl
{{ include "main.tf" }}
```
<!-- markdownlint-disable MD033 -->
{{ .Requirements }}
{{ .Providers }}
{{ .Resources }}
<!-- markdownlint-disable MD013 -->
{{ .Inputs }}
{{ .Outputs }}
{{ .Modules }}
{{ .Footer }}
output:
file: README.md
mode: replace
template: |-
<!-- BEGIN_TF_DOCS -->
{{ .Content }}
<!-- END_TF_DOCS -->
output-values:
enabled: false
from: ""

sort:
enabled: true
by: required

settings:
anchor: true
color: true
default: true
description: false
escape: true
hide-empty: false
html: true
indent: 2
lockfile: false
read-comments: true
required: true
sensitive: true
type: true
4 changes: 4 additions & 0 deletions modules/log_analytics_solution/_footer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<!-- markdownlint-disable-next-line MD041 -->
## Data Collection

The software may collect information about you and your use of the software and send it to Microsoft. Microsoft may use this information to provide services and improve our products and services. You may turn off the telemetry as described in the repository. There are also some features in the software that may enable you and Microsoft to collect data from users of your applications. If you use these features, you must comply with applicable law, including providing appropriate notices to users of your applications together with a copy of Microsoft’s privacy statement. Our privacy statement is located at <https://go.microsoft.com/fwlink/?LinkID=824704>. You can learn more about data collection and use in the help documentation and our privacy statement. Your use of the software operates as your consent to these practices.
11 changes: 11 additions & 0 deletions modules/log_analytics_solution/_header.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Azure Log Analytics Solution

This is the sub-module to Log Analytics Solution

## Features

This module supports:

- Creates Log Analytics Solution

"Major version Zero (0.y.z) is for initial development. Anything MAY change at any time. The module SHOULD NOT be considered stable till at least it is major version one (1.0.0) or greater. Changes will always be via new versions being published and no changes will be made to existing published versions. For more details please go to <https://semver.org/>"
26 changes: 26 additions & 0 deletions modules/log_analytics_solution/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
resource "azurerm_log_analytics_solution" "this" {
location = var.log_analytics_solution_location
resource_group_name = var.log_analytics_solution_resource_group_name
solution_name = var.log_analytics_solution_solution_name
workspace_name = var.log_analytics_solution_workspace_name
workspace_resource_id = var.log_analytics_solution_workspace_resource_id
tags = var.log_analytics_solution_tags

dynamic "plan" {
for_each = [var.log_analytics_solution_plan]
content {
product = plan.value.product
publisher = plan.value.publisher
promotion_code = plan.value.promotion_code
}
}
dynamic "timeouts" {
for_each = var.log_analytics_solution_timeouts == null ? [] : [var.log_analytics_solution_timeouts]
content {
create = timeouts.value.create
delete = timeouts.value.delete
read = timeouts.value.read
update = timeouts.value.update
}
}
}
9 changes: 9 additions & 0 deletions modules/log_analytics_solution/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
output "resource" {
description = "this is the resource of the rule collection group"
value = azurerm_log_analytics_solution.this
}

output "resource_id" {
description = "the resource id of the rule_collection_group"
value = azurerm_log_analytics_solution.this.id
}
Loading

0 comments on commit e051221

Please sign in to comment.