Skip to content

Cannot assign digitalocean_floating_ip to digitalocean_project_resources #1455

@egor-tensin

Description

@egor-tensin

Bug Report

When I run terraform apply, it tries to add a couple of digitalocean_floating_ip's to digitalocean_project resources, even though they do seem to be there.

Describe the bug

I have a couple of floating IPs assigned to digitalocean_project_resources like this:

resource "digitalocean_floating_ip" "vpn" {
  region = var.region
}

resource "digitalocean_floating_ip" "web" {
  region = var.region
}

resource "digitalocean_project_resources" "project_ip" {
  project   = digitalocean_project.this.id
  resources = [each.value]

  for_each = toset([
    digitalocean_floating_ip.vpn.urn,
    digitalocean_floating_ip.web.urn,
  ])
}

Affected Resource(s)

  • digitalocean_floating_ip
  • digitalocean_project_resources

Expected Behavior

When I run terraform apply -auto-approve, they should already be assigned to the project, and no changes should be required.

Actual Behavior

No matter how I many times I run terraform apply -auto-approve, they always try to get assigned and seemingly succeed.

Terraform will perform the following actions:

  # digitalocean_project_resources.project_ip["do:floatingip:46.101.70.97"] will be updated in-place
  ~ resource "digitalocean_project_resources" "project_ip" {
        id        = "83fe2583-0fd8-445a-8191-2fea40474a08"
      ~ resources = [
          + "do:floatingip:46.101.70.97",
        ]
        # (1 unchanged attribute hidden)
    }

  # digitalocean_project_resources.project_ip["do:floatingip:67.207.73.55"] will be updated in-place
  ~ resource "digitalocean_project_resources" "project_ip" {
        id        = "83fe2583-0fd8-445a-8191-2fea40474a08"
      ~ resources = [
          + "do:floatingip:67.207.73.55",
        ]
        # (1 unchanged attribute hidden)
    }

Plan: 0 to add, 2 to change, 0 to destroy.
digitalocean_project_resources.project_ip["do:floatingip:46.101.70.97"]: Modifying... [id=83fe2583-0fd8-445a-8191-2fea40474a08]
digitalocean_project_resources.project_ip["do:floatingip:67.207.73.55"]: Modifying... [id=83fe2583-0fd8-445a-8191-2fea40474a08]
digitalocean_project_resources.project_ip["do:floatingip:67.207.73.55"]: Modifications complete after 4s [id=83fe2583-0fd8-445a-8191-2fea40474a08]
digitalocean_project_resources.project_ip["do:floatingip:46.101.70.97"]: Modifications complete after 4s [id=83fe2583-0fd8-445a-8191-2fea40474a08]

Steps to Reproduce

  1. terraform apply

Terraform Configuration Files

Sorry, I don't think you'd be able to use it - it uses multiple providers with different credentials, etc. I should probably refactor that.

Terraform version

Terraform v1.13.4
on linux_amd64
+ provider registry.terraform.io/digitalocean/digitalocean v2.68.0

Debug Output

https://gist.github.com/egor-tensin/36cfb6965f5786c63f183f7cb4fc5528

Additional context

I checked manually both on S3 (where I keep my state), and using terraform state pull, and they do seem to be assigned to the project, this is an excerpt: https://gist.github.com/egor-tensin/3222fd65fc841f4c61ed8dac7a4d8cfb

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions