From 454dbdc9cfe299cb78d09cc7a86d258439d60f33 Mon Sep 17 00:00:00 2001 From: DanK <4129589+danktec@users.noreply.github.com> Date: Sat, 3 Feb 2024 07:25:16 +1000 Subject: [PATCH] Error out with a message if the user tries to disable IPv6 on a droplet (#1105) * Update resource_droplet.go * Use ForceNewIfChange to force replacement * remove line space --- digitalocean/droplet/resource_droplet.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/digitalocean/droplet/resource_droplet.go b/digitalocean/droplet/resource_droplet.go index 93651c9a5..747a9115c 100644 --- a/digitalocean/droplet/resource_droplet.go +++ b/digitalocean/droplet/resource_droplet.go @@ -237,6 +237,13 @@ func ResourceDigitalOceanDroplet() *schema.Resource { return d.Get("ipv6").(bool) }), ), + // Forces replacement when IPv6 has attribute changes to `false` + // https://github.com/digitalocean/terraform-provider-digitalocean/issues/1104 + customdiff.ForceNewIfChange("ipv6", + func(ctx context.Context, old, new, meta interface{}) bool { + return old.(bool) && !new.(bool) + }, + ), ), } }