https://pulumi.com logo
Title
b

boundless-van-74484

03/09/2023, 7:45 PM
EDIT: Resolved in thread. Ended up using the
lifecycleRules
property within aws.s3.Bucket Hey everyone, I’m trying to create a
BucketLifecycleConfiguration
resource for an existing S3 bucket and I’m running into this error when the lifecycle config resource is attempting to create
aws:s3control:BucketLifecycleConfiguration (lifecycle-config):
    error: 1 error occurred:
    	* error parsing S3 Control Bucket ARN (): unknown format
Here’s how I am creating the resources:
const bucket = new aws.s3.Bucket('bucket-name', {
    acl: 'private',
    corsRules: [
      {
        allowedHeaders: ['Content-Type', 'Content-Disposition'],
        allowedMethods: ['PUT', 'GET', 'HEAD'],
        allowedOrigins: [`https://${config.require('webPublicDomain')}`],
        exposeHeaders: [
          'Content-Type',
          'Content-Disposition',
          'x-amz-id-2',
          'x-amz-request-id',
          'x-amz-server-side-encryption',
          'ETag',
        ],
        maxAgeSeconds: 3000,
      },
    ],
    serverSideEncryptionConfiguration: {
      rule: {
        applyServerSideEncryptionByDefault: {
          sseAlgorithm: 'AES256',
        },
      },
    },
    versioning: {
      enabled: true,
    },
  });

  new aws.s3.BucketPublicAccessBlock('access-block', {
    bucket: bucket.id,
    ignorePublicAcls: true,
    restrictPublicBuckets: true,
    blockPublicAcls: true,
    blockPublicPolicy: true,
  });

  new aws.s3control.BucketLifecycleConfiguration('lifecycle-config', {
    bucket: bucket.arn,
    rules: [
      {
        id: 'my-rule',
        abortIncompleteMultipartUpload: {
          daysAfterInitiation: 2,
        },
      },
    ],
  });
The only thing I’ve added is the
aws.s3control.BucketLifecycleConfiguration
resource. When I run
pulumi preview --diff
locally, the correct bucket ARN for the lifecycle config resource is shown and there are no errors. When I run
pulumi up --yes
in CI, I get that error. Both local and CI versions are 3.57.1. Any help is appreciated!
d

dry-journalist-60579

03/09/2023, 8:02 PM
hmm what’s the difference between aws.s3.BucketLifecycleConfigurationV2 and aws.s3control.BucketLifecycleConfiguration
weird that one takes the bucket.id and the other the arn
l

little-cartoon-10569

03/09/2023, 8:03 PM
Neither takes the ID, V2 takes the name, I think?
l

little-cartoon-10569

03/09/2023, 8:03 PM
Yes. That link says
bucket Changes to this property will trigger replacement. string
The name of the source S3 bucket you want Amazon S3 to monitor.
d

dry-journalist-60579

03/09/2023, 8:04 PM
heh, well the example usage uses
.id
🤷
l

little-cartoon-10569

03/09/2023, 8:04 PM
I've never understood why the old types are still in the .d.ts files, and actively used...
Huh, so it does. I've never looked at a bucket id, maybe it is the name?
b

boundless-van-74484

03/09/2023, 8:16 PM
I tried swapping the arn for the bucket ID earlier but that threw an error right away with
pulumi preview
I just discovered the
lifecycleRules
property on aws.s3.Bucket… aaand it worked lol. Not sure why there’s all of Bucket.lifecycleRules, BucketLifecycleConfiguration, and BucketLifecycleConfigurationV2