Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

resource/aws_s3_bucket: Add top-level object_lock_enabled parameter #23549

Closed
gdavison opened this issue Mar 7, 2022 · 2 comments · Fixed by #23556
Closed

resource/aws_s3_bucket: Add top-level object_lock_enabled parameter #23549

gdavison opened this issue Mar 7, 2022 · 2 comments · Fixed by #23556
Labels
enhancement Requests to existing resources that expand the functionality or scope. service/s3 Issues and PRs that pertain to the s3 service.
Milestone

Comments

@gdavison
Copy link
Contributor

gdavison commented Mar 7, 2022

Description

As part of the v4.0 S3 refactoring, we deprecated all of the fields of the block object_lock_configuration other than object_lock_enabled. In the AWS API, the CreateBucketInput struct has a parameter ObjectLockEnabledForBucket which we set when object_lock_configuration.object_lock_enabled is set.

With the pre-v4.0 design, this avoided setting object_lock_enabled twice, however, with the v4.0 design, we can remove the block and move the parameter to the top level. The entire object_lock_configuration block can be deprecated.

Pre-v4.0 configuration

resource "aws_s3_bucket" "example" {
  bucket = "example-bucket"

  object_lock_configuration {
    object_lock_enabled = "Enabled"
  }
}

v4.0 design

resource "aws_s3_bucket" "test" {
  bucket = %[1]q

  object_lock_configuration {
    object_lock_enabled = "Enabled"
  }

  lifecycle {
    ignore_changes = [object_lock_configuration[0].rule]
  }
}

resource "aws_s3_bucket_object_lock_configuration" "test" {
  bucket = aws_s3_bucket.test.id
}

###Affected Resource

  • aws_s3_bucket

Potential Terraform Configuration

Move the parameter object_lock_enabled to the top level. I.e.

resource "aws_s3_bucket" "test" {
  bucket = %[1]q

  object_lock_enabled = true

  lifecycle {
    ignore_changes = [object_lock_configuration]
  }
}

resource "aws_s3_bucket_object_lock_configuration" "test" {
  bucket = aws_s3_bucket.test.id
}
@gdavison gdavison added the enhancement Requests to existing resources that expand the functionality or scope. label Mar 7, 2022
@github-actions github-actions bot added the service/s3 Issues and PRs that pertain to the s3 service. label Mar 7, 2022
@github-actions github-actions bot added this to the v4.5.0 milestone Mar 9, 2022
@github-actions
Copy link

This functionality has been released in v4.5.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

@github-actions
Copy link

github-actions bot commented May 9, 2022

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 9, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Requests to existing resources that expand the functionality or scope. service/s3 Issues and PRs that pertain to the s3 service.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant