https://pulumi.com logo
Title
c

clever-glass-42863

02/12/2022, 12:04 AM
A quick questions about multiple Output<string> in an array Input<string>[]
Envs = new Input<string>[]
                {
                    // Analytics DB...
                    "ANALYTICS_DB_USERNAME=postgres",
                    "ANALYTICS_DB_PASSWORD=password",
                    analyticsPostgresHostname,
                    // Accounts DB...
                    "ACCOUNTS_DB_USERNAME=postgres",
                    "ACCOUNTS_DB_PASSWORD=password",
                    accountsPostgresHostname,
                    "ACCOUNTS_DB_PORT=5432",
                    "ANALYTICS_DB_PORT=5431",
                    "PORT=80"
                },
Where both the
analyticsPostgresHostname
and
accountsPostgresHostname
are defined like:
var accountsPostgresHostname = accountsPostgresContainer.Hostname.Apply(networkName => $"ACCOUNTS_DB_HOSTNAME={networkName}");
            var analyticsPostgresHostname = analyticsPostgresContainer.Hostname.Apply(networkName => $"ANALYTICS_DB_HOSTNAME={networkName}");
However, only one of those hostnames actually get filled, the other is an empty string. Is it expected that both those Output<string> be resolved in that Input<string>[]? I appreciate your time!
e

echoing-dinner-19531

02/12/2022, 10:40 AM
Yes it is expected that both of those would resolve.
c

clever-glass-42863

02/12/2022, 2:29 PM
@echoing-dinner-19531 thanks for the response. Only one of the values propagates, while both containers spin up prior to the one that is assigned these environment variables. What are the best next steps in debugging this?
e

echoing-dinner-19531

02/12/2022, 6:35 PM
I'd check the state of both resources via
pulumi stack export
to see if the output value is filled in for the resource.
c

clever-glass-42863

02/12/2022, 7:47 PM
@echoing-dinner-19531 from the
pulumi stack export
we can see that Apply call is being made, yet networkName is null. See this output from that variable:
"ACCOUNTS_DB_HOSTNAME=",
That would only be set if the Apply call was invoked, yet the value should come from the parameter being fed in via the Apply:
var accountsPostgresHostname = accountsPostgresContainer.Hostname.Apply(networkName => $"ACCOUNTS_DB_HOSTNAME={networkName}");
@echoing-dinner-19531 Just an update for anyone else running into this. I had to
pulumi rm
the entire stack and recreate locally for this to work as expected. Not sure what state the local containers go into (considering they were being recreated) however after doing so, both hostnames populate as expected.
e

echoing-dinner-19531

02/12/2022, 8:52 PM
Hmm sounds like a provider bug. If you hit this again can you raise a bug on the docker provider repo.
1