Skip to content

Migrate command creates examples in the wrong directory #391

Open
@ctreatma

Description

@ctreatma

Terraform CLI and terraform-plugin-docs Versions

terraform v1.8.1
terraform-plugin-docs v0.19.4

Provider Code

https://github.com/equinix/terraform-provider-equinix

Expected Behavior

When I run terraform-plugin-docs migrate, the templates and examples that are created should align with the documented conventional paths.

This means that template files should be created in, e.g., templates/resources/myresource.md.tmpl (no provider name prefix)
and that example files should be created in, e.g., examples/resources/myprovider_myresource/example1.tf (including the provider name prefix).

Actual Behavior

Template files are created in, e.g., templates/resources/myresource.md.tmpl as expected
Example files are created in, e.g., examples/resources/myresource/example1.tf.

It makes sense to me that none of the paths would include the provider prefix, but the issue is that the canonical paths for examples include the provider prefix, which leads to confusion if you try to reduce your use of custom templates after migrating. The default template expects the examples to be in examples/resources/myprovider_myresource, and it's easy to miss the note that <resource_name> includes the provider prefix in the case of (some) example paths, in which case your regenerated docs don't include examples any more.

If tfplugindocs migrate created example files in directories named examples/myprovider_myresource instead of examples/myresource, that would reduce the gap between migrated docs and canonical paths. However, it would be nice if the provider prefix were omitted consistently instead of being included only for certain files. If that is not possible for some reason, it would be helpful for the docs to be more explicit by documenting that, e.g., the conventional path for a resource example is examples/resources/<provider name>_<resource name>/resource.tf instead of having a separate note explaining which of the example paths include the provider name prefix.

Steps to Reproduce

  1. tfplugindocs migrate

How much impact is this issue causing?

Low

Logs

No response

Additional Information

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions