Add new content with terraform-plugin-docs generate

I’m using the terraform-plugin-docs plugin to generate documentation for my provider. However, I noticed that I’m allowed to add only description and examples usages.

For example if I want to add an Import section like here I haven’t found possible to do that.

Since terraform-plugin-docs generate will overwrite any changes I make in the docs folder, should I generate my documentation only once and then manually editing my docs file or is there an option to add new content so terraform-plugin-docs can pick it up?

Hey there @zuzuleinen :wave: ,

If you’re specifically looking for how to generate the import section, you can include an import.sh file next to your example and terraform-plugin-docs should pick it up automatically. Example from the DNS provider:

If you want to hand-write a section, you can also use the templating functionality of terraform-plugin-docs with the templates folder. This will replace the default template of the doc generator, so you can hand-write pieces of the documentation without the generator undo-ing your changes. Example from the time provider, where we have more detailed instructions for the import:


The README.md in terraform-plugin-docs has some information about the location of the template files, as well as the available data:

Hopefully that helps!

1 Like

Thanks Austing,

import.sh is what I wanted and being able to override the templates is also a great option!

1 Like