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

aws_s3_bucket perpetual diff in lifecycle_rule expiration block #15138

Closed
lijok opened this issue Sep 14, 2020 · 4 comments · Fixed by #15263
Closed

aws_s3_bucket perpetual diff in lifecycle_rule expiration block #15138

lijok opened this issue Sep 14, 2020 · 4 comments · Fixed by #15263
Labels
bug Addresses a defect in current functionality. service/s3 Issues and PRs that pertain to the s3 service.
Milestone

Comments

@lijok
Copy link

lijok commented Sep 14, 2020

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform CLI and Terraform AWS Provider Version

Terraform v0.13.2
aws provider v3.5.0

Affected Resource(s)

  • aws_s3_bucket

Terraform Configuration Files

resource aws_s3_bucket this {
  bucket              = var.name
  acl                 = "private"
  policy              = data.aws_iam_policy_document.this.json
  request_payer       = "BucketOwner"
  force_destroy       = false
  acceleration_status = "Enabled"

  lifecycle_rule {
    abort_incomplete_multipart_upload_days = 7
    enabled                                = true
    id                                     = "Clean up incomplete multipart uploads"
    tags                                   = {}
  }

  cors_rule {
    allowed_headers = ["*"]
    allowed_methods = [
      "GET",
      "HEAD",
      "POST",
      "PUT"
    ]
    allowed_origins = ["*"]
    expose_headers  = ["ETag"]
    max_age_seconds = 0
  }

  lifecycle {
    prevent_destroy = false
  }
}

Debug Output

  ~ resource "aws_s3_bucket" "this" {
        acceleration_status         = "Enabled"
        acl                         = "private"
        force_destroy               = false
        request_payer               = "BucketOwner"

        cors_rule {
            allowed_headers = [
                "*",
            ]
            allowed_methods = [
                "GET",
                "HEAD",
                "POST",
                "PUT",
            ]
            allowed_origins = [
                "*",
            ]
            expose_headers  = [
                "ETag",
            ]
            max_age_seconds = 0
        }

      ~ lifecycle_rule {
            abort_incomplete_multipart_upload_days = 7
            enabled                                = true
            id                                     = "Clean up incomplete multipart uploads"
            tags                                   = {}

          - expiration {
              - days                         = 0 -> null
              - expired_object_delete_marker = false -> null
            }
        }

        versioning {
            enabled    = true
            mfa_delete = false
        }
    }

Panic Output

Expected Behavior

Actual Behavior

No matter how many times I apply, terraform plan keeps on outputting this diff

Steps to Reproduce

  1. terraform apply
  2. terraform plan

Important Factoids

References

  • #0000
@ghost ghost added the service/s3 Issues and PRs that pertain to the s3 service. label Sep 14, 2020
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Sep 14, 2020
@anGie44 anGie44 added bug Addresses a defect in current functionality. and removed needs-triage Waiting for first response or review from a maintainer. labels Sep 14, 2020
@anGie44
Copy link
Contributor

anGie44 commented Sep 14, 2020

Hi @lijok, thank you for creating this issue! This looks like a result from the upstream API, as it's returning expiration related information while not explicitly configured. A quick remedy in the meantime could be to explicitly add the expiration configuration block to your terraform config, assuming it's still inline with the overall resource configuration.

@LordMike
Copy link

I've just tried the workaround, and it seems to work. I cleared my lifecycle policies and let Terraform recreate them with this block:

  lifecycle_rule {
    id      = "Incomplete uploads"
    enabled = true

    abort_incomplete_multipart_upload_days = 7

    # Bug in terraform means we add this (https://github.com/terraform-providers/terraform-provider-aws/issues/15138)
    expiration {
      days                         = 0
      expired_object_delete_marker = false
    }
  }

I'm seeing what I hoped for in the S3 UI - no "delete after 0 days" rule. 👍

@ghost
Copy link

ghost commented Oct 9, 2020

This has been released in version 3.10.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 for triage. Thanks!

@ghost
Copy link

ghost commented Nov 8, 2020

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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked as resolved and limited conversation to collaborators Nov 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. service/s3 Issues and PRs that pertain to the s3 service.
Projects
None yet
4 participants