juju / terraform-provider-juju

A Terraform provider for Juju
Apache License 2.0
19 stars 34 forks source link

Add public-addresses as an attribute to juju_application resources #439

Open jsimpso opened 3 months ago

jsimpso commented 3 months ago

Requirements

I'd like to be able to reference the "public-address" value for units of an application directly from the Terraform resource for that application.

For example, this is what we currently have in state for an example application:

terraform state show module.landscape_highly_available.juju_application.haproxy
# module.landscape_highly_available.juju_application.haproxy:
resource "juju_application" "haproxy" {
    config      = {
        "default_timeouts"            = "queue 60000, connect 5000, client 120000, server 120000"
        "global_default_bind_options" = "no-tlsv10"
        "services"                    = ""
    }
    constraints = "arch=amd64"
    id          = "stg-is-landscape-testing:haproxy"
    model       = "stg-is-landscape-testing"
    name        = "haproxy"
    placement   = "3,4,5"
    trust       = false
    units       = 3

    charm {
        base     = "ubuntu@22.04"
        channel  = "latest/stable"
        name     = "haproxy"
        revision = 75
        series   = "jammy"
    }
}

Having the public-address info for each deployed unit would be very useful. Or maybe we could record the unit names under the application object instead, and add a separate unit data source to look these up?

Thanks!

Urgency

Casually wishlisting

Notes & References

No response

amandahla commented 3 months ago

@jsimpso would you expect a list like unit-addresses = ["192.168.0.1","192.168.0.2"] or a map like unit-address {"unit/0" = "192.168.0.1", "unit/1" = "192.168.0.2"} ? Is this expected to be used in another resource?

jsimpso commented 3 months ago

@jsimpso would you expect a list like unit-addresses = ["192.168.0.1","192.168.0.2"] or a map like unit-address {"unit/0" = "192.168.0.1", "unit/1" = "192.168.0.2"} ?

I was imagining a list, but more data is never a bad idea!

Is this expected to be used in another resource?

Yep, I'm prototyping something to tie these units in to an external loadbalancer at the moment, and being able to reference the addresses of the deployed application would make that much easier!