You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
vultr_dns_domain.example_domain: Creating...
╷
│ Error: error while creating domain : {"error":"Unable to create domain: Domain already exists","status":400}
│
│ with vultr_dns_domain.example_domain,
│ on domain.tf line 39, in resource "vultr_dns_domain" "example_domain":
│ 39: resource "vultr_dns_domain" "example_domain" {
│
╵
To Reproduce
Steps to reproduce the behavior:
Create a domain in the Vultr control panel.
Declare the same domain in a Terraform file.
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:
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:
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.
optik-aper
changed the title
[BUG] - Declaring an already-existing domain is rejected, with no clear migration path
[QUESTION] - Declaring an already-existing domain is rejected, with no clear migration path
Mar 3, 2023
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 Terraformto 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
The text was updated successfully, but these errors were encountered: