pulumi / pulumi-pulumiservice

https://pulumi.com
Apache License 2.0
13 stars 7 forks source link

Allow resource auto-naming #420

Closed aureq closed 1 month ago

aureq commented 1 month ago

Hello!

Issue details

When I create a S3 bucket and don't set the AWS Resource name, the Pulumi name is use and a random suffix is used instead βœ”. This is very helpful because it's easy to avoid name collisions this way. It also makes the code cleaner as the name doesn't need to be specified.

In this provider however, it seems like auto-naming isn't supported and all resources need to be explicitly named.

"""A Python Pulumi program"""

import pulumi
import pulumi_pulumiservice as pulumiservice

pulumi_agent_pool = pulumiservice.AgentPool("agentPoolResource",
    # name="agent-pool-resource",
    organization_name="menfin",
    description="this is to test agent pool id"
)

pulumi.export("agent-pool", {
    'id': pulumi_agent_pool.agent_pool_id,
    'name': pulumi_agent_pool.name,
    'token': pulumi_agent_pool.token_value
})

For the code above πŸ‘† I get the error below πŸ‘‡ and I'm forced to set the name property.

Previewing update (0001)

View in Browser (Ctrl+O): https://app.pulumi.com/menfin/zendesk/0001/previews/d94adb19-7a08-45c7-a742-501b9154c090

     Type                 Name          Plan       Info
 +   pulumi:pulumi:Stack  zendesk-0001  create     1 error

Diagnostics:
  pulumi:pulumi:Stack (zendesk-0001):
    error: Program failed with an unhandled exception:
    Traceback (most recent call last):
      File "/home/aureq/work/customers/zendesk/0001-xxxxx/a/__main__.py", line 6, in <module>
        pulumi_agent_pool = pulumiservice.AgentPool("agentPoolResource",
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/home/aureq/work/customers/zendesk/0001-xxxxx/a/venv/lib/python3.11/site-packages/pulumi_pulumiservice/agent_pool.py", line 105, in __init__
        __self__._internal_init(resource_name, *args, **kwargs)
      File "/home/aureq/work/customers/zendesk/0001-xxxxx/a/venv/lib/python3.11/site-packages/pulumi_pulumiservice/agent_pool.py", line 124, in _internal_init
        raise TypeError("Missing required property 'name'")
    TypeError: Missing required property 'name'

It would be great to have feature parity with other providers.

komalali commented 1 month ago

Closing as a duplicate of https://github.com/pulumi/pulumi-pulumiservice/issues/110