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

Introduce `terraform import` #2

Merged
merged 2 commits into from Sep 13, 2018

Conversation

Projects
2 participants
@masutaka
Copy link
Collaborator

commented Sep 9, 2018

Hi @kristofferahl,

I've been able to easily implement terraform import.

You can check as follows,

Click
$ cat test.tf
resource "healthchecksio_check" "my_first_check" {
  # (resource arguments)
}


$ terraform import healthchecksio_check.my_first_check 760ca858-576a-432b-8b1f-378049d7ce96
healthchecksio_check.my_first_check: Importing from ID "760ca858-576a-432b-8b1f-378049d7ce96"...
healthchecksio_check.my_first_check: Import complete!
  Imported healthchecksio_check (ID: 760ca858-576a-432b-8b1f-378049d7ce96)
healthchecksio_check.my_first_check: Refreshing state... (ID: 760ca858-576a-432b-8b1f-378049d7ce96)

Import successful!

The resources that were imported are shown above. These resources are now in
your Terraform state and will henceforth be managed by Terraform.

# Edit test.tf
$ cat test.tf
resource "healthchecksio_check" "my_first_check" {
  name = "My First Check"

  timeout = "${1 * 24 * 60 * 60}"
  grace   = "${1 * 60 * 60}"
}

Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but will not be
persisted to local or remote state storage.

healthchecksio_check.my_first_check: Refreshing state... (ID: 760ca858-576a-432b-8b1f-378049d7ce96)

------------------------------------------------------------------------

No changes. Infrastructure is up-to-date.

This means that Terraform did not detect any differences between your
configuration and real physical resources that exist. As a result, no
actions need to be performed.

$ terraform apply
healthchecksio_check.my_first_check: Refreshing state... (ID: 760ca858-576a-432b-8b1f-378049d7ce96)

Apply complete! Resources: 0 added, 0 changed, 0 destroyed.

I referred to the following.

@kristofferahl

This comment has been minimized.

Copy link
Owner

commented Sep 10, 2018

Awesome... I'll have a look at it sometime this week.
Thanks again @masutaka !

@kristofferahl kristofferahl merged commit 5184211 into kristofferahl:master Sep 13, 2018

@masutaka masutaka deleted the masutaka:terraform-import branch Sep 13, 2018

@kristofferahl

This comment has been minimized.

Copy link
Owner

commented Sep 13, 2018

@masutaka

This comment has been minimized.

Copy link
Collaborator Author

commented Sep 13, 2018

Thanks a lot! I just tried terraform import using v1.1.0. LGTM 👍

@kristofferahl kristofferahl added this to Done in Work Jun 18, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.