pulumi-aws icon indicating copy to clipboard operation
pulumi-aws copied to clipboard

Python type annotations don't match non-deprecated types

Open sean1588 opened this issue 1 year ago • 1 comments

From a member in community slack:

https://pulumi-community.slack.com/archives/CLBMM3BS9/p1715116958335259

various features in https://www.pulumi.com/registry/packages/aws/api-docs/s3/bucketv2/ e.g. websites the docs say: Deprecated: Use the aws.s3.BucketWebsiteConfigurationV2 resource instead but the type annotations (for Python) say Sequence[BucketV2WebsiteArgs] so you get a type error if you use the non-deprecated form then at deploy time (with BucketV2WebsiteArgs to match the type annotations) I get: verification warning: Use the aws_s3_bucket_website_configuration resource instead which I guess is the Terraform version of the deprecation in the docs the type annotation makes it unclear whether new form is even usable yet

sean1588 avatar May 17 '24 20:05 sean1588

I'm sorry the documentation is not clearer at the moment.

This form is supported but emits a deprecation warning as it is deprecated in pulumi-aws following the upstream deprecation:

import pulumi
from pulumi_aws import s3

bucket = s3.BucketV2('my-bucket', websites=[
    s3.BucketV2WebsiteArgs(
        index_document='index.html'
    ),
])

This is the recommended form which also works and continues to be supported:

bucket2 = s3.BucketV2('my-bucket-2')

s3.BucketWebsiteConfigurationV2('my-bucket-website-config',
                                bucket=bucket2.bucket,
                                index_document=s3.BucketWebsiteConfigurationV2IndexDocumentArgs(
                                    suffix="index.html",
                                ))

Do you have a repro for "getting a type error" or a suggestion what we can change here?

CLI          
Version      3.111.1
Go Version   go1.22.1
Go Compiler  gc

Plugins
NAME    VERSION
aws     6.36.0
python  unknown

Host     
OS       darwin
Version  14.4.1
Arch     arm64

This project is written in python: executable='/Users/anton/Library/Mobile Documents/com~apple~CloudDocs/pulumi-bugs/aws-3961/venv/bin/python3' version='3.10.13'

Current Stack: anton-pulumi-corp/aws-3961/dev

TYPE                                                              URN
pulumi:pulumi:Stack                                               urn:pulumi:dev::aws-3961::pulumi:pulumi:Stack::aws-3961-dev
pulumi:providers:aws                                              urn:pulumi:dev::aws-3961::pulumi:providers:aws::default_6_36_0
aws:s3/bucketV2:BucketV2                                          urn:pulumi:dev::aws-3961::aws:s3/bucketV2:BucketV2::my-bucket-2
aws:s3/bucketWebsiteConfigurationV2:BucketWebsiteConfigurationV2  urn:pulumi:dev::aws-3961::aws:s3/bucketWebsiteConfigurationV2:BucketWebsiteConfigurationV2::my-bucket-website-config


Found no pending operations associated with dev

Backend        
Name           pulumi.com
URL            https://app.pulumi.com/anton-pulumi-corp
User           anton-pulumi-corp
Organizations  anton-pulumi-corp, moolumi, pulumi
Token type     personal

Dependencies:
NAME        VERSION
pip         24.0
pulumi_aws  6.36.0
setuptools  69.5.1
wheel       0.43.0

Pulumi locates its logs in /var/folders/gd/3ncjb1lj5ljgk8xl5ssn_gvc0000gn/T/com.apple.shortcuts.mac-helper// by default

t0yv0 avatar May 20 '24 19:05 t0yv0