Skip to content

Document Terraform import for every provider resource #16

Description

@kavalerov

Problem

Import is implemented but undocumented, so people assume it doesn't work. Every one of the 20 resources in the provider implements ImportState, yet none of the 20 pages in docs/resources/ mentions import at all. The GitHub issue this came from shows the cost: someone tried terraform import 'module.ably-app["stage-us"].ably_app.app' 'stage-us' and hit an error, because nothing told them what identifier format to use.

So the remaining work is documentation, not implementation.

Context

Two identifier shapes exist:

  • ably_app uses resource.ImportStatePassthroughID on id (internal/provider/resource_ably_app.go:530-532), so the app id alone.
  • Everything else uses the shared ImportResource helper (internal/provider/rules.go:987-1009), which splits the identifier on commas and maps the parts to named attributes in order. ably_key calls it as ImportResource(ctx, req, resp, "app_id", "id"), so <app_id>,<key_id>. The helper errors with the expected format when the part count doesn't match, which is a good message nobody currently sees before making the mistake.

The repository is ably/terraform-provider-ably; this ticket is a Unito mirror of GitHub issue 16 and is also tracked as SDK-3017.

Acceptance criteria

  • Each resource page in docs/resources/ has an import section giving the identifier format and a working example command
  • The composite format is spelled out, including that the separator is a comma and the order matters
  • ably_app's single-value form is distinguished from the composite ones, so the difference is not something to infer
  • An import of an app and of a key is actually run against a real app before the docs claim it works
  • The provider docs index mentions that resources support import, so the pages are discoverable

Scope

  • In scope: documentation for the existing import support, and verifying it behaves as documented
  • Out of scope: adding import to anything that lacks it (nothing does), changing identifier formats, and the other provider bugs

Pointers

  • internal/provider/rules.go:987 - the shared ImportResource helper and its format
  • internal/provider/resource_ably_app.go:530 - the passthrough case
  • internal/provider/resource_ably_key.go:380 - a composite example
  • docs/resources/ - the 20 pages to update
  • GitHub issue 16, and SDK-3017

┆Issue is synchronized with this Jira Task by Unito

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions