terraform-provider-docker icon indicating copy to clipboard operation
terraform-provider-docker copied to clipboard

Change `docker_image` resource id to image id and support import

Open suzuki-shunsuke opened this issue 4 years ago • 1 comments

  • resource: docker_image
  • attribute: id

AS IS

https://github.com/kreuzwerker/terraform-provider-docker/blob/6b0f977735dbc2ff99faa9278f4d51f2bf077b02/internal/provider/resource_docker_image_funcs.go#L75

The value of id is ${image digest}${image name}.

e.g. sha256:bfba26ca350c153700592ebd7e4613f25a7a8779289e041eb68a97623277de82nginx:1.17.0-alpine

          "attributes": {
            "build": [],
            "force_remove": null,
            "id": "sha256:bfba26ca350c153700592ebd7e4613f25a7a8779289e041eb68a97623277de82nginx:1.17.0-alpine",
            "keep_locally": null,
            "latest": "sha256:bfba26ca350c153700592ebd7e4613f25a7a8779289e041eb68a97623277de82",
            "name": "nginx:1.17.0-alpine",
            "output": null,
            "pull_trigger": null,
            "pull_triggers": null
          }

The format is dirty and it is difficult to import the resource.

TO BE

The id should be the image id, and docker_image can be imported by the name attribute.

suzuki-shunsuke avatar Mar 26 '21 14:03 suzuki-shunsuke

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days. If you don't want this issue to be closed, please set the label pinned.

github-actions[bot] avatar May 26 '21 10:05 github-actions[bot]