Skip to content

Conversation

wyattfry
Copy link
Collaborator

Community Note

  • Please vote on this PR by adding a 👍 reaction to the original PR to help the community and maintainers prioritize for review
  • Please do not leave comments along the lines of "+1", "me too" or "any updates", they generate extra noise for PR followers and do not help prioritize for review

Description

PR Checklist

  • I have followed the guidelines in our Contributing Documentation.
  • I have checked to ensure there aren't other open Pull Requests for the same update/change.
  • I have checked if my changes close any open issues. If so please include appropriate closing keywords below.
  • I have updated/added Documentation as required written in a helpful and kind way to assist users that may be unfamiliar with the resource / data source.
  • I have used a meaningful PR title to help maintainers and other users understand this change and help prevent duplicate work.
    For example: “resource_name_here - description of change e.g. adding property new_property_name_here

Changes to existing Resource / Data Source

  • I have added an explanation of what my changes do and why I'd like you to include them (This may be covered by linking to an issue above, but may benefit from additional explanation).
  • I have written new tests for my resource or datasource changes & updated any relevant documentation.
  • I have successfully run tests with my changes locally. If not, please provide details on testing challenges that prevented you running the tests.
  • (For changes that include a state migration only). I have manually tested the migration path between relevant versions of the provider.

Testing

  • My submission includes Test coverage as described in the Contribution Guide and the tests pass. (if this is not possible for any reason, please include details of why you did or could not add test coverage)

Change Log

Below please provide what should go into the changelog (if anything) conforming to the Changelog Format documented here.

  • azurerm_resource - support for the thing1 property [GH-00000]

This is a (please select all that apply):

  • Bug Fix
  • New Feature (ie adding a service, resource, or data source)
  • Enhancement
  • Breaking Change

Related Issue(s)

Fixes #0000

AI Assistance Disclosure

  • AI Assisted - This contribution was made by, or with the assistance of, AI/LLMs

Rollback Plan

If a change needs to be reverted, we will publish an updated version of the provider.

Changes to Security Controls

Are there any changes to security controls (access controls, encryption, logging) in this pull request? If so, explain.

Note

If this PR changes meaningfully during the course of review please update the title and description as required.

@@ -0,0 +1,58 @@
## October 14, 2025 (TBD)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not sure we really need a changelog, we don't have any for our other internal tools

./scripts/documentfmt-fix.sh
```

### Command-Line Options
Copy link
Collaborator

Choose a reason for hiding this comment

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

Instead of listing all options, and us having to then keep this document up-to-date, we should probably just remove this section and direct users to run go run ./internal/tools/document-fmt/main.go --help for available commands and options. 99% of the time usage will be limited to running the make targets anyway

Comment on lines +187 to +192
if fix {
// Create and add the missing section
section = &markdown.ExampleSection{}
// Set default content...
d.Document.Sections = append(d.Document.Sections, section)
d.Document.HasChange = true
Copy link
Collaborator

Choose a reason for hiding this comment

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

While this is an example, since it's included it should be updated to be accurate:

  • this isn't setting any content because it didn't template it or call SetContent
  • appending a section directly is really only valid for the API version section as that appears last in the documentation. For things like an Example section (or other sections we expect in a certain order) there are helpers to use. E.g. markdown.InsertAfterSection or markdown.InsertBeforeSection

If certain resources need to skip a rule, add exceptions in `rule/rule_exceptions.go`:

```go
func shouldSkipRule(resourceName string, ruleID string) bool {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This isn't a function that exists and also not how exceptions are added (Exceptions is a global map var with a nested map so we can access without having to loop)

1. Create section implementation in `markdown/section_*.go`
2. Implement the `Section` interface
3. Register the section type in `markdown/registration.go`
4. Add template if needed in `template/template.go`
Copy link
Collaborator

Choose a reason for hiding this comment

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

section templates don't go here


## Additional Notes

- The tool uses the `afero` filesystem abstraction for testability
Copy link
Collaborator

Choose a reason for hiding this comment

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

It uses afero simply because it was easy to use for filesystem access, not for testability. I don't think this should be included in the readme

Comment on lines +264 to +279
## Integration with CI/CD

The tool integrates with the repository's CI/CD pipeline:

- **Pre-commit**: Can be run locally before committing
- **CI Validation**: `scripts/documentfmt-validate.sh` runs in CI to catch issues
- **Automated Fixing**: Developers can run `make document-fix` to auto-correct issues
- **Exit Codes**: Non-zero exit code on validation failure stops the build

## Additional Notes

- The tool uses the `afero` filesystem abstraction for testability
- All rules can operate in both validate-only and fix modes
- The validator maintains state across all resources being processed
- Template rendering uses Go's `text/template` package for flexibility
- Color-coded output helps distinguish errors, warnings, and success messages
Copy link
Collaborator

Choose a reason for hiding this comment

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

Are these 2 sections needed? I'm not sure it's adding much value to anyone using or modifying the tool and it contains some inaccurate + some redundant information

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm fine leaving them out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants