-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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 lifecycle encryption versus new aws_s3_bucket_... resources #23758
Comments
Hi @CyrilDevOps , thank you for raising this issue. Do you mind providing the configuration you are working with? Does this behavior persist if the source bucket ( |
I'm seeing that the documentation shows |
This is my s3 module terraform, I have a s3 bucket with a lifecycle rules and encryption with KMS. resource "aws_s3_bucket" "bucket" {
bucket = var.s3.name
tags = var.s3.tags
}
resource "aws_s3_bucket_lifecycle_configuration" "lifecycle" {
bucket = aws_s3_bucket.bucket.id
rule {
id = "cleanup"
status = "Enabled"
abort_incomplete_multipart_upload {
days_after_initiation = 1
}
expiration {
days = 30
}
}
}
resource "aws_s3_bucket_server_side_encryption_configuration" "encryption" {
bucket = aws_s3_bucket.bucket.id
rule {
apply_server_side_encryption_by_default {
kms_master_key_id = var.s3.kms_key_id
sse_algorithm = "aws:kms"
}
bucket_key_enabled = false
}
}
resource "aws_s3_bucket_policy" "policy" {
bucket = aws_s3_bucket.bucket.id
policy = data.aws_iam_policy_document.prevent_unencrypted_uploads.json
} When I do a plan with terraform (aws provider 3.75.0), it try to remove the encyrption and lifecycle rules and policy from the bucket :
If I apply that, the next plan will try to try to set back those config based on the corresponding resources, and then the third plan will try to remove them based on the bucket resource. If I use aws provider 4.6.0, my terraform plan is empty and everything is good and stable. |
Same issue with |
Hi all, this is expected behavior (in |
Hi all noting here that in a upcoming |
Marking this issue as stale due to inactivity. This helps our maintainers find and focus on the active issues. If this issue receives no comments in the next 30 days it will automatically be closed. Maintainers can also remove the stale label. If this issue was automatically closed and you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thank you! |
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. |
Community Note
Terraform CLI and Terraform AWS Provider Version
╰$ terraform -v
Terraform v0.14.11
Affected Resource(s)
Terraform Configuration Files
Please include all Terraform configurations required to reproduce the bug. Bug reports without a functional reproduction may be closed without investigation.
When I configured a the encryption and the lifecycle for my bucket s3 with the new aws_s3_bucket_... resources,
the plan will try to remove it from aws_s3_bucket.
When I applied the plan it removed the configuration in AWS too.
The next plan want to create the aws_s3_bucket_lifecycle_configuration and aws_s3_bucket_server_side_encryption_configuration to setup again lifecycle and encryption in AWS.
Both aws_s3_bucket and aws_s3_bucket_lifecycle_configuration/aws_s3_bucket_server_side_encryption_configuration fight again each other all the time.
Debug Output
Panic Output
Expected Behavior
The configuration made by aws_s3_bucket_lifecycle_configuration/aws_s3_bucket_server_side_encryption_configuration fight must stay and not try to be overwritten by aws_s3_bucket.
Actual Behavior
Can't have a stable setup with encryption and lifecycle with the resource aws_s3_bucket_lifecycle_configuration/aws_s3_bucket_server_side_encryption_configuration fight .
Steps to Reproduce
terraform apply
Important Factoids
References
The text was updated successfully, but these errors were encountered: