Skip to content

Commit

Permalink
code review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
breathingdust committed Apr 25, 2023
1 parent 4e16531 commit 116b333
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .copywrite.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ project {
header_ignore = [
"internal/provider/generators/allschemas/*.hcl",
"examples/resources/*/import.sh",
"examples/resources/*/*.tf",
"examples/data-sources/*/*.tf",
".github/ISSUE_TEMPLATE/*.yml",
]
}
4 changes: 2 additions & 2 deletions contributing/add-examples-to-documentation.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Adding Examples to Generated Documentation

The Cloud Control provider is 100% generated from the AWS CloudFormation Schema *including* the documentation. This means that at the resource/attribute level any changes must be made in the CloudFormation Schema and cannot be modified within the provider itself. However examples can be added to the generated documentation in order to provide working examples or best practices when using the provider.
The Terraform AWS Cloud Control provider is 100% generated from the AWS CloudFormation Schema *including* the documentation. This means that at the resource/attribute level any changes must be made in the CloudFormation Schema and cannot be modified within the provider itself. However examples can be added to the generated documentation in order to provide working examples or best practices when using the provider.

The Terraform AWS Cloud Control provider uses [terraform-plugin-docs](https://github.com/hashicorp/terraform-plugin-docs) to generate the documentation found in the [Terraform Registry](https://registry.terraform.io/providers/hashicorp/awscc/latest/docs). Full details of the tool can be found on its GitHub repository. In summary, the tool uses the resource schema to generate and populate Terraform Registry compatible documentation.

Expand All @@ -17,7 +17,7 @@ To include an example for the `awscc_amplify_app` data source, simply add an exa
In order to include multiple examples, a new template must be provided to configure the format in which the examples should be displayed.

1. Create a new file in `template/resources` or `template/datasources` named the same as the resource/data source you want to add the template for. For example, to add a new template for the `awscc_ssmcontacts_plan` resource, you would create a file named `template/resources/ssm_contacts_plan.md.tmpl`.
2. As a starting point you can view the default template used by `terraform-plugin-go` [here](https://github.com/hashicorp/terraform-plugin-docs/blob/2385169af97e6ac8bb69446e70d4d4d4db74c9fc/internal/provider/template.go#L217)
2. As a starting point you can view the default template used by `terraform-plugin-docs` [here](https://github.com/hashicorp/terraform-plugin-docs/blob/2385169af97e6ac8bb69446e70d4d4d4db74c9fc/internal/provider/template.go#L217)
3. Make any changes to the template you wish (though for consistency most parts of the template should remain unchanged).
4. For each example, add a file in the examples folder: eg. `examples/resources/awscc_ssm_contacts_plan/example-one.tf`
5. Include `{{ tffile (printf "examples/resources/%s/example-one.tf" .Name)}}` so that [terraform-plugin-docs](https://github.com/hashicorp/terraform-plugin-docs) knows to pull in that examples when the documentation is generated.
Expand Down

0 comments on commit 116b333

Please sign in to comment.