https://pulumi.com logo
#python
Title
# python
s

some-cartoon-66940

06/28/2023, 11:31 AM
Hi all, I hope some kind soul here can help me. I am trying to create one Azure machine learning compute instance (the docs are here https://www.pulumi.com/registry/packages/azure-native/api-docs/machinelearningservices/machinelearningcompute/#create-an-computeinstance-compute) Here is the code (every resource needed for this compute instance has been successfully created beforehand): compute = azure_native.machinelearningservices.MachineLearningCompute( _resource_name_="kompjuter", _compute_name_="komputer", _resource_group_name_=rg.name, location=rg.location, _workspace_name_=workspace.name, properties=azure_native.machinelearningservices.ComputeInstanceArgs( _compute_type_="ComputeInstance", # Policy for sharing applications on this compute instance among users of parent workspace. If Personal, only the creator can access applications on this compute instance. When Shared, any workspace user can access applications on this instance depending on his/her assigned role. properties=azure_native.machinelearningservices.ComputeInstancePropertiesArgs( _application_sharing_policy_="Personal", _compute_instance_authorization_type_="personal", # setup_scripts= subnet=vmsubnet.id, _vm_size_="Standard_D8_v4", _personal_compute_instance_settings_=azure_native.machinelearningservices.PersonalComputeInstanceSettingsArgs( _assigned_user_=azure_native.machinelearningservices.AssignedUserArgs( _object_id_="", _tenant_id_="", ) ), _ssh_settings_=azure_native.machinelearningservices.ComputeInstanceSshSettingsArgs( _ssh_public_access_="Disabled", ) ) ) ) The error I am getting is this: azure-nativemachinelearningservicesMachineLearningCompute (kompjuter): error: Code="UserError" Message="The request format was invalid. Details: {0} (Parameter 'Error converting value \"/subscriptions/SUBSCRIPTION_ID/resourceGroups/ml-test/providers/Microsoft.Network/virtualNetworks/mltestnet/subnets/vmsubnet\" to type 'Microsoft.MachineLearning.Common.BatchAIClient.ResourceId'. Path 'properties.subnet', line 1, position 520.')" Details=[] As far as I can tell I am providing the right ID for the subnet, the docs (what little there is) use the same id, and that crappy Pulumi "AI" is of no help as it's either giving the same answer as the docs or unusable junk.
b

billowy-engine-58246

07/02/2023, 5:17 AM
Hi Slobodan! Since Pulumi directly interfaces with the Azure API's, often the Azure documentation itself is of great help, also with regards to this resource: If we go to https://learn.microsoft.com/en-us/azure/templates/microsoft.machinelearningservices/workspaces/computes?pivots=deployment-language-bicep#comp[…]ects You see that the ComputeInstance object requires a subnet ID in the following way: subnet: { id: 'string' } This is also shown if you look at the ComputeInstancePropertiesArgs object:
Copy code
class ComputeInstancePropertiesArgs:
    def __init__(__self__, *,
                 application_sharing_policy: Optional[pulumi.Input[Union[str, 'ApplicationSharingPolicy']]] = None,
                 compute_instance_authorization_type: Optional[pulumi.Input[Union[str, 'ComputeInstanceAuthorizationType']]] = None,
                 custom_services: Optional[pulumi.Input[Sequence[pulumi.Input['CustomServiceArgs']]]] = None,
                 enable_node_public_ip: Optional[pulumi.Input[bool]] = None,
                 personal_compute_instance_settings: Optional[pulumi.Input['PersonalComputeInstanceSettingsArgs']] = None,
                 schedules: Optional[pulumi.Input['ComputeSchedulesArgs']] = None,
                 setup_scripts: Optional[pulumi.Input['SetupScriptsArgs']] = None,
                 ssh_settings: Optional[pulumi.Input['ComputeInstanceSshSettingsArgs']] = None,
                 subnet: Optional[pulumi.Input['ResourceIdArgs']] = None,
                 vm_size: Optional[pulumi.Input[str]] = None):
tl;dr: set the subnet as subnet=ResourceIdArgs(id=vmsubnet.id) and you're good to go
Also, the 'crappy Pulumi AI' would've given the same answer:
s

some-cartoon-66940

07/12/2023, 6:26 PM
Thanks for the detailed answer.
As for the Pulumi "AI" the time spent chasing yet another fad would have been better spent on writing actual documentation so I don't have to waste my (and your) time. I am currently looking at the docs for the Azure Application Gateway with absolutely no examples and I am already dreading spending the next hour interrogating said "intelligence".
b

billowy-engine-58246

07/12/2023, 8:27 PM
What questions do you have about an App Gateway? Note that there’s a gazillion examples of Bicep templates for that which are ultimately the same as Pulumi
3 Views