This message was deleted.
# azure
s
This message was deleted.
t
I am calling this async method from the main Pulumi code using getawaiter,
GetAwaiter doesn’t block on its own. Could you show your code?
m
This is the method:
Copy code
static async Task<string> SetIpGroupIp(string ipGroupId, string ip)
        {
          
                var ipGroupResourceGroup = ipGroupId.Split("/")[4];
                var ipGroupName = ipGroupId.Split("/")[8];
                var token = await Pulumi.AzureNative.Authorization.GetClientToken.InvokeAsync();
                var networkClient =
                    new NetworkManagementClient(new TokenCredentials(new StringTokenProvider(token.Token, "Bearer")))
                    {
                        SubscriptionId = ipGroupId.Split("/")[2]
                    };
                var ipGroup = (await networkClient.IpGroups.GetWithHttpMessagesAsync(ipGroupResourceGroup, ipGroupName))
                    .Body;
                Log.Warn(ipGroup.IpAddresses[0]);
                if (!ipGroup.IpAddresses.Contains(ip))
                {
                    ipGroup.IpAddresses.Add(ip);
                    await networkClient.IpGroups.CreateOrUpdateWithHttpMessagesAsync(ipGroupResourceGroup, ipGroupName,
                        ipGroup);
                }
                return ip;
        }
and this is how it is called
Copy code
if (!Pulumi.Deployment.Instance.IsDryRun)
        {
            aksIp.Apply(ip =>
            {
                var aksip = SetIpGroupIp(config.Require("AKSIpGroup"), ip).GetAwaiter().GetResult();
                return aksip;
            });
        }
t
Can you try returning the result of
Apply
as a stack output?
m
Yeah looks like that may have been it
Thanks