Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Droplet already has a pending event for reserved_ip #1034

Open
AAverin opened this issue Sep 25, 2023 · 2 comments
Open

Droplet already has a pending event for reserved_ip #1034

AAverin opened this issue Sep 25, 2023 · 2 comments
Labels

Comments

@AAverin
Copy link

AAverin commented Sep 25, 2023

Bug Report


Describe the bug

Having

resource "digitalocean_reserved_ip" "nomad_bastion" {
  droplet_id = digitalocean_droplet.nomad_bastion.id
  region     = digitalocean_droplet.nomad_bastion.region

  depends_on = [ resource.digitalocean_droplet.nomad_bastion ]
}

Applying often causes Droplet already has a pending event error, failing deployment.

Restart of the deployment results in Error: Error retrieving reserved IP: stream error: stream ID 17; INTERNAL_ERROR; received from peer

Affected Resource(s)

digitalocean_reserved_ip

Expected Behavior

Actual Behavior

Steps to Reproduce

Terraform Configuration Files

Terraform version

Debug Output

Panic Output

Additional context

Important Factoids

References

@AAverin AAverin added the bug label Sep 25, 2023
@danaelhe
Copy link
Member

Hi there, thank you for the write up!

Hmmm....I can't seem to recreate this issue on my end. Are there any more details you can provide about the config you're using or if you have to run it multiple times to see the issue? For reference, this is the config file I'm using:

resource "digitalocean_droplet" "example" {
  name               = "example"
  size               = "s-1vcpu-1gb"
  image              = "ubuntu-22-04-x64"
  region             = "nyc3"
  ipv6               = true
  private_networking = true
}

resource "digitalocean_reserved_ip" "example" {
  droplet_id = digitalocean_droplet.example.id
  region     = digitalocean_droplet.example.region

  depends_on = [ resource.digitalocean_droplet.example ]
}

@AAverin
Copy link
Author

AAverin commented Sep 30, 2023

It will probably be difficult to reproduce, but happens for me quite consistently.

Try to apply the infrastructure once and then do a small change (in user data, for example) and apply again.
With the current example you use, reserved_ip will be created every time new, which is wrong, even though this is what is in the resource examples.

I have this now:

resource "digitalocean_droplet" "nomad_bastion" {
  image = data.digitalocean_images.cluster_server.images[0].id

  # Consul members name must be unique
  name   = "nomad-bastion"
  region = var.do_region_ams3
  size   = var.do_size_s-1vcpu-512mb-10gb
  user_data = templatefile("templates/user_data.sh", {
    nomad_servers_count = var.nomad_servers_count,
    do_token = var.do_token,
    ph_tags = "bastion"
  })
  ssh_keys  = [data.digitalocean_ssh_key.ssh.id]
  vpc_uuid  = digitalocean_vpc.cluster.id

  tags = [
    "bastion",
    local.retry_join.tag_name
  ]
}

resource "digitalocean_reserved_ip" "nomad_bastion" {
  region     = digitalocean_droplet.nomad_bastion.region
}

resource "digitalocean_reserved_ip_assignment" "bastion_static_ip" {
  ip_address = digitalocean_reserved_ip.nomad_bastion.ip_address
  droplet_id = digitalocean_droplet.nomad_bastion.id

  depends_on = [ 
    resource.digitalocean_reserved_ip.nomad_bastion,
    resource.digitalocean_droplet.nomad_bastion
   ]
}

Even with this setup, I often get the same error.
But at very least I can run apply again and everything works fine then.

It is probably some kind of synchronization issue on the API side when reserved ip is being assigned to the droplet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants