terraform-aws-modules / terraform-aws-s3-bucket

Terraform module to create AWS S3 resources 🇺🇦

Home Page:https://registry.terraform.io/modules/terraform-aws-modules/s3-bucket/aws

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

aws_s3_bucket_replication_configuration resource getting deprecation warning

jim-leary opened this issue · comments

Description


│ Warning: Argument is deprecated

│ with module.terraform_state_s3_bucket.aws_s3_bucket_replication_configuration.this[0],
│ on .terraform/modules/terraform_state_s3_bucket/main.tf line 353, in resource "aws_s3_bucket_replication_configuration" "this":
│ 353: resource "aws_s3_bucket_replication_configuration" "this" {

│ Use filter instead

If your request is for a new feature, please use the Feature request template.

  • I have searched the open/closed issues and my issue is not listed.

⚠️ Note

Before you submit an issue, please perform the following first:

  1. Remove the local .terraform directory (! ONLY if state is stored remotely, which hopefully you are following that best practice!): rm -rf .terraform/
  2. Re-initialize the project root to pull down modules: terraform init
  3. Re-attempt your terraform plan or apply and check if the issue still persists

Versions

  • Module version [Required]:
    v3.1.0
  • Terraform version:
    v1.1.8
  • Provider version(s):
    v.4.10.0

Reproduction Code [Required]

module "terraform_state_s3_bucket" {
source = "terraform-aws-modules/s3-bucket/aws"
version = "3.1.0"
bucket = local.s3_bucket
acl = "private"
force_destroy = true
attach_policy = true
policy = data.aws_iam_policy_document.s3_default_policy_document.json

versioning = {
enabled = true
}

block_public_acls = true
block_public_policy = true
ignore_public_acls = true
restrict_public_buckets = true

server_side_encryption_configuration = {
rule = {
apply_server_side_encryption_by_default = {
kms_master_key_id = aws_kms_key.key.arn
sse_algorithm = "aws:kms"
}
}
}

tags = {
Backup = true
}

replication_configuration = {
role = aws_iam_role.replication.arn

rules = [{
    id       = "replication"
    status   = "Enabled"
    prefix   = "/"
    priority = "10"
    delete_marker_replication = true

    source_selection_criteria = {
      sse_kms_encrypted_objects = {
        enabled = true
      }
    }
    
    filter = {
      prefix = ""
    }

    destination = {
      bucket             = module.terraform_state_s3_bucket_repl.s3_bucket_arn
      storage_class      = "STANDARD_IA"
      replica_kms_key_id = aws_kms_key.key.arn
    }
}]

}

lifecycle_rule = [
{
id = "backup"
enabled = true
prefix = "backup/"

    tags = {
      rule      = "backup"
      autoclean = "true"
    }

    expiration = {
      days = 30
    }
  }
]

}

Steps to reproduce the behavior:

Default workspace
Cleared / re-initialized cache
init/plan

Expected behavior

No deprecation warnings

Actual behavior

Deprecation warnings

Terminal Output Screenshot(s)

Additional context

Hi Jim,

Please take a look at the code in examples folder. I am pretty sure you will find the correct snippet there.

As it turns out, the issue is with aws_s3_bucket_replication_configuration. Specifying "prefix" in the replication rule and overrides the "filter" block, which in turn triggers the deprecation warning.

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.