this is similar to my issue. is there a way to add...
# dotnet
g
this is similar to my issue. is there a way to add to a container app’s env vars the url of the container app that is being created? You can get the url like so
Url      = Output.Format($"https://{app.Configuration.Apply(x => x!.Ingress).Apply(x => x!.Fqdn)}");
but obviously it’s cyclic dependency issue, you’re trying to add the url to the envvars but the url doesn’t exist yet
e
Circular dependencies aren't really supported at the moment, there's some tricks to work around it explained in https://www.pulumi.com/blog/exploring-circular-dependencies/ but all a bit odd
🙌 1
👍 1
g
Thanks
f
A container apps specific workaround could be using a custom DNS address + SSL certificate. That way, you can set the DNS address as a pulumi config value, provision the custom address, and pass the already-known custom address into the container app's env vars
g
i found i could do this due , the envvar coming from MS
Copy code
public static Uri GetContainerAppAddress(string name, bool secure = true, int? port = null) {
        if (IsNullOrWhiteSpace(name))
            throw new ArgumentException("Container App name cannot be null or whitespace.", nameof(name));

        var suffix = Environment.GetEnvironmentVariable("CONTAINER_APP_ENV_DNS_SUFFIX");
        var host   = $"{name}{(suffix is not null ? $".{suffix}" : "")}";
        var url    = $"{(secure ? "https" : "http")}://{host}{(port is not null ? $":{port}" : "")}";
        
        return new Uri(url);
    }
f
Good call!