pulumi-aws
pulumi-aws copied to clipboard
Cannot bypass `prefix is deprecated` warning for `BucketLifecycleConfigurationV2`
What happened?
After updating pulumi-aws from v5.37.0 to 6.6.0 I got warning when creating aws.s3.BucketLifecycleConfigurationV2.
Diagnostics:
pulumi:pulumi:Stack (apps-dev):
warning: prefix is deprecated: Use filter instead
I understand, that prefix is deprecated and if nothing is set it defaults to prefix anyway (also not great imo).
So I tried specifying an empty filter and still got the warning.
I also tried setting prefix=None specifically and setting filter=aws.s3.BucketLifecycleConfigurationV2RuleFilterArgs(object_size_greater_than=0), but to no effect.
The terraform docs also recommend to specify an empty filter.
Example
Here is a minimal example (opts can be deleted and are only there for my env:
bucket = aws.s3.BucketV2("test-bucket", opts=default_resource_options)
configuration = aws.s3.BucketLifecycleConfigurationV2(
"test-config",
bucket=bucket,
rules=[
aws.s3.BucketLifecycleConfigurationV2RuleArgs(
id="test-args",
status="Enabled",
# If no filter is defined it will default to prefix which is deprecated --> warning
# https://www.pulumi.com/registry/packages/aws/api-docs/s3/bucketlifecycleconfigurationv2/#filter_python
filter=aws.s3.BucketLifecycleConfigurationV2RuleFilterArgs(),
# prefix=None
)
],
opts=default_resource_options
)
Output of pulumi about
$ pulumi about
CLI
Version 3.90.0
Go Version go1.21.3
Go Compiler gc
Host
OS debian
Version 11.7
Arch x86_64
Backend
Name <ORG_NAME>
URL <OUR_URL>
User vscode
Organizations
Token type personal
Additional context
pulumi==3.90.0 pulumi-aws==6.6.0
Slack thread: https://pulumi-community.slack.com/archives/CRH5ENVDX/p1698152929361379
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).
Yeah, I can reproduce this issue easily, thank you for reporting this. I'm not yet sure why it occurs, we'll need to investigate.
I have the same problem with pulumi-aws 6.18.0. I try to remove 'prefix' and 'filter' and the strange behavior is that pulumi keeps showing me an update without real diff. Refresh doesn't show any changes and the update try to update the BucketReplicationConfig every time
Thanks for looking at this @corymhall ! There look like a few potentially tangled issues here, I'm going to add a few things I can observe quickly.
Even before we get to state transitions, this simple program emits a nonsense warning on preview:
import pulumi_aws as aws
bucket = aws.s3.BucketV2("test-bucket")
configuration = aws.s3.BucketLifecycleConfigurationV2(
"test-config",
bucket=bucket,
rules=[
aws.s3.BucketLifecycleConfigurationV2RuleArgs(
id="test-args",
status="Enabled",
# If no filter is defined it will default to prefix which is deprecated --> warning
# https://www.pulumi.com/registry/packages/aws/api-docs/s3/bucketlifecycleconfigurationv2/#filter_python
# filter=aws.s3.BucketLifecycleConfigurationV2RuleFilterArgs(),
# prefix=None
)
],
)
# Diagnostics:
# pulumi:pulumi:Stack (aws-2915-dev):
# warning: prefix is deprecated: Use filter instead
Note that the warning is not rooted in the resource and is instead attributed to pulumi:pulumi:Stack which is also wrong. I tried finding it in the PULUMI_DEBUG_GRPC log and could not which means the bridge is emitting the warning through another channel, I suspect that gRPC messages from the provider to the engine are not captured yet.
https://github.com/pulumi/terraform-plugin-sdk/blob/upstream-v2.29.0/helper/schema/schema.go#L2344 is likely where this is coming from.
I'm curious why this runs even if there is no value provided.
@t0yv0 it looks like the issue is exclusive to python. I've tried it both in TypeScript and Go and there are no warnings.
I've traced the issue to this getter which logs a warning. https://github.com/pulumi/pulumi-aws/blob/fcacac695a86dd199c6e25682b8e16b251725bb6/sdk/python/pulumi_aws/s3/_inputs.py#L1071-L1072
The getter is called when it converts the input type to a dict type https://github.com/pulumi/pulumi/blob/f1f4d223f4ad275f7ade1e34b6229931cf7636ac/sdk/python/lib/pulumi/_types.py#L511-L527
Also looks like this is already being tracked here https://github.com/pulumi/pulumi/issues/15894
@corymhall Should we close this issue as a duplicate? Or is it any different from https://github.com/pulumi/pulumi/issues/15894?
Yeah we should close it as duplicate.