terraform-provider-digitalocean
terraform-provider-digitalocean copied to clipboard
changing the `droplet_agent` parameter does not impact digitalocean_droplet state
Bug Report
Describe the bug
After creating a digitalocean_droplet
resource with the minimal required arguments, if I add droplet_agent = false
to the resource, Terraform reports the resource state matches the configuration and performs no actions.
Affected Resource(s)
- digitalocean_droplet
Expected Behavior
Flipping droplet-agent
to false
indicates a user does not want the agent running on their infrastructure. This is a systemd service the user can remove, but since that is out of the scope of Terraform, I think the better expected behavior when changing this parameter in the Terraform resource would be to mark the resource as tainted and therefore must be replaced, so the server can be recreated without the agent component.
Actual Behavior
No changes. Your infrastructure matches the configuration.
Steps to Reproduce
Terraform Configuration Files
resource "digitalocean_droplet" "test" {
image = "ubuntu-22-04-x64"
name = "example"
region = "nyc3"
size = "s-1vcpu-1gb-amd"
# First run an apply without defining this parameter, then uncomment this line and run apply again
# droplet_agent = false
# For the purposes of this example code, just generating a random ssh key
ssh_keys = [digitalocean_ssh_key.test.fingerprint]
}
resource "digitalocean_ssh_key" "test" {
name = "random"
public_key = trimspace(tls_private_key.test.public_key_openssh)
}
resource "tls_private_key" "test" {
algorithm = "ED25519"
ecdsa_curve = "P256"
}
output "test_ip" {
value = digitalocean_droplet.test.ipv4_address
}
Expected behavior
If droplet_agent
was set to true or left to its default (true), the server is created, and then the parameter is set to false
, the resource should be recreated.
terraform -v
Terraform v1.2.6
on linux_amd64
+ provider registry.terraform.io/digitalocean/digitalocean v2.21.0
+ provider registry.terraform.io/hashicorp/tls v3.4.0
Debug Output
Panic Output
Additional context
Important Factoids
References