Skip to content

Commit 97bd6c7

Browse files
SBGoodsaustinvalle
andauthored
all: add support for ephemeral resources (#415)
* Update `generate` subcommand to support ephemeral resources * Update `validate` subcommand to support ephemeral resources * Update `migrate` subcommand to support ephemeral resources * Update README.md * Add changelog entries * Update README.md Co-authored-by: Austin Valle <[email protected]> --------- Co-authored-by: Austin Valle <[email protected]>
1 parent 6c67ef2 commit 97bd6c7

34 files changed

+2366
-517
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
kind: FEATURES
2+
body: 'generate: Add support for ephemeral resources'
3+
time: 2024-10-31T10:08:33.606686-04:00
4+
custom:
5+
Issue: "415"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
kind: FEATURES
2+
body: 'migrate: Add support for ephemeral resources'
3+
time: 2024-10-31T10:09:04.175251-04:00
4+
custom:
5+
Issue: "415"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
kind: FEATURES
2+
body: 'validate: Add support for ephemeral resources'
3+
time: 2024-10-31T10:09:19.716278-04:00
4+
custom:
5+
Issue: "415"

README.md

+41-35
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ When you run `tfplugindocs`, by default from the root directory of a provider co
112112
* Generate resource template files, if missing
113113
* Generate data source template files, if missing
114114
* Generate function template files, if missing (Requires Terraform v1.8.0+)
115+
* Generate ephemeral resource template files, if missing (Requires Terraform v1.10.0+)
115116
* Copy all non-template files to the output website directory
116117
* Process all the remaining templates to generate files for the output website directory
117118
@@ -193,16 +194,18 @@ For templates:
193194
194195
> **NOTE:** In the following conventional paths for templates, `<data source name>`, `<resource name>`, and `<function name>` do not include the provider prefix.
195196
196-
| Path | Description |
197-
|-------------------------------------------------------|----------------------------------------|
198-
| `templates/` | Root of templated docs |
199-
| `templates/index.md[.tmpl]` | Docs index page (or template) |
200-
| `templates/data-sources.md[.tmpl]` | Generic data source page (or template) |
201-
| `templates/data-sources/<data source name>.md[.tmpl]` | Data source page (or template) |
202-
| `templates/functions.md[.tmpl]` | Generic function page (or template) |
203-
| `templates/functions/<function name>.md[.tmpl]` | Function page (or template) |
204-
| `templates/resources.md[.tmpl]` | Generic resource page (or template) |
205-
| `templates/resources/<resource name>.md[.tmpl]` | Resource page (or template) |
197+
| Path | Description |
198+
|--------------------------------------------------------------------|-----------------------------------------------|
199+
| `templates/` | Root of templated docs |
200+
| `templates/index.md[.tmpl]` | Docs index page (or template) |
201+
| `templates/data-sources.md[.tmpl]` | Generic data source page (or template) |
202+
| `templates/data-sources/<data source name>.md[.tmpl]` | Data source page (or template) |
203+
| `templates/ephemeral-resources.md[.tmpl]` | Generic ephemeral resource page (or template) |
204+
| `templates/ephemeral-resources/<ephemeral resource name>.md[.tmpl]` | Ephemeral resource page (or template) |
205+
| `templates/functions.md[.tmpl]` | Generic function page (or template) |
206+
| `templates/functions/<function name>.md[.tmpl]` | Function page (or template) |
207+
| `templates/resources.md[.tmpl]` | Generic resource page (or template) |
208+
| `templates/resources/<resource name>.md[.tmpl]` | Resource page (or template) |
206209
207210
Note: the `.tmpl` extension is necessary, for the file to be correctly handled as a template.
208211
@@ -211,14 +214,15 @@ For examples:
211214
> **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>`.
212215
> 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`
213216
214-
| Path | Description |
215-
|-----------------------------------------------------------|---------------------------------|
216-
| `examples/` | Root of examples |
217-
| `examples/provider/provider.tf` | Provider example config |
218-
| `examples/data-sources/<data source name>/data-source.tf` | Data source example config |
219-
| `examples/functions/<function name>/function.tf` | Function example config |
220-
| `examples/resources/<resource name>/resource.tf` | Resource example config |
221-
| `examples/resources/<resource name>/import.sh` | Resource example import command |
217+
| Path | Description |
218+
|---------------------------------------------------------------------------|-----------------------------------|
219+
| `examples/` | Root of examples |
220+
| `examples/provider/provider.tf` | Provider example config |
221+
| `examples/data-sources/<data source name>/data-source.tf` | Data source example config |
222+
| `examples/ephemeral-resources/<ephemeral resource>/ephemeral-resource.tf` | Ephemeral resource example config |
223+
| `examples/functions/<function name>/function.tf` | Function example config |
224+
| `examples/resources/<resource name>/resource.tf` | Resource example config |
225+
| `examples/resources/<resource name>/import.sh` | Resource example import command |
222226
223227
#### Migration
224228
@@ -229,25 +233,27 @@ The `migrate` subcommand assumes the following conventional paths for the render
229233
230234
Legacy website directory structure:
231235
232-
| Path | Description |
233-
|-------------------------------------------------------|-----------------------------|
234-
| `website/` | Root of website docs |
235-
| `website/docs/guides` | Root of guides subdirectory |
236-
| `website/docs/index.html.markdown` | Docs index page |
237-
| `website/docs/d/<data source name>.html.markdown` | Data source page |
238-
| `website/docs/functons/<function name>.html.markdown` | Functions page |
239-
| `website/docs/r/<resource name>.html.markdown` | Resource page |
236+
| Path | Description |
237+
|----------------------------------------------------------------------------|-----------------------------|
238+
| `website/` | Root of website docs |
239+
| `website/docs/guides` | Root of guides subdirectory |
240+
| `website/docs/index.html.markdown` | Docs index page |
241+
| `website/docs/d/<data source name>.html.markdown` | Data source page |
242+
| `website/docs/ephemeral-resources/<ephemeral resource name>.html.markdown` | Ephemeral resource page |
243+
| `website/docs/functons/<function name>.html.markdown` | Functions page |
244+
| `website/docs/r/<resource name>.html.markdown` | Resource page |
240245
241246
Docs website directory structure:
242247
243-
| Path | Description |
244-
|------------------------------------------------------|-----------------------------|
245-
| `docs/` | Root of website docs |
246-
| `docs/guides` | Root of guides subdirectory |
247-
| `docs/index.html.markdown` | Docs index page |
248-
| `docs/data-sources/<data source name>.html.markdown` | Data source page |
249-
| `docs/functions/<function name>.html.markdown` | Function page |
250-
| `docs/resources/<resource name>.html.markdown` | Resource page |
248+
| Path | Description |
249+
|--------------------------------------------------------------------|-----------------------------|
250+
| `docs/` | Root of website docs |
251+
| `docs/guides` | Root of guides subdirectory |
252+
| `docs/index.html.markdown` | Docs index page |
253+
| `docs/data-sources/<data source name>.html.markdown` | Data source page |
254+
| `docs/ephemeral-resources/<ephemeral resource name>.html.markdown` | Ephemeral resource page |
255+
| `docs/functions/<function name>.html.markdown` | Function page |
256+
| `docs/resources/<resource name>.html.markdown` | Resource page |
251257
252258
Files named `index` (before the first `.`) in the website docs root directory and files in the `website/docs/d/`, `website/docs/r/`, `docs/data-sources/`,
253259
and `docs/resources/` subdirectories will be converted to `tfplugindocs` templates.
@@ -275,7 +281,7 @@ using the following data fields and functions:
275281
| `.RenderedProviderName` | string | Value provided via argument `--rendered-provider-name`, otherwise same as `.ProviderName` |
276282
| `.SchemaMarkdown` | string | a Markdown formatted Provider Schema definition |
277283
278-
##### Resources / Data Source Fields
284+
##### Managed Resource / Ephemeral Resource / Data Source Fields
279285
280286
| Field | Type | Description |
281287
|------------------------:|:------:|-------------------------------------------------------------------------------------------|

cmd/tfplugindocs/testdata/scripts/provider-build/generate/framework_provider_success_generic_templates.txtar

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ resource "scaffolding_example" fallback template exists, creating template
2626
generating missing data source content
2727
data-source "scaffolding_example" fallback template exists, creating template
2828
generating missing function content
29+
generating missing ephemeral resource content
2930
generating missing provider content
3031
provider "terraform-provider-scaffolding" template exists, skipping
3132
rendering static website

cmd/tfplugindocs/testdata/scripts/provider-build/generate/framework_provider_success_named_templates.txtar

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ resource "scaffolding_example" template exists, skipping
2626
generating missing data source content
2727
data-source "scaffolding_example" template exists, skipping
2828
generating missing function content
29+
generating missing ephemeral resource content
2930
generating missing provider content
3031
provider "terraform-provider-scaffolding" template exists, skipping
3132
rendering static website

cmd/tfplugindocs/testdata/scripts/provider-build/generate/framework_provider_success_no_templates.txtar

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ generating new template for "scaffolding_example"
2424
generating missing data source content
2525
generating new template for data-source "scaffolding_example"
2626
generating missing function content
27+
generating missing ephemeral resource content
2728
generating missing provider content
2829
generating new template for "terraform-provider-scaffolding"
2930
rendering static website

cmd/tfplugindocs/testdata/scripts/provider-build/generate/null_provider_success.txtar

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ resource "null_resource" fallback template exists, creating template
2323
generating missing data source content
2424
data-source "null_data_source" fallback template exists, creating template
2525
generating missing function content
26+
generating missing ephemeral resource content
2627
generating missing provider content
2728
provider "terraform-provider-null" template exists, skipping
2829
rendering static website

cmd/tfplugindocs/testdata/scripts/schema-json/generate/framework_provider_success_all_framework_types.txtar

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ generating new template for "scaffolding_example"
1919
generating missing data source content
2020
generating missing function content
2121
generating new template for function "scaffolding"
22+
generating missing ephemeral resource content
2223
generating missing provider content
2324
generating new template for "terraform-provider-scaffolding"
2425
rendering static website

0 commit comments

Comments
 (0)