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

[SPE-3152] Automatically generate import.sh file to include documentation instructions for adding id field via the import block in Terraform #564

Open
ThomasRooney opened this issue Mar 25, 2024 · 0 comments
Labels
terraform Created by Linear-GitHub Sync

Comments

@ThomasRooney
Copy link
Member

@ThomasRooney said:

The docs only get automatically added in when there's an import.sh added to examples/resources/*/import.sh with 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 id field is used. It's referenced in the ImportState part 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 import block https://developer.hashicorp.com/terraform/language/import/generating-configuration#1-add-the-import-block

Import - Generating Configuration | Terraform | HashiCorp Developer

From SyncLinear.com | SPE-3152

@ThomasRooney ThomasRooney added this to the Opal Implementation milestone Mar 26, 2024
@ThomasRooney ThomasRooney removed this from the Opal Implementation milestone Apr 2, 2024
@ThomasRooney ThomasRooney added the terraform Created by Linear-GitHub Sync label Apr 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
terraform Created by Linear-GitHub Sync
Projects
None yet
Development

No branches or pull requests

1 participant