https://pulumi.com logo
#general
Title
# general
w

worried-hydrogen-32482

08/06/2021, 4:12 PM
Hey guys - I am having issues running pulumi up whenever I use Get/List* functions in my code. For example I am trying to obtain the Azure Datafactory Self Hosted integration auth keys using this function azure-native.datafactory.listIntegrationRuntimeAuthKeys | Pulumi. My code fails during the preview stage because the resource group and datafactory resources are not created yet.
Exception: invoke of azure-native:datafactory:listIntegrationRuntimeAuthKeys failed: invocation of azure-native:datafactory:listIntegrationRuntimeAuthKeys returned an error: request failed /subscriptions/xxxxxx/resourceGroups/{resourceGroupName}/providers/Microsoft.DataFactory/factories/{factoryName}/integrationRuntimes/{integrationRuntimeName}/listAuthKeys: autorest/azure: Service returned an error. Status=404 Code="ResourceGroupNotFound" Message="Resource group '{resourceGroupName}' could not be found.
Here is a sample code:
Copy code
from pulumi import export
from pulumi_azure_native import resources, datafactory

# Resource Group
resource_group = resources.ResourceGroup(
    "self-hosted-runtime", resource_group_name="self-hosted-runtime")

# Data Factory
adf = datafactory.factory.Factory(
    "self-hosted-runtime",
    factory_name="self-hosted-runtime",
    resource_group_name=resource_group.name
)

# Self Hosted Runtime
shr = datafactory.IntegrationRuntime(
    "self-hosted-runtime",
    integration_runtime_name="self-hosted-runetime",
    factory_name=adf.name,
    resource_group_name=resource_group.name,
    properties=datafactory.SelfHostedIntegrationRuntimeArgs(
        type="SelfHosted",
    )
)

# Self Hosted Runtime Auth Keys
shr_auth_keys = datafactory.list_integration_runtime_auth_keys(
    adf.name, shr.name, resource_group.name)

export("shr", shr)
export("shr-auth-keys", shr_auth_keys)
r

red-match-15116

08/06/2021, 4:28 PM
I think you’re running into https://github.com/pulumi/pulumi/issues/5758 here. The TL;DR is that functions accept raw values and not outputs, so you’ll have to write it like:
Copy code
shr_auth_keys = pulumi.Output.all(adf.name, shr.name, resource_group.name).apply(lambda args: datafactory.list_integration_runtime_auth_keys(*args))
3 Views