Skip to content

docs(azure-policy-assignments): update docs and added examples#898

Draft
pablosanchezpaz wants to merge 1 commit intomainfrom
add/azure-policy-assignments-docs
Draft

docs(azure-policy-assignments): update docs and added examples#898
pablosanchezpaz wants to merge 1 commit intomainfrom
add/azure-policy-assignments-docs

Conversation

@pablosanchezpaz
Copy link
Contributor

No description provided.

@pablosanchezpaz pablosanchezpaz requested a review from a team as a code owner February 6, 2026 08:26
@pablosanchezpaz
Copy link
Contributor Author

Related to #786

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the Azure Policy Assignments module documentation and adds a basic example, with terraform-docs configuration to generate/inject README content.

Changes:

  • Added terraform-docs header/footer files and config for README injection.
  • Added a “basic” example (HCL + YAML values) demonstrating policy assignments.
  • Expanded README with generated docs sections and links to examples/resources.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
modules/azure-policy-assignments/docs/header.md Adds module overview + full YAML/HCL usage examples for terraform-docs header.
modules/azure-policy-assignments/docs/footer.md Adds example links and support/resource references for terraform-docs footer.
modules/azure-policy-assignments/_examples/basic/values.yaml Adds basic YAML example inputs for assignments.
modules/azure-policy-assignments/_examples/basic/main.tf Adds basic Terraform module usage example.
modules/azure-policy-assignments/README.MD Injects/contains terraform-docs generated content including the new header/footer and module docs.
modules/azure-policy-assignments/.terraform-docs.yml Adds terraform-docs configuration to generate README from header/footer + module metadata.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

name = "example-assignment-3"
policy_type = "custom"
policy_name = "Example Policy"
resource_id = "/subscriptions/2de29132-986f-482d-a49f-31441fc7992b/resourceGroups/test/providers/Microsoft.KeyVault/vaults/-test"
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 example resource_id contains vaults/-test, which is not a valid Key Vault resource ID format and will cause the example to fail if copied. Replace it with the correct vault name segment (e.g., .../vaults/test).

Suggested change
resource_id = "/subscriptions/2de29132-986f-482d-a49f-31441fc7992b/resourceGroups/test/providers/Microsoft.KeyVault/vaults/-test"
resource_id = "/subscriptions/2de29132-986f-482d-a49f-31441fc7992b/resourceGroups/test/providers/Microsoft.KeyVault/vaults/test"

Copilot uses AI. Check for mistakes.
name = "example-assignment-3"
policy_type = "custom"
policy_name = "Example Policy"
resource_id = "/subscriptions/2de29132-986f-482d-a49f-31441fc7992b/resourceGroups/test/providers/Microsoft.KeyVault/vaults/-test"
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 in docs/header.md: the README’s HCL example includes an invalid Key Vault resource ID (vaults/-test). Update it to a valid resource ID so the documented example is copy/paste runnable.

Suggested change
resource_id = "/subscriptions/2de29132-986f-482d-a49f-31441fc7992b/resourceGroups/test/providers/Microsoft.KeyVault/vaults/-test"
resource_id = "/subscriptions/2de29132-986f-482d-a49f-31441fc7992b/resourceGroups/test/providers/Microsoft.KeyVault/vaults/test"

Copilot uses AI. Check for mistakes.
Comment on lines +24 to +33
- name: "example-assignment-2"
policy_type: "builtin"
policy_name: "Allowed virtual machine size SKUs"
resource_group_id: "/subscriptions/2de29132-986f-482d-a49f-31441fc7992b/resourceGroups/test"
scope: "resource group"
- name: "example-assignment-2"
policy_type: "builtin"
policy_name: "Allowed virtual machine size SKUs"
resource_group_name: "test"
scope: "resource group"
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 YAML example defines two assignments with the same name (example-assignment-2) at the same scope. Azure Policy assignment names must be unique at a given scope, so this example is likely to fail or mislead users. Use distinct names (or collapse into a single example showing either resource_group_id or resource_group_name).

