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

Import aptible resources under terraform management #100

Open
ilokhvytska-medrhythms opened this issue May 19, 2023 · 1 comment
Open

Import aptible resources under terraform management #100

ilokhvytska-medrhythms opened this issue May 19, 2023 · 1 comment

Comments

@ilokhvytska-medrhythms
Copy link

terraform import -input=false -var-file=environ/dev/terraform.tfvars aptible_database.coretx-psql coretx-dev-psql

Result:

╷
│ Error: nil entry in ImportState results. This is always a bug with
│ the resource that is being imported. Please report this as
│ a bug to Terraform.
│ 
│ 
╵

I tried differend combination, like env_id/db_id, env_id:db_id, env_name/db_name, env_name:db_name.

@madhuravius
Copy link
Contributor

Sorry to hear you're having some issues with this. Maybe it's the id you're using (the id by itself), it should be a number?

I was able to test and import doing the following with a sample test script. I followed these instructions

relevant portion of my TF file

resource "aptible_database" "pg" {
  env_id = data.aptible_environment.example.env_id
  handle = "example"
  database_type = "postgresql"
  container_size = 512
  disk_size = 10
}

i created it:

terraform plan
terraform apply

then i removed it from my local state

terraform state rm aptible_database.pg
cat terraform.tfstate
# verified it is no longer in my state file

terraform import aptible_database.pg 106610 # got the ID from the dashboard

and it worked without issue:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants