Skip to content

Commit

Permalink
droplet: Document and warn that enabling IPv6 requires OS-level confi…
Browse files Browse the repository at this point in the history
…g changes. (#1111)
  • Loading branch information
andrewsomething authored Feb 8, 2024
1 parent 920274b commit 26fbbb9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
15 changes: 13 additions & 2 deletions digitalocean/droplet/resource_droplet.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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)
Expand All @@ -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") {
Expand Down Expand Up @@ -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 {
Expand Down
4 changes: 3 additions & 1 deletion docs/resources/droplet.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 26fbbb9

Please sign in to comment.