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

Load Balancer not added to Project #1092

Open
MauriceArikoglu opened this issue Dec 13, 2023 · 3 comments
Open

Load Balancer not added to Project #1092

MauriceArikoglu opened this issue Dec 13, 2023 · 3 comments
Labels

Comments

@MauriceArikoglu
Copy link

Load balancers are not added to projects successfully.

When I apply my terraform configuration, which includes creating several resources and then creating a project and adding all resources to the project, the load balancer is not added.

I can confirm this by showing the state for the project, which does not include the load balancer. Subsequent applies cause the project to be updated all the time, without the load balancer ever making it into the resources list of the project.

If I look at the resource overview in my digitalocean dashboard I cannot see the load balancer. In contrast, if I look at the load balancer status page, I can see it is associated with the project. So it seems this could be an issue with digitalocean itself.

resource "digitalocean_project" "project" {
    name        = var.config.name
    purpose     = "Web Application"
    environment = title(lower(var.config.env_slug))
    resources   = [
            module.L1.this.postgres.urn,
            module.L1.this.redis.urn,
            module.L1.this.kubernetes.urn,
            module.L2.this.load_balancer.urn,
            module.domains.this.backend_urn,
            module.domains.this.frontend_urn
    ]
}

yields

resource "digitalocean_project" "project" {
    created_at  = "2023-12-12T16:16:29Z"
    environment = "Staging"
    id          = "some_id"
    is_default  = false
    name        = "example"
    owner_id    = 1337
    owner_uuid  = "1337_7331"
    purpose     = "Web Application"
    resources   = [
        "do:dbaas:one_db,
        "do:dbaas:another_db",
        "do:domain:example.com",
        "do:domain:example.net",
        "do:kubernetes:a_cluster",
    ]
    updated_at  = "2023-12-12T16:16:29Z"
}

where module.L2.this.load_balancer.urn is missing from the state.

Btw: Like I said, subsequent applies try to re-add the load balancer all the time and show the correct urn. The subsequent applies always succeed as in "no error from terraform", but the load balancer is not added actually.

@MauriceArikoglu
Copy link
Author

# module.L3.module.project.digitalocean_project.project will be updated in-place
  ~ resource "digitalocean_project" "project" {
        id          = "id"
        name        = "example"
      ~ resources   = [
          + "do:loadbalancer:my_lb",
            # (5 unchanged elements hidden)
        ]
        # (7 unchanged attributes hidden)
    }

@MauriceArikoglu
Copy link
Author

Pinging @andrewsomething here, since you also looked at the API-related #1093 - this is blocking us, since every apply causes dependent resources to be updated or re-created unneccessarily.

@andrewsomething
Copy link
Member

Hi @MauriceArikoglu,

Apologies for the delayed response. I've not been able to reproduce the issue myself. I'm able to successfully place load balancers into projects using Terraform with no unexpected issues. With a little more information, hopefully we can better understand where your issue is occurring.

If run the apply with debug logging enabled (TF_LOG=debug terraform apply), you should see an API request like POST /v2/projects/<project_uuid>/resources. If so, do you see the load balancer referenced in the request body? How about the response?

If you list the resources in the project via the API (GET /v2/projects/<project_uuid>/resources), do you see the load balancer in the response?

If I look at the resource overview in my digitalocean dashboard I cannot see the load balancer. In contrast, if I look at the load balancer status page, I can see it is associated with the project. So it seems this could be an issue with digitalocean itself.

The fact that the load balancer seems to be associated with the project but is not displayed in the project overview on your dashboard suggests to me that there is an issue that can not be resolved via Terraform itself. If you see the load balancer included in the POST request but not either of the response bodies, that would collaborate this.

If this is the case, the engineering team responsible for projects would need to do further investigation specific to the resources in your account. The best way forward would be to open a support ticket.

Thanks!

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