pulumi / pulumi-aws

An Amazon Web Services (AWS) Pulumi resource package, providing multi-language access to AWS
Apache License 2.0
463 stars 155 forks source link

dlm.LifecyclePolicyPolicyDetailsScheduleCreateRuleArgs incorrectly states times as a list #2974

Closed jamie1911 closed 7 months ago

jamie1911 commented 1 year ago

What happened?

aws.dlm.LifecyclePolicyPolicyDetailsScheduleCreateRuleArgs(
                    interval=24, interval_unit="HOURS", times=["01:00"]
),

All documentation points to times on LifecyclePolicyPolicyDetailsScheduleCreateRuleArgs being a list, however, it only needs a string.

Example

https://www.pulumi.com/registry/packages/aws/api-docs/dlm/lifecyclepolicy/#times_python

https://github.com/pulumi/pulumi-aws/blob/master/sdk/python/pulumi_aws/dlm/_inputs.py#L642

dlm_policy = aws.dlm.LifecyclePolicy(
    "dlm-policy",
    description="Daily backup for EBS volume",
    execution_role_arn=cryosparc_dlm_policy_role.arn,
    policy_details=aws.dlm.LifecyclePolicyPolicyDetailsArgs(
        resource_types=["VOLUME"],
        target_tags={"Name": "cryosparc-shared-ebs"},
        schedules=[
            aws.dlm.LifecyclePolicyPolicyDetailsScheduleArgs(
                name="backup",
                create_rule=aws.dlm.LifecyclePolicyPolicyDetailsScheduleCreateRuleArgs(
                    interval=24, interval_unit="HOURS", times=["01:00"]
                ),
                retain_rule=aws.dlm.LifecyclePolicyPolicyDetailsScheduleRetainRuleArgs(
                    count=5
                ),
            ),
        ],
        parameters=aws.dlm.LifecyclePolicyPolicyDetailsParametersArgs(
            exclude_boot_volume=True
        ),
    ),
)    

Causes

error: Program failed with an unhandled exception:
    Traceback (most recent call last):
      File "/home/jamie/.pulumi/bin/pulumi-language-python-exec", line 197, in <module>
        loop.run_until_complete(coro)
      File "/usr/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
        return future.result()
      File "/home/jamie/venvs/310/lib/python3.10/site-packages/pulumi/runtime/stack.py", line 137, in run_in_stack
        await run_pulumi_func(lambda: Stack(func))
      File "/home/jamie/venvs/310/lib/python3.10/site-packages/pulumi/runtime/stack.py", line 51, in run_pulumi_func
        await wait_for_rpcs()
      File "/home/jamie/venvs/310/lib/python3.10/site-packages/pulumi/runtime/stack.py", line 83, in wait_for_rpcs
        raise exn from cause
      File "/home/jamie/venvs/310/lib/python3.10/site-packages/pulumi/runtime/rpc_manager.py", line 71, in rpc_wrapper
        result = await rpc
      File "/home/jamie/venvs/310/lib/python3.10/site-packages/pulumi/runtime/resource.py", line 872, in do_register
        resolver = await prepare_resource(res, ty, custom, remote, props, opts, typ)
      File "/home/jamie/venvs/310/lib/python3.10/site-packages/pulumi/runtime/resource.py", line 176, in prepare_resource
        serialized_props = await rpc.serialize_properties(
      File "/home/jamie/venvs/310/lib/python3.10/site-packages/pulumi/runtime/rpc.py", line 209, in serialize_properties
        result = await serialize_property(
      File "/home/jamie/venvs/310/lib/python3.10/site-packages/pulumi/runtime/rpc.py", line 498, in serialize_property
        return {
      File "/home/jamie/venvs/310/lib/python3.10/site-packages/pulumi/runtime/rpc.py", line 499, in <dictcomp>
        k: await serialize_property(
      File "/home/jamie/venvs/310/lib/python3.10/site-packages/pulumi/runtime/rpc.py", line 337, in serialize_property
        await serialize_property(
      File "/home/jamie/venvs/310/lib/python3.10/site-packages/pulumi/runtime/rpc.py", line 498, in serialize_property
        return {
      File "/home/jamie/venvs/310/lib/python3.10/site-packages/pulumi/runtime/rpc.py", line 499, in <dictcomp>
        k: await serialize_property(
      File "/home/jamie/venvs/310/lib/python3.10/site-packages/pulumi/runtime/rpc.py", line 498, in serialize_property
        return {
      File "/home/jamie/venvs/310/lib/python3.10/site-packages/pulumi/runtime/rpc.py", line 499, in <dictcomp>
        k: await serialize_property(
      File "/home/jamie/venvs/310/lib/python3.10/site-packages/pulumi/runtime/rpc.py", line 333, in serialize_property
        element_type = _get_list_element_type(typ)
      File "/home/jamie/venvs/310/lib/python3.10/site-packages/pulumi/runtime/rpc.py", line 162, in _get_list_element_type
        raise AssertionError(f"Unexpected type. Expected 'list' got '{typ}'")
    AssertionError: Unexpected type. Expected 'list' got '<class 'str'>'

Output of pulumi about

CLI          
Version      3.92.0
Go Version   go1.21.3
Go Compiler  gc

Plugins
NAME             VERSION
aws              6.8.0
aws-apigateway   1.0.1
awsx             1.0.2
command          0.9.1
docker           3.1.0
docker-buildkit  0.1.27
gitlab           4.9.0
python           unknown
random           4.14.0
signalfx         5.9.0
vsphere          4.6.1

Host     
OS       ubuntu
Version  22.04
Arch     x86_64

Additional context

Documentation and Error suggest this should be a list, however, it needs to be string.

Pulumi AI also suggests it should be a list.

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).

mikhailshilkov commented 1 year ago

Hi @jamie1911 thank you for raising this.

The docs say the type is str (string) which is correct, it's the description that has confusing language, because it's adapted from the upstream provider where this property is a list of one item. It's fairly hard to adjust the description automatically but maybe we can find a way to do so.

t0yv0 commented 7 months ago

This is currently fixed.

pulumi-bot commented 7 months ago

Cannot close issue:

Please fix these problems and try again.