Browse Source

fix variable

tags/0.1.0
ravi 6 months ago
parent
commit
7a7d18447f
4 changed files with 12 additions and 21 deletions
  1. +4
    -5
      README.md
  2. +0
    -1
      examples/default/deploy.tf
  3. +4
    -5
      main.tf
  4. +4
    -10
      variables.tf

+ 4
- 5
README.md View File

@@ -27,7 +27,6 @@ This module is used to deploy multiple resources (storage account,log analytics
| diagnostics\_count | How many diagnostics settings to create. | `number` | `1` | no |
| enable\_https\_traffic\_only | Boolean flag which forces HTTPS if enabled. | `bool` | `true` | no |
| enabled | Enable or disable module. | `bool` | `true` | no |
| log\_analytics\_destination\_type | when set to `Dedicated logs sent to a log analytics workspace will go into resource specific tables, instead of the legacy Azurediagnostics table. Note: This setting will only have an effect if a `log\_analytics\_workspace\_id` is provided, and the resource is avaliable for resource-specific logs.` | `list(string)` | <pre>[<br> ""<br>]</pre> | no |
| log\_analytics\_workspace\_name | Name of the workspace to deploy to be used for logging.Changing this forces a new resource to be created. | `string` | `""` | no |
| log\_analytics\_workspace\_tags | Tags which will be associated to the log analytics workspace. | `map` | `{}` | no |
| logs | A list of list of map of options to apply. Map must support the following structure:<br> * category(required, string): The name of a diagnostic log category for the resource. Note: The log categories available vary depending on the resource begin used. You may wish to use `azurerm_monitor_diagnostc_catehories` data source to identify which categories are available for a given resource.<br> * enabled(Optional, boolean): Is this Diagnostic metric enabled?<br> * retention\_policy(Optional, list of map): A list of map of retention policies to apply<br> * enabled(required, boolean): Is this retention policy enabled?<br> * days(Optional, number): The number of days for which this retention policy should be applied. Note: Setting this to 0 will retain the events indefinetly.<br>For example, see folder example/default folder. | `list` | `[]` | no |
@@ -36,14 +35,14 @@ This module is used to deploy multiple resources (storage account,log analytics
| resource\_group\_location | Location where the resources will be deployed.Changing this forces a new resource to be created. | `string` | `"canadacentral"` | no |
| resource\_group\_name | Name of the resource group where the resource will be deployed.Changing this forces a new resource to be created. | `string` | `""` | no |
| retention\_in\_days | Number of days that logs will be retained in the workspace. | `number` | `7` | no |
| storage\_account\_exist | Boolean flag which describes whhether the storage account is already existing or not. | `bool` | `false` | no |
| storage\_account\_exist | Boolean flag which describes whether the storage account is already existing or not. | `bool` | `false` | no |
| storage\_account\_name | Name of the storage account to be used to host the logs. Changing forces a new resource to be created. | `string` | `""` | no |
| storage\_account\_tags | Tags which will specifically assigned to the storage account. | `map` | `{}` | no |
| storage\_account\_tags | Tags which will be specifically assigned to the storage account. | `map` | `{}` | no |
| storage\_containers | List of containers to create and their access levels. | `list(object({ name = string, access_type = string }))` | `[]` | no |
| storage\_shares | List of share to create | `list(object({ name = string, quota = string }))` | `[]` | no |
| tags | Tags shared by all resource of tis module. Will be merged with any other specific tags by resource. | `map` | `{}` | no |
| tags | Tags shared by all resource of this module. Will be merged with any other specific tags by resource. | `map` | `{}` | no |
| target\_resource\_ids | The list of IDs of an existing resource on which to configure diagnostic settings. Changing this forces a new resource to be created. | `list(string)` | <pre>[<br> ""<br>]</pre> | no |
| workspace\_exist | Boolean flag which describes whhether the log analytics workspace is already existing or not. | `bool` | `false` | no |
| workspace\_exist | Boolean flag which describes whether the log analytics workspace is already existing or not. | `bool` | `false` | no |
| workspace\_sku | SKU of the workspace to deploy to be used for logging.Changing this forces a new resource to be created. | `string` | `"free"` | no |

## Outputs


+ 0
- 1
examples/default/deploy.tf View File

@@ -99,5 +99,4 @@ module "example" {
}
]
]
log_analytics_destination_type = ["Dedicated"]
}

+ 4
- 5
main.tf View File

@@ -50,11 +50,10 @@ module "log_analytics_workspace" {
resource "azurerm_monitor_diagnostic_setting" "this" {
count = var.enabled ? var.diagnostics_count : 0

name = element(var.names, count.index)
target_resource_id = element(var.target_resource_ids, count.index)
log_analytics_workspace_id = var.workspace_exist != false ? data.azurerm_log_analytics_workspace.this[0].id : module.log_analytics_workspace.id
log_analytics_destination_type = element(var.log_analytics_destination_type, count.index)
storage_account_id = var.storage_account_exist != false ? data.azurerm_storage_account.this[0].id : module.storage_account.id
name = element(var.names, count.index)
target_resource_id = element(var.target_resource_ids, count.index)
log_analytics_workspace_id = var.workspace_exist != false ? data.azurerm_log_analytics_workspace.this[0].id : module.log_analytics_workspace.id
storage_account_id = var.storage_account_exist != false ? data.azurerm_storage_account.this[0].id : module.storage_account.id

dynamic "log" {
for_each = var.logs[count.index]


+ 4
- 10
variables.tf View File

@@ -17,7 +17,7 @@ variable "resource_group_name" {
}

variable "tags" {
description = "Tags shared by all resource of tis module. Will be merged with any other specific tags by resource."
description = "Tags shared by all resource of this module. Will be merged with any other specific tags by resource."
default = {}
}

@@ -26,7 +26,7 @@ variable "tags" {
###

variable "storage_account_exist" {
description = "Boolean flag which describes whhether the storage account is already existing or not."
description = "Boolean flag which describes whether the storage account is already existing or not."
default = false
}

@@ -66,7 +66,7 @@ variable "storage_shares" {
}

variable "storage_account_tags" {
description = "Tags which will specifically assigned to the storage account."
description = "Tags which will be specifically assigned to the storage account."
default = {}
}

@@ -75,7 +75,7 @@ variable "storage_account_tags" {
###

variable "workspace_exist" {
description = "Boolean flag which describes whhether the log analytics workspace is already existing or not."
description = "Boolean flag which describes whether the log analytics workspace is already existing or not."
default = false
}

@@ -123,12 +123,6 @@ variable "target_resource_ids" {
default = [""]
}

variable "log_analytics_destination_type" {
description = "when set to `Dedicated logs sent to a log analytics workspace will go into resource specific tables, instead of the legacy Azurediagnostics table. Note: This setting will only have an effect if a `log_analytics_workspace_id` is provided, and the resource is avaliable for resource-specific logs."
type = list(string)
default = [""]
}

variable "logs" {
description = <<-DOCUMENTATION
A list of list of map of options to apply. Map must support the following structure:


Loading…
Cancel
Save