docs(azure-vmss): update docs and added examples#890
docs(azure-vmss): update docs and added examples#890pablosanchezpaz wants to merge 5 commits intomainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Adds terraform-docs scaffolding and example artifacts for the azure-vmss Terraform module to improve module documentation and provide a basic example configuration.
Changes:
- Add terraform-docs header/footer sources and configure terraform-docs injection for the module README.
- Add a new “basic” example (
_examples/basic) with both Terraform and YAML values. - Update
README.mdwith injected terraform-docs content including examples and links.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| modules/azure-vmss/docs/header.md | New header content for terraform-docs, including overview/features and example blocks. |
| modules/azure-vmss/docs/footer.md | New footer content with examples link and support/resources. |
| modules/azure-vmss/_examples/basic/values.yaml | Adds YAML values file intended for the basic example. |
| modules/azure-vmss/_examples/basic/main.tf | Adds a basic Terraform example using the module. |
| modules/azure-vmss/README.md | Injects terraform-docs output into README (currently duplicating content outside the markers). |
| modules/azure-vmss/.terraform-docs.yml | Adds terraform-docs configuration to generate/inject README content from header/footer. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
modules/azure-vmss/docs/header.md
Outdated
| image_version = "latest" | ||
| identity_type = "SystemAssigned" | ||
| cloud_init = file("./cloud-init.yml") | ||
| run_script = file("./init-script.sh") | ||
| } |
There was a problem hiding this comment.
The vmss example also omits required networking input (network_interface_public_ip_adress_public_ip_prefix_id) and other fields that the module dereferences unconditionally (e.g., subnet/vnet details). As a result, the example will not work when copied; please include the required networking attributes.
modules/azure-vmss/docs/header.md
Outdated
| common = { | ||
| resource_group_name = "my-resource-group" | ||
| location = "eastus" | ||
| tags_from_rg = true | ||
|
|
||
| vmss = { | ||
| name = "my-vmss" | ||
| sku = "Standard_DS2_v2" | ||
| instances = 3 | ||
| admin_username = "azureuser" | ||
| admin_ssh_key_username = "ssh-user" | ||
| first_public_key = "ssh-rsa AAAAB3NzaC1yc2..." | ||
| eviction_policy = "Delete" | ||
| secure_boot_enabled = true | ||
| disk_storage_account_type = "Standard_LRS" | ||
| disk_caching = "ReadWrite" | ||
| upgrade_mode = "Rolling" | ||
| rolling_upgrade_policy_max_batch_instance_percent = 20 | ||
| rolling_upgrade_policy_max_unhealthy_instance_percent = 20 | ||
| image_publisher = "Canonical" | ||
| image_offer = "UbuntuServer" | ||
| image_sku = "18.04-LTS" | ||
| image_version = "latest" | ||
| identity_type = "SystemAssigned" | ||
| cloud_init = file("./cloud-init.yml") | ||
| run_script = file("./init-script.sh") | ||
| } | ||
| } |
There was a problem hiding this comment.
The fenced yaml example is not valid YAML (it uses HCL-style =/{} and the HCL file() function). Please replace it with a YAML tfvars-style example like _examples/basic/values.yaml (common: / vmss: / tags_from_rg: / tags:).
| common = { | |
| resource_group_name = "my-resource-group" | |
| location = "eastus" | |
| tags_from_rg = true | |
| vmss = { | |
| name = "my-vmss" | |
| sku = "Standard_DS2_v2" | |
| instances = 3 | |
| admin_username = "azureuser" | |
| admin_ssh_key_username = "ssh-user" | |
| first_public_key = "ssh-rsa AAAAB3NzaC1yc2..." | |
| eviction_policy = "Delete" | |
| secure_boot_enabled = true | |
| disk_storage_account_type = "Standard_LRS" | |
| disk_caching = "ReadWrite" | |
| upgrade_mode = "Rolling" | |
| rolling_upgrade_policy_max_batch_instance_percent = 20 | |
| rolling_upgrade_policy_max_unhealthy_instance_percent = 20 | |
| image_publisher = "Canonical" | |
| image_offer = "UbuntuServer" | |
| image_sku = "18.04-LTS" | |
| image_version = "latest" | |
| identity_type = "SystemAssigned" | |
| cloud_init = file("./cloud-init.yml") | |
| run_script = file("./init-script.sh") | |
| } | |
| } | |
| common: | |
| resource_group_name: "my-resource-group" | |
| location: "eastus" | |
| tags_from_rg: true | |
| tags: | |
| environment: "dev" | |
| project: "my-project" | |
| vmss: | |
| name: "my-vmss" | |
| sku: "Standard_DS2_v2" | |
| instances: 3 | |
| admin_username: "azureuser" | |
| admin_ssh_key_username: "ssh-user" | |
| first_public_key: "ssh-rsa AAAAB3NzaC1yc2..." | |
| eviction_policy: "Delete" | |
| secure_boot_enabled: true | |
| disk_storage_account_type: "Standard_LRS" | |
| disk_caching: "ReadWrite" | |
| upgrade_mode: "Rolling" | |
| rolling_upgrade_policy_max_batch_instance_percent: 20 | |
| rolling_upgrade_policy_max_unhealthy_instance_percent: 20 | |
| image_publisher: "Canonical" | |
| image_offer: "UbuntuServer" | |
| image_sku: "18.04-LTS" | |
| image_version: "latest" | |
| identity_type: "SystemAssigned" | |
| cloud_init: "./cloud-init.yml" | |
| run_script: "./init-script.sh" |
modules/azure-vmss/docs/header.md
Outdated
| common = { | ||
| resource_group_name = "my-resource-group" | ||
| location = "eastus" | ||
| tags_from_rg = true | ||
|
|
There was a problem hiding this comment.
tags_from_rg is shown inside common, but common only contains resource_group_name and location per variables.tf. This example will fail type-checking; move tags_from_rg to the top level (sibling of common/vmss) and ensure the common object is properly closed.
modules/azure-vmss/README.md
Outdated
| ```yaml | ||
| common = { | ||
| resource_group_name = "my-resource-group" | ||
| location = "eastus" | ||
| tags_from_rg = true |
There was a problem hiding this comment.
The yaml example under BEGIN_TF_DOCS is not valid YAML (it uses HCL-style =/{}) and nests tags_from_rg under common, which violates the common object type. Please switch to a YAML tfvars-style example and keep tags_from_rg at the top level.
| network_interface_public_ip_adress_public_ip_prefix_id: /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/example-rg/providers/Microsoft.Network/publicIPPrefixes/example-prefix | ||
|
|
||
| identity_type: SystemAssigned | ||
| cloud_init: null |
There was a problem hiding this comment.
cloud_init: null will fail with the current module implementation because main.tf always evaluates base64encode(var.vmss.cloud_init); base64encode(null) is an error. Update the example to provide a (possibly empty/minimal) cloud-init string, or change the module to set custom_data = null when cloud_init is null.
| cloud_init: null | |
| cloud_init: | | |
| #cloud-config |
|
|
||
| identity_type = "SystemAssigned" | ||
|
|
||
| cloud_init = null |
There was a problem hiding this comment.
cloud_init = null will fail with the current module implementation because the module always base64-encodes vmss.cloud_init. Update the example to pass a string (or adjust the module to handle null by setting custom_data = null).
| cloud_init = null | |
| cloud_init = "" |
modules/azure-vmss/README.md
Outdated
| upgrade_mode = "Rolling" | ||
| rolling_upgrade_policy_max_batch_instance_percent = 20 | ||
| rolling_upgrade_policy_max_unhealthy_instance_percent = 20 | ||
| image_publisher = "Canonical" | ||
| image_offer = "UbuntuServer" |
There was a problem hiding this comment.
This example vmss block is missing required rolling_upgrade_policy_* attributes and required networking input like network_interface_public_ip_adress_public_ip_prefix_id. Please add the required fields (or make them optional in the module) so the README example is actually runnable.
modules/azure-vmss/docs/header.md
Outdated
| upgrade_mode = "Rolling" | ||
| rolling_upgrade_policy_max_batch_instance_percent = 20 | ||
| rolling_upgrade_policy_max_unhealthy_instance_percent = 20 | ||
| image_publisher = "Canonical" | ||
| image_offer = "UbuntuServer" |
There was a problem hiding this comment.
This vmss example is incomplete relative to the required vmss object type: multiple rolling_upgrade_policy_* attributes are required (e.g., max_unhealthy_upgraded_instance_percent, pause_time_between_batches, and the boolean flags) but are not provided here. Please add the required fields so the example can be applied as-is.
| <!-- BEGIN_TF_DOCS --> | ||
| # Azure Virtual Machine Scale Set (VMSS) Terraform Module | ||
|
|
There was a problem hiding this comment.
README.md now contains a large block of content before <!-- BEGIN_TF_DOCS -->. In other modules in this repo, the README is fully managed inside the terraform-docs inject markers (the file starts with BEGIN_TF_DOCS), otherwise the documentation is duplicated and terraform-docs won't manage the preamble. Consider removing the pre-marker content (or switching terraform-docs output mode) so the README is fully generated consistently.
|
Related to #786 |
No description provided.