Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate command creates examples in the wrong directory #391

Open
1 task done
ctreatma opened this issue Jul 2, 2024 · 0 comments
Open
1 task done

Migrate command creates examples in the wrong directory #391

ctreatma opened this issue Jul 2, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@ctreatma
Copy link

ctreatma commented Jul 2, 2024

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
@ctreatma ctreatma added the bug Something isn't working label Jul 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant