https://pulumi.com logo
#azure
Title
# azure
c

colossal-room-15708

11/01/2023, 2:07 AM
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

tall-librarian-49374

11/01/2023, 8:14 AM
You need to wrap it all into interpolate:
Copy code
pulumi.interpolate`https://${containerAppName}.${managedEnvironment.defaultDomain}`
c

colossal-room-15708

11/14/2023, 7:21 AM
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

tall-librarian-49374

11/14/2023, 1:57 PM
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

colossal-room-15708

11/14/2023, 9:34 PM
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

tall-librarian-49374

11/15/2023, 5:50 PM
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

colossal-room-15708

11/15/2023, 9:24 PM
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 🙂