Skip to content

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

Merged
merged 8 commits into from
Jun 30, 2025

Conversation

austinvalle
Copy link
Member

@austinvalle austinvalle commented Jun 16, 2025

Related Issue

Closes #472

Some of the acceptance tests I updated used the scaffolding repo, which doesn't have import shell examples in the repo, so I added those here: hashicorp/terraform-provider-scaffolding-framework#306

We probably should add some import configs as well once we release this 👍🏻

Description

This PR adds support for defining an example import TF configuration file in the same location as the existing import.sh file:

  • examples/resources/<resource name>/import-by-string-id.tf

I'm intentionally choosing the id suffix following import because identity should probably be it's own config file (import-by-identity.tf for example). Since it has a different TF version requirement and can live next to the other import methods.

Rollback Plan

  • If a change needs to be reverted, we will roll out an update to the code within 7 days.

Changes to Security Controls

No

@austinvalle austinvalle added this to the v0.22.0 milestone Jun 16, 2025
@austinvalle austinvalle added enhancement New feature or request command/generate labels Jun 16, 2025
@austinvalle austinvalle changed the title generate: Add generate: Add support for import configuration examples with the id attribute Jun 16, 2025
| `.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 |
Copy link
Member Author

@austinvalle austinvalle Jun 17, 2025

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 😄

@austinvalle austinvalle marked this pull request as ready for review June 17, 2025 21:39
@austinvalle austinvalle requested a review from a team as a code owner June 17, 2025 21:39
SBGoods
SBGoods previously approved these changes Jun 18, 2025
Copy link
Contributor

@SBGoods SBGoods left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change looks good to me overall, just left a comment about the file naming

@austinvalle austinvalle merged commit 3b9b212 into main Jun 30, 2025
6 checks passed
@austinvalle austinvalle deleted the av/import-tf branch June 30, 2025 18:31
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 31, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
command/generate enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support import block feature
2 participants