Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

all: add support for ephemeral resources #415

Merged
merged 6 commits into from
Nov 1, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
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-20241031-100833.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
kind: FEATURES
body: 'generate: Add support for ephemeral resources'
time: 2024-10-31T10:08:33.606686-04:00
custom:
Issue: "415"
5 changes: 5 additions & 0 deletions .changes/unreleased/FEATURES-20241031-100904.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
kind: FEATURES
body: 'migrate: Add support for ephemeral resources'
time: 2024-10-31T10:09:04.175251-04:00
custom:
Issue: "415"
5 changes: 5 additions & 0 deletions .changes/unreleased/FEATURES-20241031-100919.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
kind: FEATURES
body: 'validate: Add support for ephemeral resources'
time: 2024-10-31T10:09:19.716278-04:00
custom:
Issue: "415"
76 changes: 41 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ When you run `tfplugindocs`, by default from the root directory of a provider co
* Generate resource template files, if missing
* Generate data source template files, if missing
* Generate function template files, if missing (Requires Terraform v1.8.0+)
* Generate ephemeral resource template files, if missing (Requires Terraform v1.10.0+)
* Copy all non-template files to the output website directory
* Process all the remaining templates to generate files for the output website directory

Expand Down Expand Up @@ -193,16 +194,18 @@ For templates:

> **NOTE:** In the following conventional paths for templates, `<data source name>`, `<resource name>`, and `<function name>` do not include the provider prefix.

| Path | Description |
|-------------------------------------------------------|----------------------------------------|
| `templates/` | Root of templated docs |
| `templates/index.md[.tmpl]` | Docs index page (or template) |
| `templates/data-sources.md[.tmpl]` | Generic data source page (or template) |
| `templates/data-sources/<data source name>.md[.tmpl]` | Data source page (or template) |
| `templates/functions.md[.tmpl]` | Generic function page (or template) |
| `templates/functions/<function name>.md[.tmpl]` | Function page (or template) |
| `templates/resources.md[.tmpl]` | Generic resource page (or template) |
| `templates/resources/<resource name>.md[.tmpl]` | Resource page (or template) |
| Path | Description |
|--------------------------------------------------------------------|-----------------------------------------------|
| `templates/` | Root of templated docs |
| `templates/index.md[.tmpl]` | Docs index page (or template) |
| `templates/data-sources.md[.tmpl]` | Generic data source page (or template) |
| `templates/data-sources/<data source name>.md[.tmpl]` | Data source page (or template) |
| `templates/ephemeral-resources.md[.tmpl]` | Generic ephemeral resource page (or template) |
| `templates/ephemeral-rsources/<ephemeral resource name>.md[.tmpl]` | Ephemeral resource page (or template) |
SBGoods marked this conversation as resolved.
Show resolved Hide resolved
| `templates/functions.md[.tmpl]` | Generic function page (or template) |
| `templates/functions/<function name>.md[.tmpl]` | Function page (or template) |
| `templates/resources.md[.tmpl]` | Generic resource page (or template) |
| `templates/resources/<resource name>.md[.tmpl]` | Resource page (or template) |

Note: the `.tmpl` extension is necessary, for the file to be correctly handled as a template.

Expand All @@ -211,14 +214,15 @@ 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/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 |
| 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 |

#### Migration

Expand All @@ -229,25 +233,27 @@ The `migrate` subcommand assumes the following conventional paths for the render

Legacy website directory structure:

| Path | Description |
|-------------------------------------------------------|-----------------------------|
| `website/` | Root of website docs |
| `website/docs/guides` | Root of guides subdirectory |
| `website/docs/index.html.markdown` | Docs index page |
| `website/docs/d/<data source name>.html.markdown` | Data source page |
| `website/docs/functons/<function name>.html.markdown` | Functions page |
| `website/docs/r/<resource name>.html.markdown` | Resource page |
| Path | Description |
|----------------------------------------------------------------------------|-----------------------------|
| `website/` | Root of website docs |
| `website/docs/guides` | Root of guides subdirectory |
| `website/docs/index.html.markdown` | Docs index page |
| `website/docs/d/<data source name>.html.markdown` | Data source page |
| `website/docs/ephemeral-resources/<ephemeral resource name>.html.markdown` | Ephemeral resource page |
| `website/docs/functons/<function name>.html.markdown` | Functions page |
| `website/docs/r/<resource name>.html.markdown` | Resource page |

Docs website directory structure:

| Path | Description |
|------------------------------------------------------|-----------------------------|
| `docs/` | Root of website docs |
| `docs/guides` | Root of guides subdirectory |
| `docs/index.html.markdown` | Docs index page |
| `docs/data-sources/<data source name>.html.markdown` | Data source page |
| `docs/functions/<function name>.html.markdown` | Function page |
| `docs/resources/<resource name>.html.markdown` | Resource page |
| Path | Description |
|--------------------------------------------------------------------|-----------------------------|
| `docs/` | Root of website docs |
| `docs/guides` | Root of guides subdirectory |
| `docs/index.html.markdown` | Docs index page |
| `docs/data-sources/<data source name>.html.markdown` | Data source page |
| `docs/ephemeral-resources/<ephemeral resource name>.html.markdown` | Ephemeral resource page |
| `docs/functions/<function name>.html.markdown` | Function page |
| `docs/resources/<resource name>.html.markdown` | Resource page |

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/`,
and `docs/resources/` subdirectories will be converted to `tfplugindocs` templates.
Expand Down Expand Up @@ -275,7 +281,7 @@ using the following data fields and functions:
| `.RenderedProviderName` | string | Value provided via argument `--rendered-provider-name`, otherwise same as `.ProviderName` |
| `.SchemaMarkdown` | string | a Markdown formatted Provider Schema definition |

##### Resources / Data Source Fields
##### Managed Resource / Ephemeral Resource / Data Source Fields

| Field | Type | Description |
|------------------------:|:------:|-------------------------------------------------------------------------------------------|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ resource "scaffolding_example" fallback template exists, creating template
generating missing data source content
data-source "scaffolding_example" fallback template exists, creating template
generating missing function content
generating missing ephemeral resource content
generating missing provider content
provider "terraform-provider-scaffolding" template exists, skipping
rendering static website
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ resource "scaffolding_example" template exists, skipping
generating missing data source content
data-source "scaffolding_example" template exists, skipping
generating missing function content
generating missing ephemeral resource content
generating missing provider content
provider "terraform-provider-scaffolding" template exists, skipping
rendering static website
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ generating new template for "scaffolding_example"
generating missing data source content
generating new template for data-source "scaffolding_example"
generating missing function content
generating missing ephemeral resource content
generating missing provider content
generating new template for "terraform-provider-scaffolding"
rendering static website
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ resource "null_resource" fallback template exists, creating template
generating missing data source content
data-source "null_data_source" fallback template exists, creating template
generating missing function content
generating missing ephemeral resource content
generating missing provider content
provider "terraform-provider-null" template exists, skipping
rendering static website
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ generating new template for "scaffolding_example"
generating missing data source content
generating missing function content
generating new template for function "scaffolding"
generating missing ephemeral resource content
generating missing provider content
generating new template for "terraform-provider-scaffolding"
rendering static website
Expand Down
Loading