Copilot uses AI. Check for mistakes.
Comment on lines +17 to +42
values:
assignments:
- name: "example-assignment-3"
policy_type: "custom"
policy_name: "Example Policy"
resource_id: "/subscriptions/2de29132-986f-482d-a49f-31441fc7992b/resourceGroups/test/providers/Microsoft.KeyVault/vaults/test"
scope: "resource"
- name: "example-assignment-2"
policy_type: "builtin"
policy_name: "Allowed virtual machine size SKUs"
resource_group_id: "/subscriptions/2de29132-986f-482d-a49f-31441fc7992b/resourceGroups/test"
scope: "resource group"
- name: "example-assignment-2"
policy_type: "builtin"
policy_name: "Allowed virtual machine size SKUs"
resource_group_name: "test"
scope: "resource group"
- name: "example-assignment-1"
policy_type: "builtin"
policy_name: "Allowed locations"
scope: "subscription"
- name: "example-assignment-4"
policy_type: "custom"
policy_name: "Example Policy"
management_group_name: "example"
scope: "management group"
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 header YAML example nests assignments under values:, but the added example file _examples/basic/values.yaml uses assignments: at the root. This inconsistency can confuse users about the expected input shape—consider aligning the documentation with the actual example format (or explicitly explaining when/why values: is required).

Suggested change
values:
assignments:
- name: "example-assignment-3"
policy_type: "custom"
policy_name: "Example Policy"
resource_id: "/subscriptions/2de29132-986f-482d-a49f-31441fc7992b/resourceGroups/test/providers/Microsoft.KeyVault/vaults/test"
scope: "resource"
- name: "example-assignment-2"
policy_type: "builtin"
policy_name: "Allowed virtual machine size SKUs"
resource_group_id: "/subscriptions/2de29132-986f-482d-a49f-31441fc7992b/resourceGroups/test"
scope: "resource group"
- name: "example-assignment-2"
policy_type: "builtin"
policy_name: "Allowed virtual machine size SKUs"
resource_group_name: "test"
scope: "resource group"
- name: "example-assignment-1"
policy_type: "builtin"
policy_name: "Allowed locations"
scope: "subscription"
- name: "example-assignment-4"
policy_type: "custom"
policy_name: "Example Policy"
management_group_name: "example"
scope: "management group"
assignments:
- name: "example-assignment-3"
policy_type: "custom"
policy_name: "Example Policy"
resource_id: "/subscriptions/2de29132-986f-482d-a49f-31441fc7992b/resourceGroups/test/providers/Microsoft.KeyVault/vaults/test"
scope: "resource"
- name: "example-assignment-2"
policy_type: "builtin"
policy_name: "Allowed virtual machine size SKUs"
resource_group_id: "/subscriptions/2de29132-986f-482d-a49f-31441fc7992b/resourceGroups/test"
scope: "resource group"
- name: "example-assignment-2"
policy_type: "builtin"
policy_name: "Allowed virtual machine size SKUs"
resource_group_name: "test"
scope: "resource group"
- name: "example-assignment-1"
policy_type: "builtin"
policy_name: "Allowed locations"
scope: "subscription"
- name: "example-assignment-4"
policy_type: "custom"
policy_name: "Example Policy"
management_group_name: "example"
scope: "management group"

Copilot uses AI. Check for mistakes.

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

- [basic](https://github.com/prefapp/tfm/tree/main/modules/azure-policy-assignments/_examples/basic) - Policy assignments at subscription, resource group and management group scopes.
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 basic example currently shows subscription + resource group assignments, but does not include a management group assignment. Update the description to match the actual example content, or extend the example to include a management group assignment.

Suggested change
- [basic](https://github.com/prefapp/tfm/tree/main/modules/azure-policy-assignments/_examples/basic) - Policy assignments at subscription, resource group and management group scopes.
- [basic](https://github.com/prefapp/tfm/tree/main/modules/azure-policy-assignments/_examples/basic) - Policy assignments at subscription and resource group scopes.

Copilot uses AI. Check for mistakes.
Comment on lines +3 to +4
version: ""

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.

An empty version field is ambiguous and can make docs generation less reproducible across environments. Prefer removing the field entirely or pinning/setting an explicit terraform-docs version constraint to ensure consistent README output.

Suggested change
version: ""

Copilot uses AI. Check for mistakes.
@pablosanchezpaz pablosanchezpaz marked this pull request as draft February 11, 2026 16:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants