Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changes/unreleased/FEATURES-20250819-133400.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
kind: FEATURES
body: 'generate: Support multiple configuration example files in default templates'
time: 2025-08-19T13:34:00.429551-04:00
custom:
Issue: "508"
40 changes: 23 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -223,17 +223,17 @@ For examples:
> **NOTE:** In the following conventional paths for examples, `<data source name>` and `<resource name>` include the provider prefix as well, but the provider prefix is **NOT** included in`<function name>`.
> For example, the data source [`caller_identity`](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) in the `aws` provider would have an "example" conventional path of: `examples/data-sources/aws_caller_identity/data-source.tf`

| Path | Description |
|---------------------------------------------------------------------------|--------------------------------------------|
| `examples/` | Root of examples |
| `examples/provider/provider.tf` | Provider example config |
| `examples/data-sources/<data source name>/data-source.tf` | Data source example config |
| `examples/ephemeral-resources/<ephemeral resource>/ephemeral-resource.tf` | Ephemeral resource example config |
| `examples/functions/<function name>/function.tf` | Function example config |
| `examples/resources/<resource name>/resource.tf` | Resource example config |
| `examples/resources/<resource name>/import.sh` | Resource example import command |
| `examples/resources/<resource name>/import-by-string-id.tf` | Resource example import by id config |
| `examples/resources/<resource name>/import-by-identity.tf` | Resource example import by identity config |
| Path | Description |
|------------------------------------------------------------------------------|--------------------------------------------|
| `examples/` | Root of examples |
| `examples/provider/provider<*>.tf` | Provider example config(s) |
| `examples/data-sources/<data source name>/data-source<*>.tf` | Data source example config(s) |
| `examples/ephemeral-resources/<ephemeral resource>/ephemeral-resource<*>.tf` | Ephemeral resource example config(s) |
| `examples/functions/<function name>/function<*>.tf` | Function example config(s) |
| `examples/resources/<resource name>/resource<*>.tf` | Resource example config(s) |
| `examples/resources/<resource name>/import.sh` | Resource example import command |
| `examples/resources/<resource name>/import-by-string-id.tf` | Resource example import by id config |
| `examples/resources/<resource name>/import-by-identity.tf` | Resource example import by identity config |

#### Migration

Expand Down Expand Up @@ -285,8 +285,10 @@ using the following data fields and functions:
| Field | Type | Description |
|-------------------------|--------|-------------------------------------------------------------------------------------------|
| `.Description` | string | Provider description |
| `.HasExample` | bool | Is there an example file? |
| `.ExampleFile` | string | Path to the file with the terraform configuration example |
| `.HasExample` | bool | (Legacy) Is there an example file? |
| `.HasExamples` | bool | Are there example files? Always true if HasExample is true. |
| `.ExampleFile` | string | (Legacy) Path to the file with the Terraform configuration example. |
| `.ExampleFiles` | string | Paths to the files with the Terraform configuration example. Includes ExampleFile. |
| `.ProviderName` | string | Canonical provider name (ex. `terraform-provider-random`) |
| `.ProviderShortName` | string | Short version of the rendered provider name (ex. `random`) |
| `.RenderedProviderName` | string | Value provided via argument `--rendered-provider-name`, otherwise same as `.ProviderName` |
Expand All @@ -299,8 +301,10 @@ using the following data fields and functions:
| `.Name` | string | Name of the resource/data-source (ex. `tls_certificate`) |
| `.Type` | string | Either `Resource` or `Data Source` |
| `.Description` | string | Resource / Data Source description |
| `.HasExample` | bool | Is there an example file? |
| `.ExampleFile` | string | Path to the file with the terraform configuration example |
| `.HasExample` | bool | (Legacy) Is there an example file? |
| `.HasExamples` | bool | Are there example files? Always true if HasExample is true. |
| `.ExampleFile` | string | (Legacy) Path to the file with the Terraform configuration example. |
| `.ExampleFiles` | string | Paths to the files with Terraform configuration examples. Includes ExampleFile. |
| `.HasImport` | bool | Is there an import shell file? (`terraform import` shell example) |
| `.ImportFile` | string | Path to the file with the command for importing the resource |
| `.HasImportIDConfig` | bool | Is there an import terraform config file? (`import` block example with `id`) |
Expand All @@ -321,8 +325,10 @@ using the following data fields and functions:
| `.Type` | string | Returns `Function` |
| `.Description` | string | Function description |
| `.Summary` | string | Function summary |
| `.HasExample` | bool | Is there an example file? |
| `.ExampleFile` | string | Path to the file with the terraform configuration example |
| `.HasExample` | bool | (Legacy) Is there an example file? |
| `.HasExamples` | bool | Are there example files? Always true if HasExample is true. |
| `.ExampleFile` | string | (Legacy) Path to the file with the Terraform configuration example |
| `.ExampleFiles` | string | Paths to the files with Terraform configuration examples. Includes ExampleFile. |
| `.ProviderName` | string | Canonical provider name (ex. `terraform-provider-random`) |
| `.ProviderShortName` | string | Short version of the rendered provider name (ex. `random`) |
| `.RenderedProviderName` | string | Value provided via argument `--rendered-provider-name`, otherwise same as `.ProviderName` |
Expand Down
Loading