Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions modules/azure-disks/.terraform-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
formatter: "markdown" # this is required

version: ""

header-from: docs/header.md
footer-from: docs/footer.md

recursive:
enabled: false
path: modules
include-main: true

sections:
hide: []
show: []

content: ""

output:
file: "README.md"
mode: inject
template: |-
<!-- BEGIN_TF_DOCS -->
{{ .Content }}
<!-- END_TF_DOCS -->

output-values:
enabled: false
from: ""

sort:
enabled: true
by: name

settings:
anchor: true
color: true
default: true
description: false
escape: true
hide-empty: false
html: true
indent: 2
lockfile: true
read-comments: true
required: true
sensitive: true
type: true
89 changes: 70 additions & 19 deletions modules/azure-disks/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,54 @@
<!-- BEGIN_TF_DOCS -->
# Azure Managed Disks Terraform Module

## Overview

This Terraform module allows you to create and manage managed disks in Azure, with support for:
- Creation of multiple disks with different configurations.
- Optional role assignment on disks.
- Flexible tagging and tag inheritance from the Resource Group.

## Main features
- Create managed disks of different types and sizes.
- Optional role assignment to disks (e.g., Contributor).
- Support for tags and inheritance from the Resource Group.
- Ignores disk size changes in lifecycle (useful for CSI Driver).

## Complete usage example
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same issue as docs/header.md: the README usage example documents disks as a list and uses storage_account_type, but the concrete example added in _examples/basic uses a map and sku. Please make README’s “Complete usage example” consistent with the real example and the module inputs to avoid misleading users.

Copilot uses AI. Check for mistakes.

```yaml
values:
tags_from_rg: true
resource_group_name: "REDACTED-RESOURCE-GROUP"
location: "REDACTED-LOCATION"
disks:
- name: disk-1
storage_account_type: StandardSSD_LRS
- name: disk-2
- name: disk-3
- name: disk-4
```

## Notes
- You can create empty disks or base them on another disk.
- Assigning a role to a disk is not mandatory.
- Disk size is ignored in changes to avoid conflicts with the CSI Driver.

## File structure

```
.
├── main.tf
├── variables.tf
├── outputs.tf
├── versions.tf
├── README.md
├── CHANGELOG.md
└── docs/
├── header.md
└── footer.md
```

## Requirements

