diff --git a/digitalocean/droplet/resource_droplet.go b/digitalocean/droplet/resource_droplet.go index 747a9115c..a8ef851cc 100644 --- a/digitalocean/droplet/resource_droplet.go +++ b/digitalocean/droplet/resource_droplet.go @@ -471,6 +471,7 @@ func FindIPv4AddrByType(d *godo.Droplet, addrType string) string { func resourceDigitalOceanDropletUpdate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { client := meta.(*config.CombinedConfig).GodoClient() + var warnings []diag.Diagnostic id, err := strconv.Atoi(d.Id()) if err != nil { @@ -602,7 +603,6 @@ func resourceDigitalOceanDropletUpdate(ctx context.Context, d *schema.ResourceDa // As there is no way to disable IPv6, we only check if it needs to be enabled if d.HasChange("ipv6") && d.Get("ipv6").(bool) { _, _, err = client.DropletActions.EnableIPv6(context.Background(), id) - if err != nil { return diag.Errorf( "Error turning on ipv6 for droplet (%s): %s", d.Id(), err) @@ -616,6 +616,12 @@ func resourceDigitalOceanDropletUpdate(ctx context.Context, d *schema.ResourceDa return diag.Errorf( "Error waiting for ipv6 to be turned on for droplet (%s): %s", d.Id(), err) } + + warnings = append(warnings, diag.Diagnostic{ + Severity: diag.Warning, + Summary: "Enabling IPv6 requires additional OS-level configuration", + Detail: "When enabling IPv6 on an existing Droplet, additional OS-level configuration is required. For more info, see: \nhttps://docs.digitalocean.com/products/networking/ipv6/how-to/enable/#on-existing-droplets", + }) } if d.HasChange("tags") { @@ -661,7 +667,12 @@ func resourceDigitalOceanDropletUpdate(ctx context.Context, d *schema.ResourceDa } } - return resourceDigitalOceanDropletRead(ctx, d, meta) + readErr := resourceDigitalOceanDropletRead(ctx, d, meta) + if readErr != nil { + readErr = append(warnings, readErr...) + } + + return warnings } func resourceDigitalOceanDropletDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { diff --git a/docs/resources/droplet.md b/docs/resources/droplet.md index 2a71d02df..405c5fae2 100644 --- a/docs/resources/droplet.md +++ b/docs/resources/droplet.md @@ -34,10 +34,12 @@ The following arguments are supported: Defaults to false. If set to `true`, you can configure monitor alert policies [monitor alert resource](/providers/digitalocean/digitalocean/latest/docs/resources/monitor_alert) * `ipv6` - (Optional) Boolean controlling if IPv6 is enabled. Defaults to false. + Once enabled for a Droplet, IPv6 can not be disabled. When enabling IPv6 on + an existing Droplet, [additional OS-level configuration](https://docs.digitalocean.com/products/networking/ipv6/how-to/enable/#on-existing-droplets) + is required. * `vpc_uuid` - (Optional) The ID of the VPC where the Droplet will be located. * `private_networking` - (Optional) **Deprecated** Boolean controlling if private networking is enabled. This parameter has been deprecated. Use `vpc_uuid` instead to specify a VPC network for the Droplet. If no `vpc_uuid` is provided, the Droplet will be placed in your account's default VPC for the region. - * `ssh_keys` - (Optional) A list of SSH key IDs or fingerprints to enable in the format `[12345, 123456]`. To retrieve this info, use the [DigitalOcean API](https://docs.digitalocean.com/reference/api/api-reference/#tag/SSH-Keys)