https://pulumi.com logo
#general
Title
# general
d

dry-answer-66872

12/22/2021, 6:28 AM
Hi Team, https://www.pulumi.com/registry/packages/aws/api-docs/s3control/bucketlifecycleconfiguration/ when I try with this example, I am gettingĀ _*NameError: name 'aws_s3control_bucket' is not defined*_ Could anyone help in this regard? I am assuming here ''example' as - Lifecycle Name
Copy code
bucket=aws_s3control_bucket["example"]["arn"],   --> Bucket ARN
l

little-cartoon-10569

12/22/2021, 6:48 AM
That example assumes that you've already created a bucket and it's referred to by the variable
aws_s3control_bucket
.
So you could grab the example code from https://www.pulumi.com/registry/packages/aws/api-docs/s3/bucket/ and change the variable names to match.
d

dry-answer-66872

12/22/2021, 7:03 AM
Thank you for responding @little-cartoon-10569 yes I am creating the bucket and passing the ARN to the variable
Copy code
lifecyle_pol = aws.s3control.BucketLifecycleConfiguration("move_glacier",
    bucket=aws_s3control_bucket[mybucket.bucket_arn],
    rules=[
        aws.s3control.BucketLifecycleConfigurationRuleArgs(
            expiration=aws.s3control.BucketLifecycleConfigurationRuleExpirationArgs(
               bucket=gbis3_bucket.bucket_id,
                days=365,
            ),
        ),
    ])
and getting this NameError: name 'aws_s3control_bucket' is not defined
maybe I should try what you have given in that link will update the thread with results
l

little-cartoon-10569

12/22/2021, 7:18 AM
It's very confusing because it's generated documentation that's been copied around a bit, but In this code in the example:
Copy code
bucket=aws_s3control_bucket["example"]["arn"],
The bucket object is actually
aws_s3control_bucket["example"]
. So if your bucket object is
my_bucket
, then the code would read
Copy code
bucket=my_bucket["arn"],
The example is a bit unfortunate.
šŸ˜‘ 1