| Name | Version |
Expand All @@ -11,6 +62,10 @@
|------|---------|
| <a name="provider_azurerm"></a> [azurerm](#provider\_azurerm) | ~> 4.5.0 |

## Modules

No modules.

## Resources

| Name | Type |
Expand Down Expand Up @@ -39,25 +94,21 @@
| <a name="output_disk_ids"></a> [disk\_ids](#output\_disk\_ids) | n/a |
| <a name="output_disk_names"></a> [disk\_names](#output\_disk\_names) | Output section |

## Notes
---

- Empty disks or disks based on another disk can be created.
- It is not necessary to assign a role to a disk.
- **There is a lifecycle rule to ignore changes to disk size, as the CSI Driver may resize the disk outside of Terraform.**
## Examples

## Example
For detailed examples, refer to the [module examples](https://github.com/prefapp/tfm/tree/main/modules/azure-disks/_examples):

```yaml
values:
tags_from_rg: true
resource_group_name: "REDACTED-RESOURCE-GROUP"
location: "REDACTED-LOCATION"
disks:
- name: disk-1
storage_account_type: StandardSSD_LRS
- name: disk-2
- name: disk-3
- name: disk-4
storage_account_type: Premium_LRS
principal_id: "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
```
- [basic](https://github.com/prefapp/tfm/tree/main/modules/azure-disks/_examples/basic) - Basic managed disk configuration with size, SKU and performance settings.

## Additional resources

- [Azure Managed Disks](https://learn.microsoft.com/en-us/azure/virtual-machines/managed-disks-overview)
- [Terraform AzureRM Provider - azurerm\_managed\_disk](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/managed_disk)
- [Official Terraform documentation](https://www.terraform.io/docs)

## Support

For issues, questions, or contributions related to this module, please visit the repository’s issue tracker: [https://github.com/prefapp/tfm/issues](https://github.com/prefapp/tfm/issues)
<!-- END_TF_DOCS -->
30 changes: 30 additions & 0 deletions modules/azure-disks/_examples/basic/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// Basic example: create managed disks using the azure-disks module

module "azure_disks" {
source = "../../"

location = "westeurope"
resource_group_name = "example-rg"

disks = {
data1 = {
# This map is intentionally loose; adapt keys to match main.tf expectations.
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment undermines the example’s usefulness because it doesn’t tell the reader what the “main.tf expectations” actually are. Consider replacing it with a short note that explicitly references the module’s disks input shape (e.g., map keyed by disk name) and which attributes are required vs optional, so the example is confidently copy/pastable.

Suggested change
# This map is intentionally loose; adapt keys to match main.tf expectations.
# `disks` is a map keyed by disk name. Each disk must at least define
# `size_gb`, `sku`, and `create_option`; optional attributes include
# `zone`, `encryption_type`, `disk_iops_read_write`, and `disk_mbps_read_write`.

Copilot uses AI. Check for mistakes.
size_gb = 128
sku = "Premium_LRS"
zone = "1"
create_option = "Empty"
encryption_type = "EncryptionAtRestWithPlatformKey"
disk_iops_read_write = 500
disk_mbps_read_write = 100
}
}

assign_role = false
role_definition_name = "Contributor"
principal_id = ""

tags = {
environment = "dev"
application = "example"
}
}
22 changes: 22 additions & 0 deletions modules/azure-disks/_examples/basic/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Basic example values for azure-disks module

location: westeurope
resource_group_name: example-rg

disks:
data1:
size_gb: 128
sku: Premium_LRS
zone: "1"
create_option: Empty
encryption_type: EncryptionAtRestWithPlatformKey
disk_iops_read_write: 500
disk_mbps_read_write: 100

assign_role: false
role_definition_name: Contributor
principal_id: ""

tags:
environment: dev
application: example
17 changes: 17 additions & 0 deletions modules/azure-disks/docs/footer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---

## Examples

For detailed examples, refer to the [module examples](https://github.com/prefapp/tfm/tree/main/modules/azure-disks/_examples):

- [basic](https://github.com/prefapp/tfm/tree/main/modules/azure-disks/_examples/basic) - Basic managed disk configuration with size, SKU and performance settings.
Comment on lines +5 to +7
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These hard-coded GitHub links to prefapp/tfm and the main branch make the docs less portable (e.g., forks, alternate default branches, offline rendering). Prefer relative links (e.g., ./_examples and ./_examples/basic) so the docs work correctly across forks and branches.

Suggested change
For detailed examples, refer to the [module examples](https://github.com/prefapp/tfm/tree/main/modules/azure-disks/_examples):
- [basic](https://github.com/prefapp/tfm/tree/main/modules/azure-disks/_examples/basic) - Basic managed disk configuration with size, SKU and performance settings.
For detailed examples, refer to the [module examples](./_examples):
- [basic](./_examples/basic) - Basic managed disk configuration with size, SKU and performance settings.

Copilot uses AI. Check for mistakes.

## Additional resources

- [Azure Managed Disks](https://learn.microsoft.com/en-us/azure/virtual-machines/managed-disks-overview)
- [Terraform AzureRM Provider - azurerm_managed_disk](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/managed_disk)
- [Official Terraform documentation](https://www.terraform.io/docs)

## Support

For issues, questions, or contributions related to this module, please visit the repository’s issue tracker: [https://github.com/prefapp/tfm/issues](https://github.com/prefapp/tfm/issues)
49 changes: 49 additions & 0 deletions modules/azure-disks/docs/header.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Azure Managed Disks Terraform Module

## Overview

This Terraform module allows you to create and manage managed disks in Azure, with support for:
- Creation of multiple disks with different configurations.
- Optional role assignment on disks.
- Flexible tagging and tag inheritance from the Resource Group.

## Main features
- Create managed disks of different types and sizes.
- Optional role assignment to disks (e.g., Contributor).
- Support for tags and inheritance from the Resource Group.
- Ignores disk size changes in lifecycle (useful for CSI Driver).

## Complete usage example
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The “Complete usage example” shows disks as a YAML list with name/storage_account_type, but the added _examples/basic uses disks as a Terraform map keyed by disk name and uses sku (not storage_account_type). This inconsistency makes the docs hard to follow and likely copy/paste broken; please update the header example to match the module’s actual input schema (map vs list) and align attribute names (sku vs storage_account_type) with what the module expects.

Copilot uses AI. Check for mistakes.

```yaml
values:
tags_from_rg: true
resource_group_name: "REDACTED-RESOURCE-GROUP"
location: "REDACTED-LOCATION"
disks:
- name: disk-1
storage_account_type: StandardSSD_LRS
- name: disk-2
- name: disk-3
- name: disk-4
```

## Notes
- You can create empty disks or base them on another disk.
- Assigning a role to a disk is not mandatory.
- Disk size is ignored in changes to avoid conflicts with the CSI Driver.

## File structure

```
.
├── main.tf
├── variables.tf
├── outputs.tf
├── versions.tf
├── README.md
├── CHANGELOG.md
└── docs/
├── header.md
└── footer.md
```