-
Notifications
You must be signed in to change notification settings - Fork 74
generate: Add support for import
configuration examples with the id
attribute
#495
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
Open
austinvalle
wants to merge
8
commits into
main
Choose a base branch
from
av/import-tf
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
a45a6f8
quick impl
austinvalle 80cc546
add ID prefix
austinvalle 29d7b9b
template update
austinvalle 73ae525
add changelog
austinvalle 23b2de7
add import shell test
austinvalle d6597c2
update acceptance tests and add some import config files
austinvalle c203513
update naming
austinvalle 109a6c1
update changelog
austinvalle File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
kind: FEATURES | ||
body: 'generate: Added support for defining import example file (`import-by-string-id.tf`) using Terraform configuration and the `id` attribute' | ||
time: 2025-06-16T18:13:22.627319-04:00 | ||
custom: | ||
Issue: "472" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -223,15 +223,16 @@ 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 | | ||
| 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 | | ||
|
||
#### Migration | ||
|
||
|
@@ -280,31 +281,33 @@ using the following data fields and functions: | |
|
||
##### Provider Fields | ||
|
||
| 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 | | ||
| `.ProviderName` | string | Canonical provider name (ex. `terraform-provider-random`) | | ||
| `.ProviderShortName` | string | Short version of the rendered provider name (ex. `random`) | | ||
| 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 | | ||
| `.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` | | ||
| `.SchemaMarkdown` | string | a Markdown formatted Provider Schema definition | | ||
| `.SchemaMarkdown` | string | a Markdown formatted Provider Schema definition | | ||
|
||
##### Managed Resource / Ephemeral Resource / Data Source Fields | ||
|
||
| Field | Type | Description | | ||
|------------------------:|:------:|-------------------------------------------------------------------------------------------| | ||
| `.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 | | ||
| `.HasImport` | bool | Is there an import file? | | ||
| `.ImportFile` | string | Path to the file with the command for importing the resource | | ||
| `.ProviderName` | string | Canonical provider name (ex. `terraform-provider-random`) | | ||
| `.ProviderShortName` | string | Short version of the rendered provider name (ex. `random`) | | ||
| Field | Type | Description | | ||
|-------------------------|--------|-------------------------------------------------------------------------------------------| | ||
| `.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 | | ||
| `.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`) | | ||
| `.ImportIDConfigFile` | string | Path to the file with the Terraform configuration for importing the resource by `id` | | ||
Comment on lines
+305
to
+306
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The naming/duplication is unfortunate, but these variables are an exposed interface that we should avoid breaking |
||
| `.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` | | ||
| `.SchemaMarkdown` | string | a Markdown formatted Resource / Data Source Schema definition | | ||
| `.SchemaMarkdown` | string | a Markdown formatted Resource / Data Source Schema definition | | ||
|
||
##### Provider-defined Function Fields | ||
|
||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This diff is much cleaner if you hide whitespace in the GitHub UI PR settings 😄