Skip to content

BUG: network.PrivateZone returns output object that can not be deserialized [python] #4777

Description

@leonavevor

What happened?

DESCRIPTION

All outputs returned from this network.PrivateZone are wrapped in Output[T] objects which are unfortunately unusable. this component needs to be reported

resources:ResourceGroup and others works perfectly as expected

REPRODUCE

pulumi version : v3.248.0

code:

    private_dns_zone = privatedns.PrivateZone(
        name,
        resource_group_name=resource_group_name,
        private_zone_name=zone_name,
        tags=tags,
        opts=child_opts,
    )

    # Register outputs
    self.object = private_dns_zone
    self.id: pulumi.Output[str] = private_dns_zone.id
    self.name: pulumi.Output[str] = private_dns_zone.name

    self.register_outputs(
        {
        "id": self.id,
        "name": self.name,
        "object": self.object
        }
    )

trying to get value:

    private_dns_zones_names: list[tuple[str, str]] \
        = [(zone.name.apply(lambda n:f"{n}"), zone.id.apply(lambda i:f"{i}")) for zone in private_dns_zones]

run:

    pulumi -C stacks/platform_shared_services preview -s dev --diff

ERROR 1

    Previewing update (dev)

    View Live: https://app.pulumi.com/leonavevor/shared_services/dev/previews/163afddf-36f4-4541-b7ea-be3b3574d2d5

    warning: Calling __str__ on an Output[T] is not supported.

    To get the value of an Output[T] as an Output[str] consider:
    1. o.apply(lambda v: f"prefix{v}suffix")

    See https://www.pulumi.com/docs/concepts/inputs-outputs for more details.
    private_dns_zone: Calling __str__ on an Output[T] is not supported.

    To get the value of an Output[T] as an Output[str] consider:
    1. o.apply(lambda v: f"prefix{v}suffix")

ERROR 2

when trying to create a lock for it using the id:

  azure-native:authorization:ManagementLockByScope  lock-Calling __str__ on an Output[T] is not supported.\n\nTo get the value of an Output[T] as an Output[str] consider:\n1. o.apply(lambda v: f"prefix{v}suffix")\n\nSee https://www.pulumi.com/docs/concepts/inputs-outputs for more details.\nThis function may throw in a future version of Pulumi

DESIRED OUTCOME

private_dns_zone.id.apply(lambda v:v) -> give me a string back not an unusable object

Example

private_dns_zone.id.apply(lambda v:v)

Output of pulumi about

give me a string back not an unusable object

Additional context

No response

Contributing

Vote on this issue by adding a 👍 reaction.
To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/questionQuestions about existing features

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions