Skip to content

Commit

Permalink
doc: Update CONTRIBUTING.md to explain how to generate doc (#1832)
Browse files Browse the repository at this point in the history
  • Loading branch information
andreaangiolillo committed Jan 12, 2024
1 parent 98054a6 commit b3c5402
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
13 changes: 13 additions & 0 deletions CONTRIBUTING.md
Expand Up @@ -15,6 +15,7 @@ Thanks for your interest in contributing to MongoDB Atlas Terraform Provider, th
- [Scaffolding Initial Code and File Structure](#scaffolding-initial-code-and-file-structure)
- [Scaffolding Schema and Model Definitions](#scaffolding-schema-and-model-definitions)
- [Documentation Best Practices](#documentation-best-practices)
- [Creating Resource and Data source Documentation](#creating-resource-and-data-source-documentation)
- [Discovering New API features](#discovering-new-api-features)


Expand Down Expand Up @@ -360,6 +361,18 @@ Note: if the resulting file paths already exist the content will be stored in fi

- In our documentation, when a resource field allows a maximum of only one item, we do not format that field as an array. Instead, we create a subsection specifically for this field. Within this new subsection, we enumerate all the attributes of the field. Let's illustrate this with an example: [cloud_backup_schedule.html.markdown](https://github.com/mongodb/terraform-provider-mongodbatlas/blob/master/website/docs/r/cloud_backup_schedule.html.markdown?plain=1#L207)

### Creating Resource and Data source Documentation
We autogenerate the documentation of our provider resources and data sources via [tfplugindocs](https://github.com/hashicorp/terraform-plugin-docs).

#### How to generate the documentation for a resource
- Make sure that the resource and data source schemas have defined the fields `MarkdownDescription` and `Description`.
- We recommend to use [Scaffolding Schema and Model Definitions](#scaffolding-schema-and-model-definitions) to autogenerate the schema via the Open API specification.
- Add the resource/data source templates to the [templates](templates) folder. See [README.md](templates/README.md) for more info.
- Run the Makefile command `generate-doc`
```bash
export resource_name=search_deployment && make generate-doc
```

## Discovering New API features

Most of the new features of the provider are using [atlas-sdk](https://github.com/mongodb/atlas-sdk-go)
Expand Down
2 changes: 1 addition & 1 deletion scripts/generate-doc.sh
Expand Up @@ -32,7 +32,7 @@

set -euo pipefail

TF_VERSION="${TF_VERSION:-"1.6"}" # TF version to use when running tfplugindocs. Default: 1.6.6
TF_VERSION="${TF_VERSION:-"1.6"}" # TF version to use when running tfplugindocs. Default: 1.6
TEMPLATE_FOLDER_PATH="${TEMPLATE_FOLDER_PATH:-"templates"}" # PATH to the templates folder. Default: templates


Expand Down

0 comments on commit b3c5402

Please sign in to comment.