akshaykarle / terraform-provider-mongodbatlas

Terraform provider for MongoDB Atlas
Mozilla Public License 2.0
122 stars 54 forks source link

feat(project): implement project import #96

Closed Ameausoone closed 5 years ago

Ameausoone commented 5 years ago

Hello,

I implement project import, and I had acceptance test. It closes #51

But I couldn't make acceptance tests worked on my computer for project resource.

I try my code manually, it worked, but when I run test acceptance I got this :

` === RUN TestAccProject_importBasic --- FAIL: TestAccProject_importBasic (2.23s) testing.go:568: Step 0 error: After applying this step, the plan was not empty:

    DIFF:

    DESTROY/CREATE: mongodbatlas_project.test
      cluster_count: "0" => "<computed>"
      created:       "2019-06-29T20:09:36Z" => "<computed>"
      id:            "5d17c57fa6f239a99dd3c355" => "<computed>"
      name:          "test" => "test"
      org_id:        "5d17c57fa6f239a99dd3c356" => "" (forces new resource)

    STATE:

    mongodbatlas_project.test:
      ID = 5d17c57fa6f239a99dd3c355
      provider = provider.mongodbatlas
      cluster_count = 0
      created = 2019-06-29T20:09:36Z
      name = test
      org_id = 5d17c57fa6f239a99dd3c356
testing.go:629: Error destroying resource! WARNING: Dangling resources
    may exist. The full state and error is shown below.

    Error: Check failed: projects "5d17c57fa6f239a99dd3c355" still exists

    State: <no state>

FAIL `

But when I run basic acceptance test, I got the same issue :

` === RUN TestAccMongodbatlasProject_basic --- FAIL: TestAccMongodbatlasProject_basic (2.87s) testing.go:568: Step 0 error: After applying this step, the plan was not empty:

    DIFF:

    DESTROY/CREATE: mongodbatlas_project.test
      cluster_count: "0" => "<computed>"
      created:       "2019-06-29T20:10:58Z" => "<computed>"
      id:            "5d17c5d2c56c981a2afdeeee" => "<computed>"
      name:          "testAcc" => "testAcc"
      org_id:        "5d17c5d2c56c981a2afdeeef" => "" (forces new resource)

    STATE:

    mongodbatlas_project.test:
      ID = 5d17c5d2c56c981a2afdeeee
      provider = provider.mongodbatlas
      cluster_count = 0
      created = 2019-06-29T20:10:58Z
      name = testAcc
      org_id = 5d17c5d2c56c981a2afdeeef

FAIL ` I don't understand why(and how) terraform plan determine that "org_id" should be empty ?

Ameausoone commented 5 years ago

OK I just found the issue, I will fix this in the PR.

Ameausoone commented 5 years ago

Sorry, I'm discovering terraform, the acceptance test framework and golang, I see that project import works through "ImportStatePassthrough". So I close my PR ^^