Open io7m opened 1 year ago
Hello @io7m! Apologies for the slow response. Most resources can be imported into terraform state using the terraform import
process/command. Just to be sure I tested it out like so:
main.tf:
resource "vultr_dns_domain" "fake-domain" {
domain = "whattestvultr.dev"
}
data "vultr_dns_domain" "fake-data" {
domain = "whattestvultr.dev"
}
output "domain_date" {
value = data.vultr_dns_domain.fake-data.date_created
}
And then, import the existing domain into Terraform:
terraform import vultr_dns_domain.fake-domain whattestvultr.dev 1 ↵ 13:00
vultr_dns_domain.fake-domain: Importing from ID "whattestvultr.dev"...
vultr_dns_domain.fake-domain: Import prepared!
Prepared vultr_dns_domain for import
vultr_dns_domain.fake-domain: Refreshing state... [id=whattestvultr.dev]
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.
Finally, just check that the output shows:
Outputs:
domain_date = "2023-02-21T20:02:52+00:00"
That should cover your use case but let me know if not!
Describe the bug I'm not certain if this is a bug or a feature request.
I have a domain and a set of instances in Vultr, and I'm trying to seamlessly migrate to using Terraform to manage them. I have a domain, let's call it
example.com
, with a lot of records in it. I'm trying to migrate to using Terraform to manage the domain, so the first step has been to declare it in the Terraform file:Unfortunately,
terraform plan
then tries to create a plan that will create that domain, even though it already exists. Running the plan will fail as you might expect:To Reproduce Steps to reproduce the behavior:
terraform plan
terraform apply
Expected behavior I would expect Terraform to see that the domain already exists, and avoid creating it. It might create a plan to remove any records it doesn't know about, but that's not essential. In fact, it seems to be the general behavior of the Vultr provider to ignore extra values it doesn't know about (like extra VPS instances existing already).
Screenshots
Desktop (please complete the following information where applicable:
Additional context