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

[Bug]: Terraform Removes S3 Bucket Grant Permissions Without Code Changes #33100

Closed
dnlchen opened this issue Aug 18, 2023 · 4 comments
Closed
Labels
bug Addresses a defect in current functionality. service/s3 Issues and PRs that pertain to the s3 service.

Comments

@dnlchen
Copy link

dnlchen commented Aug 18, 2023

Terraform Core Version

1.2.9

AWS Provider Version

3.76.1

Affected Resource(s)

aws_s3_bucket

Expected Behavior

no change

Actual Behavior

      - grant {
          - permissions = [
              - "READ_ACP",
              - "WRITE",
            ] -> null
          - type        = "Group" -> null
          - uri         = "http://acs.amazonaws.com/groups/s3/LogDelivery" -> null
        }
      - grant {
          - id          = "0b05843ef4f7ad23454352435ggwergwerrebd5ebfger3425243gfgh" -> null
          - permissions = [
              - "FULL_CONTROL",
            ] -> null
          - type        = "CanonicalUser" -> null
        }

Relevant Error/Panic Output Snippet

No response

Terraform Configuration Files

resource "aws_s3_bucket" "log_bucket" {
  bucket = "${var.env_prefix}${var.env}-${var.service}.${var.domain}-log"

  logging {
    target_bucket = var.s3_access_logs_bucket_name
    target_prefix = "${var.env_prefix}${var.env}-${var.service}.${var.domain}-log/"
  }

  lifecycle_rule {
    id                                     = "CleanupIncompleteMultiPartUploadsAndExpiredObjectDeleteMarkers"
    enabled                                = true
    abort_incomplete_multipart_upload_days = 7

    expiration {
      expired_object_delete_marker = true
    }
  }
}

resource "aws_s3_bucket_ownership_controls" "log_bucket" {
  bucket = aws_s3_bucket.log_bucket.id
  rule {
    object_ownership = "BucketOwnerPreferred"
  }
}

resource "aws_s3_bucket_acl" "log_bucket" {
  depends_on = [aws_s3_bucket_ownership_controls.log_bucket]

  bucket = aws_s3_bucket.log_bucket.id
  acl    = "log-delivery-write"
}

Steps to Reproduce

The bucket was created a while ago and there was no change.
However the Terraform run showed that some grant permissions would be removed.
Was this change by AWS or TF?

Debug Output

No response

Panic Output

No response

Important Factoids

No response

References

No response

Would you like to implement a fix?

None

@dnlchen dnlchen added the bug Addresses a defect in current functionality. label Aug 18, 2023
@github-actions
Copy link

Community Note

Voting for Prioritization

  • Please vote on this issue by adding a 👍 reaction to the original post to help the community and maintainers prioritize this request.
  • Please see our prioritization guide for information on how we prioritize.
  • 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.

Volunteering to Work on This Issue

  • If you are interested in working on this issue, please leave a comment.
  • If this would be your first contribution, please review the contribution guide.

@github-actions github-actions bot added the service/s3 Issues and PRs that pertain to the s3 service. label Aug 18, 2023
@terraform-aws-provider terraform-aws-provider bot added the needs-triage Waiting for first response or review from a maintainer. label Aug 18, 2023
@justinretzolk
Copy link
Member

justinretzolk commented Aug 21, 2023

Hey @dnlchen 👋 Thank you for taking the time to raise this! There have been some somewhat recent changes on the AWS side with regards to bucket permissions (see #28353 for some more information), but I'm unsure if that's what we're seeing here. Are you able to try with a newer version of the provider and/or provide debug logs (redacted as needed)?

@justinretzolk justinretzolk added waiting-response Maintainers are waiting on response from community or contributor. and removed needs-triage Waiting for first response or review from a maintainer. labels Aug 21, 2023
@justinretzolk
Copy link
Member

Since we haven't heard back, I'm going to close this issue. If you're still having trouble, please feel free to open a new issue, referencing this one for context as needed.

@terraform-aws-provider terraform-aws-provider bot removed the waiting-response Maintainers are waiting on response from community or contributor. label Jan 11, 2024
Copy link

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 Feb 11, 2024
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
Development

No branches or pull requests

2 participants