go-gandi / terraform-provider-gandi

Terraform provider for the Gandi Domain services
Mozilla Public License 2.0
152 stars 45 forks source link

Importing a gandi_domain seems to require deprecated `nameservers` field #140

Open rvandegrift opened 1 year ago

rvandegrift commented 1 year ago

I imported a domain whose nameservers are pointed to cloudflare. It worked, but the provider imported the nameservers field on the gandi_domain resource. The config now triggers the deprecation warning. It'd be better to not import nameservers and require a second import for the associated gandi_nameservers.

But now I'm not really clear on how to fix it. I tried removing nameservers from my config and modifying the state data to make nameservers null. But terraform still thinks it should remove the existing nameservers - not sure why.

I also imported a domain with LiveDNS enabled, and it doesn't have this problem.

matthiasr commented 8 months ago

I had related issues with the nameservers field getting populated after I set nameservers with gandi_nameservers. Subsequently, Terraform wanted to unset it.

I worked around this with

  lifecycle {
    ignore_changes = [
      # "Error: domain owner contact update is currently not supported"
      owner,
      # The nameservers attribute is deprecated, but when creating nameservers
      # the new way, it is still populated on refresh, leading to a cycle of
      # diffs.
      nameservers,
    ]
  }

This causes Terraform to complain about use of a deprecated attribute, but at least it doesn't break my domain.