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

ancient-thailand-47587

12/13/2023, 3:39 PM
Hi, I’m not sure if this is the correct medium to ask if something is a bug. I’m looking at
pulumi_aws/s3/bucket_replication_config.py
. `class BucketReplicationConfig(pulumi.CustomResource).`` pulumi-aws==6.13.0 The first constructor at bucket_replication_config.py:163, the rules argument says it’s optional, however, when I called BucketReplicationConfig with resource_name, bucket, role I get an error/Exception
Copy code
raise TypeError("Missing required property 'rules'")
    TypeError: Missing required property 'rules'
Is this a bug? If so, is this the right place to report it?
d

dry-keyboard-94795

12/13/2023, 4:12 PM
The constructor types aren't as correct as they should be in python, there's an issue tracking it already for improving type hints in general. For now, you could use the Args classes which don't have the Optional problem: https://github.com/pulumi/pulumi-aws/blob/d5769a074562fabb115bd3b8a73e355ce9380c34/sdk/python/pulumi_aws/s3/bucket_replication_config.py#L17
a

ancient-thailand-47587

12/13/2023, 4:15 PM
OK, will try, thank you.
This is my call
Copy code
aws.s3.BucketReplicationConfig(
            resource_name="source-to-replica",
            args=aws.s3.BucketReplicationConfigArgs(
                bucket=destination_bucket_id
                role=replication_role_arn
        )
getting
Copy code
TypeError: BucketReplicationConfigArgs.__init__() missing 1 required keyword-only argument: 'rules'
d

dry-keyboard-94795

12/13/2023, 4:25 PM
Yes, you need to specify rules
a

ancient-thailand-47587

12/13/2023, 4:26 PM
So it’s a documentation bug?
d

dry-keyboard-94795

12/13/2023, 4:27 PM
a

ancient-thailand-47587

12/13/2023, 4:28 PM
Sorry, I was referring back to the question that started the thread.
Copy code
def __init__(__self__,
                 resource_name: str,
                 opts: Optional[pulumi.ResourceOptions] = None,
                 bucket: Optional[pulumi.Input[str]] = None,
                 role: Optional[pulumi.Input[str]] = None,
                 rules: Optional[pulumi.Input[Sequence[pulumi.Input[pulumi.InputType['BucketReplicationConfigRuleArgs']]]]] = None,
                 token: Optional[pulumi.Input[str]] = None,
                 __props__=None):
d

dry-keyboard-94795

12/13/2023, 4:29 PM
Oh. Yes, there's a bug in the code gen that marks all inputs as optional for resources in python. Using the Args class gives you correct types
a

ancient-thailand-47587

12/13/2023, 4:30 PM
Thank you
Sorry, side-bar, the way I’m trying to create bucket replication, is it more or less “depricated” ? I see this “replicatedbucket” https://pypi.org/project/pulumi-aws-s3-replicated-bucket/
d

dry-keyboard-94795

12/13/2023, 4:36 PM
I generally don't use the component packages like what you've just linked. They're not maintained well and rarely add much
a

ancient-thailand-47587

12/13/2023, 4:37 PM
Great, thank you!