speakeasy
speakeasy copied to clipboard
[SPE-3152] Automatically generate `import.sh` file to include documentation instructions for adding `id` field via the `import` block in Terraform
@ThomasRooney said:
The docs only get automatically added in when there's an
import.shadded toexamples/resources/*/import.shwith instructions.Though it's a good idea for speakeasy's generator to automatically make this file. It's a gap I didn't really notice before (or forgot about). Making a note to do that for end-users.
Generally the
idfield is used. It's referenced in theImportStatepart off the resource.func (r **YourResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp **resource.ImportStateResponse) { resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("id"), req.ID)...) }And a user adds it in via the
importblock https://developer.hashicorp.com/terraform/language/import/generating-configuration#1-add-the-import-blockImport - Generating Configuration | Terraform | HashiCorp Developer
From SyncLinear.com | SPE-3152