l

    little-soccer-5693

    1 month ago
    the example code for bucket lifecycle configuration doesn't seem to work. reference: https://www.pulumi.com/registry/packages/aws/api-docs/s3control/bucketlifecycleconfiguration/ I get:
    main.go:365:11: cannot use pulumi.Any(uploadBucket.Arn) (value of type pulumi.AnyOutput) as type pulumi.StringInput in struct literal:
    pulumi.AnyOutput does not implement pulumi.StringInput (missing ToStringOutput method)
    when specifying bucket I've also tried:
    pulumi.Sprintf("arn:aws:s3:::%v", uploadBucket.ID()))
    and
    pulumi.Sprintf("%v", uploadBucket.Arn)
    but both result in a different error:
    aws:s3control:BucketLifecycleConfiguration (mybucket-lifecycle):
    error: 1 error occurred:
    * error parsing S3 Control Bucket ARN (): unknown format
    any suggestions?
    Full source:
    $ cat main.go
    package main
    import (
    "<http://github.com/pulumi/pulumi/sdk/v3/go/pulumi|github.com/pulumi/pulumi/sdk/v3/go/pulumi>"
    s3c "<http://github.com/pulumi/pulumi-aws/sdk/v4/go/aws/s3|github.com/pulumi/pulumi-aws/sdk/v4/go/aws/s3>"
    s3controlc "<http://github.com/pulumi/pulumi-aws/sdk/v4/go/aws/s3control|github.com/pulumi/pulumi-aws/sdk/v4/go/aws/s3control>"
    )
    func createResources(ctx *pulumi.Context) error {
    bucketArgs := &s3c.BucketArgs{
    ForceDestroy: pulumi.Bool(true),
    }
    myBucket, err := s3c.NewBucket(ctx, "mybucket", bucketArgs)
    if err != nil {
    return err
    }
    lifecycleArgs := &s3controlc.BucketLifecycleConfigurationArgs{
    Bucket: pulumi.Sprintf("%v", myBucket.Arn),
    Rules: s3controlc.BucketLifecycleConfigurationRuleArray{
    &s3controlc.BucketLifecycleConfigurationRuleArgs{
    Expiration: &s3controlc.BucketLifecycleConfigurationRuleExpirationArgs{
    Days: <http://pulumi.Int|pulumi.Int>(1),
    },
    Filter: &s3controlc.BucketLifecycleConfigurationRuleFilterArgs{
    Prefix: pulumi.String("uploads/"),
    },
    Id: pulumi.String("Delete Uploads"),
    },
    },
    }
    _, err = s3controlc.NewBucketLifecycleConfiguration(ctx,
    "mybucket-lifecycle", lifecycleArgs)
    if err != nil {
    return err
    }
    return nil
    }
    func main() {
    pulumi.Run(createResources)
    }
    b

    billowy-army-68599

    1 month ago
    @little-soccer-5693 can you try:
    Bucket: myBucket.Arn
    That should be enough
    l

    little-soccer-5693

    1 month ago
    @billowy-army-68599 i tried that before posting the question. I get the error message listed above: aws😒3control:BucketLifecycleConfiguration (mybucket-lifecycle): error: 1 error occurred: * error parsing S3 Control Bucket ARN (): unknown format
    b

    billowy-army-68599

    1 month ago
    @little-soccer-5693 are you passing it an s3control bucket, or a standard s3 bucket?
    (unless you’re using AWS outposts)
    l

    little-soccer-5693

    1 month ago
    when googling for "pulumi bucket lifecycle policy" the first link that comes up is https://www.pulumi.com/registry/packages/aws/api-docs/s3control/bucketlifecycleconfiguration/ is there any way to fix that? will give your suggestion a shot but that looks like the problem.
    b

    billowy-army-68599

    1 month ago
    not sure if we can fix it, I’ll check with the seo team
    there’s a note in the doc though:
    This functionality is for managing S3 on Outposts. To manage S3 Bucket Lifecycle Configurations in an AWS Partition, see the aws.s3.BucketV2 resource.
    l

    little-soccer-5693

    1 month ago
    also looks like NewBucketLifescyleConfigurationV2() isn't in "github.com/pulumi/pulumi-aws/sdk/v4/go/aws/s3" but i found it in "github.com/pulumi/pulumi-aws/sdk/v5/go/aws/s3". in any case thank you for the help!