busy-sugar-35016
06/07/2021, 9:05 AMazure_native.eventhub.list_namespace_keys
or azure_native.storage.list_storage_account_keys
. Basically, I want to provision two Azure resources A and B lying in the same Pulumi stack, whereby resource B needs a key value from resource A as a setting property. Thus, I call e.g. list_namespace_keys in the code of resource B and mention the dependency on resource A through opts
.
Nevertheless, pulumi up
immediately fails with the error "invoke of azure-native:eventhub:listNamespaceKeys failed" and "Can not perform requested operation on nested resource. Parent resource 'udp-dev-eventhub-media' not found".
It seems to me that those functions ignore the given dependencies completely and expect the respective resources to exist already. Do you have a working example of how to use those functions correctly?billowy-army-68599
06/07/2021, 9:25 PMbusy-sugar-35016
06/09/2021, 6:33 AMdef create_function_app(eventhub_resource):
# Get all the parameters...
# Set new access key with limited permissions
eventhub_access_key = azure_native.eventhub.NamespaceAuthorizationRule('eventgateway_eventhub_access_rule',
authorization_rule_name='function_app_access',
namespace_name=param_event_hub_namespace_name,
resource_group_name=param_rg,
rights=["Listen", "Send"],
opts=ResourceOptions(parent=eventhub_resource)
)
# Get connection string belonging to new access key
eventhub_ns_keys = azure_native.eventhub.list_namespace_keys(
namespace_name=param_event_hub_namespace_name,
resource_group_name=param_rg,
authorization_rule_name=eventhub_access_key.name,
opts=InvokeOptions(parent=eventhub_access_key)
)
)
eventhub_conn_string = eventhub_ns_keys.primary_connection_string
# Create Function App
function_app_resource = web.WebApp(
"FunctionAppResource",
name=param_app_service_name,
kind='functionapp,linux',
location=param_location,
redundancy_mode=param_redundancy_mode,
resource_group_name=param_rg,
site_config=web.SiteConfigArgs(
app_settings=[
web.NameValuePairArgs(name='FUNCTIONS_WORKER_RUNTIME', value='python'),
web.NameValuePairArgs(name='EVENT_HUB_CONN_STR', value=eventhub_conn_string),
web.NameValuePairArgs(name='FUNCTIONS_EXTENSION_VERSION', value='~3'),
web.NameValuePairArgs(name='AzureWebJobsStorage', value=stor_acc_conn_string)
],
linux_fx_version='python|{}'.format(param_python_version),
python_version=param_python_version
),
opts=ResourceOptions(parent=eventhub_resource, depends_on=[eventhub_ns_keys, eventhub_access_key])
)