hashicorp / terraform-provider-consul

Terraform Consul provider
https://www.terraform.io/docs/providers/consul/
Mozilla Public License 2.0
124 stars 112 forks source link

Allow importing consul nodes #323

Closed marceloboeira closed 1 year ago

marceloboeira commented 2 years ago

It seems the import function is overall "necessary" since creating a node that already exists ends up updating it / binding it to the terraform resource. But I could also not find strong reasons NOT to allow import since it facilitates a more standard and "terraform compliant" workflow when migrating things from consul configs to terraform.

I have tested both using $name-$address and simply $name, but it seems unnecessary, at first, to use the address since the only logical isolations possible would be namespace/datacenter.

remilapeyre commented 1 year ago

Hi @marceloboeira, as you mentioned the consul_node resource actually does not need import support due to its behaviour: just creating a new resource will work and replace the current node configuration just like importing it would.

I understand that this may be confusing as it may not be what some users may be expecting so it makes sense to make it also possible to imported.

Thanks for this PR!