I need to set a config on a Function App that depe...
# azure
c
I need to set a config on a Function App that depends on a different resource's output. Yes, the dreaded
Calling [toString] on an [Output<T>] is not supported
error. I need to create the following string:
Copy code
`https://${containerAppName}.${pulumi.interpolate`${managedEnvironment.defaultDomain}`}`
managedEnvironment is of type
ManagedEnvironment
from the azure-native provider and for the life of me I can't get the
defaultDomain
property into this string. I tried
managedEnvironment.defaultDomain.apply(d => d)
as well, no luck. Am I out of luck with this one?
t
You need to wrap it all into interpolate:
Copy code
pulumi.interpolate`https://${containerAppName}.${managedEnvironment.defaultDomain}`
c
So, that worked, any idea why this might not work when passing an output from a resource into a module as a parameter and then use that in the module?
as in...
Copy code
...
export function scanApp(resourceGroupName: Output<string>,...): {

...
new appservice.Plan(appServicePlanName, {
      resourceGroupName: resourceGroupName,
}
That doesn't work. I already tried `pulumi.interpolate`${resourceGroupName}`` but that just throws the same error.
t
I suspect you call
toString
on an output somewhere but it's hard to diagnose without the full code. Your snippet looks perfectly fine.
c
I am doing this here later:
Copy code
const appName = pulumi.interpolate`argos-${resourceGroupName}`;
    const prefix = `${appName}-${stack}`;
I then use
prefix
as a property for another resource as well. Does that not work?
t
const prefix = `${appName}-${stack}`;
This is your problem. It has to be an interpolate again.
And you won't be able to use it for a plain string value like resource name e.g.
new Resource(prefix + "foo", ...
c
yeah, I guess that's fine now. When we started this specific stack over 3 years ago we didn't think too far ahead. It is what it is now 🙂