A quick questions about multiple Output<string&...
# getting-started
c
A quick questions about multiple Output<string> in an array Input<string>[]
Copy code
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:
Copy code
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
Yes it is expected that both of those would resolve.
c
@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
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
@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:
Copy code
"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:
Copy code
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
Hmm sounds like a provider bug. If you hit this again can you raise a bug on the docker provider repo.
1