terraform-plugin-docs
terraform-plugin-docs copied to clipboard
Strip Provider Prefix from File Names during Migration
Closes: #347 Supersedes: #348
Fixes a bug that is encountered when the migrate
command and generate
command are run on provider documentation that have provider short name prefixes in their filenames (ex. time_rotating.md
). The migrate
command would move the files to the template folder as-is but the generate
command does not recognize these files as valid documentation files because of the prefix, and therefore generates default template for the "missing" resource/data-sources, resulting in duplicate templates. This PR resolves this by introducing a --provider-name
flag to the migrate
subcommand, and uses the provided value to derive the provider short name and strips the prefix from an file name containing it.
The --provider-name
flag is optional for users who do not have the provider prefix in their file names, so they can continue to run the migrate
command without any flags, if the defaults are appropriate.