Skip to content

terraform-import failure: Cannot import non-existent remote object #647

@lens0021

Description

@lens0021

Terraform Version

Terraform v0.14.3
provider "registry.terraform.io/hashicorp/github" { version = "4.1.0" }

Affected Resource(s)

  • github_repository

Terraform Configuration Files

terraform {
  required_version = "~> 0.14.0"

  backend "remote" {
    organization = "femiwiki"

    workspaces {
      name = "github"
    }
  }

  required_providers {
    github = {
      source  = "hashicorp/github"
      version = "~> 4.0"
    }
  }
}

provider "github" {
  organization = "femiwiki"
}
resource "github_repository" "legunto" {
  name = "legunto"
  ...
}

Full configuration: https://github.com/femiwiki/infra/blob/50eb0673787a8cab88041876632e45b6df6a2a57/github/repo.tf#L465-L472

Debug Output

https://gist.github.com/lens0021/35d5e8997a389bfcd91fa6cc976d2fbc

Expected Behavior

A state which is created based on https://github.com/femiwiki/legunto is Imported successfully.

Actual Behavior

"Error: Cannot import non-existent remote object" is printed. See the debug output for details.

Steps to Reproduce

  1. Uncomment https://github.com/femiwiki/infra/blob/50eb0673787a8cab88041876632e45b6df6a2a57/github/repo.tf#L465-L472
  2. terraform import github_repository.legunto legunto

Important Factoids

Our team is using Terraform Cloud (https://app.terraform.io/).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions