Skip to content

Commit 9e02432

Browse files
authored
Allow tags for each data_disk (#90)
Signed-off-by: Roman Schwarz <rs@cloudeteer.de>
1 parent 51c444c commit 9e02432

3 files changed

Lines changed: 5 additions & 1 deletion

File tree

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,7 @@ Parameter | Description
404404
`name` | Specifies the name of the Managed Disk. If omitted a name will be generated based on `name`.
405405
`source_resource_id` | The ID of an existing Managed Disk or Snapshot to copy when `create_option` is `Cop`y or the recovery point to restore when `create_option` is `Restore`.
406406
`storage_account_type` | The type of storage to use for the managed disk. Possible values are `Standard_LRS`, `StandardSSD_ZRS`, `Premium_LRS`, `PremiumV2_LRS`, `Premium_ZRS`, `StandardSSD_LRS` or `UltraSSD_LRS`.
407+
`tags` | Tags specific to this data disk.
407408

408409
Type:
409410

@@ -416,6 +417,7 @@ list(object({
416417
name = optional(string)
417418
source_resource_id = optional(string)
418419
storage_account_type = optional(string, "Premium_LRS")
420+
tags = optional(map(string), {})
419421
}))
420422
```
421423

r-disk.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ resource "azurerm_managed_disk" "this" {
1818
name = each.value.name
1919
location = var.location
2020
resource_group_name = var.resource_group_name
21-
tags = var.tags
21+
tags = merge(var.tags, each.value.tags)
2222

2323
create_option = each.value.create_option
2424
disk_size_gb = each.value.disk_size_gb

variables.tf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ variable "data_disks" {
221221
`name` | Specifies the name of the Managed Disk. If omitted a name will be generated based on `name`.
222222
`source_resource_id` | The ID of an existing Managed Disk or Snapshot to copy when `create_option` is `Cop`y or the recovery point to restore when `create_option` is `Restore`.
223223
`storage_account_type` | The type of storage to use for the managed disk. Possible values are `Standard_LRS`, `StandardSSD_ZRS`, `Premium_LRS`, `PremiumV2_LRS`, `Premium_ZRS`, `StandardSSD_LRS` or `UltraSSD_LRS`.
224+
`tags` | Tags specific to this data disk.
224225
EOT
225226

226227
type = list(object({
@@ -231,6 +232,7 @@ variable "data_disks" {
231232
name = optional(string)
232233
source_resource_id = optional(string)
233234
storage_account_type = optional(string, "Premium_LRS")
235+
tags = optional(map(string), {})
234236
}))
235237

236238
default = []

0 commit comments

Comments
 (0)