terraform-provider-lxd
terraform-provider-lxd copied to clipboard
Explicitly defining `remote` on Instance triggers re-creation (even if it matches the default)
Example:
provider "lxd" {
remote {
name = "lxd1"
default = true
}
}
resource "lxd_instance" "instance1" {
name = "instance1"
image = "ubuntu:22.04"
}
Steps to reproduce:
- Change definition of lxd_instance.instance1 to explicitly define
remote = "lxd1"
- Run
terraform apply
Expected result: Apply should be a no-op, because we are asking for the instance to be deployed where it already is
Actual result: Terraform plans to recreate the instance
Additional info: The remote
attribute currently has RequiresReplace()
, but this should probably be more specific. target
, for example, is RequiresReplaceIfConfigured()
(which would fix the issue). However, does that mean a change wouldn't be triggered if e.g. the value was changed from not-configured (i.e. the default) to a non-default configured value?