Hello there!

I’m currently working on a project in which my goal is to setup a kubernetes cluster, https termination, domain, docker registry and database, all using Terraform and Azure Pipelines.

I’ve got everything working and it’s pretty neat, the only obstacle I’m facing is that I find it hard to get my docker registry’s spaces object and my loadbalancer (created by an Ingress controller) to be placed inside of the correct DO project. They are placed in my default project instead of the project that I want them to be in together with the other resources.

I’ve already attempted to get the loadbalancer in my project by adding do:kubernetes:${digitalocean_kubernetes_cluster.kubernetes_cluster.id} to my project’s resources. This does not seem to throw any errors, but the expected resources are still not showing up in my special project.

Is it possible to somehow predict the URN of the resource like do:loadbalancer:<predict this?>? Or does my k8s cluster perhaps contain the ID of the loadbalancer somewhere in its settings?

I understand that I might be talking to the wrong people here and I should be talking to the maintainers of the Terraform DO provider, but I just wanted to be sure and pose the question here as well.

TL;DR: How do I get my k8s-created loadbalancer and docker-registry’s spaces resource to show up in the correct DO project if I can’t predict/trace their name?

Yours sincerely,

Wouter

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
1 answer

Update: I’ve managed to get the loadbalancer ID by looking in the ingress’ metadata (data.kubernetesservice.ingressservice.metadata[0].annotations[“kubernetes.digitalocean.com/load-balancer-id”]) so I could form the URN like do:loadbalancer:<id>.

Are there easier options to accomplish this?

Submit an Answer