Hi, I am trying to deploy resources on Microsoft A...
# general
b
Hi, I am trying to deploy resources on Microsoft Azure with code I used 4 months ago. I have updated to pulumi 3.24.1 with the python sdk versions: pulumi 3.24.1 pulumi-azure 4.37.0 pulumi-azure-native 1.56.0 When running 'pulumi preview' I am getting the following error: pulumi preview Previewing update (test) View Live: https://app.pulumi.com/epiic/appsvcs/test/previews/704d3482-9297-42f3-b696-a0867edbbd1e Type Name Plan Info + pulumipulumiStack appsvcs-test create 3 errors + ├─ azurecoreResourceGroup epiic-appsvcs-rg-test create + ├─ azurestorageAccount eassatest create + ├─ azureappservicePlan eas-asp-test create + └─ azureappinsightsInsights eas-ai-test create Diagnostics: pulumipulumiStack (appsvcs-test): error: Program failed with an unhandled exception: error: Traceback (most recent call last): File "/opt/pulumi/pulumi-language-python-exec", line 107, in <module> loop.run_until_complete(coro) File "/usr/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete return future.result() File "/home/rlrobert/gitlab/dataingress/pulumi-appsvcs/.venv/lib/python3.9/site-packages/pulumi/runtime/stack.py", line 126, in run_in_stack await run_pulumi_func(lambda: Stack(func)) File "/home/rlrobert/gitlab/dataingress/pulumi-appsvcs/.venv/lib/python3.9/site-packages/pulumi/runtime/stack.py", line 51, in run_pulumi_func await wait_for_rpcs() File "/home/rlrobert/gitlab/dataingress/pulumi-appsvcs/.venv/lib/python3.9/site-packages/pulumi/runtime/stack.py", line 110, in wait_for_rpcs raise exception File "/home/rlrobert/gitlab/dataingress/pulumi-appsvcs/.venv/lib/python3.9/site-packages/pulumi/runtime/rpc_manager.py", line 68, in rpc_wrapper result = await rpc File "/home/rlrobert/gitlab/dataingress/pulumi-appsvcs/.venv/lib/python3.9/site-packages/pulumi/output.py", line 98, in is_value_known return await is_known and not contains_unknowns(await future) File "/home/rlrobert/gitlab/dataingress/pulumi-appsvcs/.venv/lib/python3.9/site-packages/pulumi/output.py", line 98, in is_value_known return await is_known and not contains_unknowns(await future) File "/home/rlrobert/gitlab/dataingress/pulumi-appsvcs/.venv/lib/python3.9/site-packages/pulumi/output.py", line 98, in is_value_known return await is_known and not contains_unknowns(await future) [Previous line repeated 47 more times] File "/home/rlrobert/gitlab/dataingress/pulumi-appsvcs/.venv/lib/python3.9/site-packages/pulumi/runtime/resource.py", line 514, in do_register resolver = await prepare_resource(res, ty, custom, remote, props, opts, typ) File "/home/rlrobert/gitlab/dataingress/pulumi-appsvcs/.venv/lib/python3.9/site-packages/pulumi/runtime/resource.py", line 124, in prepare_resource serialized_props = await rpc.serialize_properties( File "/home/rlrobert/gitlab/dataingress/pulumi-appsvcs/.venv/lib/python3.9/site-packages/pulumi/runtime/rpc.py", line 172, in serialize_properties result = await serialize_property( File "/home/rlrobert/gitlab/dataingress/pulumi-appsvcs/.venv/lib/python3.9/site-packages/pulumi/runtime/rpc.py", line 389, in serialize_property return { File "/home/rlrobert/gitlab/dataingress/pulumi-appsvcs/.venv/lib/python3.9/site-packages/pulumi/runtime/rpc.py", line 390, in <dictcomp> k: await serialize_property( File "/home/rlrobert/gitlab/dataingress/pulumi-appsvcs/.venv/lib/python3.9/site-packages/pulumi/runtime/rpc.py", line 228, in serialize_property await serialize_property( File "/home/rlrobert/gitlab/dataingress/pulumi-appsvcs/.venv/lib/python3.9/site-packages/pulumi/runtime/rpc.py", line 389, in serialize_property return { File "/home/rlrobert/gitlab/dataingress/pulumi-appsvcs/.venv/lib/python3.9/site-packages/pulumi/runtime/rpc.py", line 390, in <dictcomp> k: await serialize_property( File "/home/rlrobert/gitlab/dataingress/pulumi-appsvcs/.venv/lib/python3.9/site-packages/pulumi/runtime/rpc.py", line 450, in serialize_property raise ValueError(f"unexpected input of type {type(value).name}") ValueError: unexpected input of type tuple error: an unhandled error occurred: Program exited with non-zero exit code: 1 I have no idea where to start debugging this. Any ideas/help would be appreciated.
q
Looks like updating the SDK has brought in a change in types and you're passing a string to something that doesn't expect a string
Can you share the code, that may allow us to help
b
Thank you for the insight! @quiet-wolf-18467 Sure thing! Here is the code: import pulumi from pulumi_azure import core, storage, appservice,appinsights # import pulumi_azure as azure import pulumi_azure_native.web as web from pulumi import StackReference # Create an Azure Resource Group stage=pulumi.get_stack() resource_group = core.ResourceGroup("epiic-appsvcs-rg-"+stage, name="epiic-appsvcs-rg-"+stage, location="West US") # Create an Azure resource (Storage Account) account = storage.Account("eassa"+stage, name="eassa"+stage, # The location for the storage account will be derived automatically from the resource group. resource_group_name=resource_group.name, account_tier="Standard", account_replication_type="LRS") plan = appservice.Plan("eas-asp-" + stage, name = "eas-asp-" + stage, location=resource_group.location, resource_group_name=resource_group.name, kind="linux", reserved=True, sku=appservice.PlanSkuArgs( tier="Basic", size="B1", )) insights = appinsights.Insights("eas-ai-"+stage, name = "eas-ai-" + stage, application_type = "web", location=resource_group.location, resource_group_name=resource_group.name, retention_in_days = 30 ) COSMOS_CONNECTION_STRING = os.environ['COSMOS_CONNECTION_STRING'] AzureWebJobsStorage = os.environ['AzureWebJobsStorage'] api_webapp = web.WebApp("epiic-api-" + stage, name = "epiic-api-" + stage, location=resource_group.location, resource_group_name=resource_group.name, server_farm_id=plan.id, client_affinity_enabled=False, client_cert_enabled=False, client_cert_mode="Required", container_size=0, daily_memory_time_quota=0, enabled=True, host_name_ssl_states=[ web.HostNameSslStateArgs( host_type="Standard", name="epiic-api-dev.azurewebsites.net", ssl_state="Disabled", ), web.HostNameSslStateArgs( host_type="Repository", name="epiic-api-dev.scm.azurewebsites.net", ssl_state="Disabled", ), ], host_names_disabled=False, https_only=False, hyper_v=False, is_xenon=False, kind="app,linux,container", redundancy_mode="None", reserved=True, scm_site_also_stopped=False, site_config=web.SiteConfigArgs( app_settings = [ web.NameValuePairArgs(name="WEBSITES_ENABLE_APP_SERVICE_STORAGE", value="false"), web.NameValuePairArgs(name="DOCKER_ENABLE_CI", value="true"), web.NameValuePairArgs(name="DOCKER_REGISTRY_SERVER_URL", value="https://epiicacr.azurecr.io"), web.NameValuePairArgs(name="DOCKER_REGISTRY_SERVER_USERNAME", value= "username" ), web.NameValuePairArgs(name="DOCKER_REGISTRY_SERVER_PASSWORD", value= "**********" ), web.NameValuePairArgs(name="WEBSITES_CONTAINER_START_TIME_LIMIT", value= "600" ), web.NameValuePairArgs(name="PORT", value="80") ], linux_fx_version = "DOCKER|epiicacr.azurecr.io/epiic-api:" + stage ), storage_account_required=False ) # Export the connection string for the storage account pulumi.export("connection_string", account.primary_connection_string)
q
Unfortunately this code works for me, when the environment vars AzureWebJobsStorage and COSMOS_CONNECTION_STRING exist and are simple strings
Perhaps check with
echo ${AzureWebJobsStorage} ${COSMOS_CONNECTION_STRING}
and ensure yours are strings
I'd also strongly encourage you to remove the dependency on environment variables and move this to stack configuration with
pulumi config set
b
@quiet-wolf-18467 The problem was with the environment vars. Sorry, I should have caught that. I will definitely look into using pulumi config set Thank you for your help!!!