Recreation of aws_s3_bucket resource after every terraform apply

Updated the Terraform AWS provider from v3.41.0 to v3.75.2 . I had created a module for aws_s3_bucket which contains cors_rule, replication_configuration, server_side_encyption_configuration, liffecycle_rule, versioning, and logging parameters, which has now been deprecated and converted to the resources.

When I call this module to create a S3 bucket, It successfully creates the bucket.

cors_rule,
replication_configuration,
server_side_encyption_configuration,
lifecycle_rule

Every time when terraform plan or apply is executed above mentioned resources are set to null irrespective of the values mentioned in the code, but when verified from the AWS console, no changes were made to the s3 bucket.

What can be the possible reason for this problem and how can it be resolved?

You need to post the output of terraform plan of people are to be able to help here.

Terraform will tell you why it is replacing a resource in that output.

This is a part of the output generated after the terraform plan, as following output is setting the values to null, but after terraform apply these values are not set null verified from AWS console.

  - cors_rule {
      - allowed_headers = [] -> null
      - allowed_methods = [
          - "GET",
        ] -> null
      - allowed_origins = [
          - "*",
        ] -> null
      - expose_headers  = [] -> null
      - max_age_seconds = 3000 -> null
    }

  - replication_configuration {
      - role = "arn:...." -> null

      - rules {
          - id       = "replication-rule" -> null
          - priority = 0 -> null
          - status   = "Enabled" -> null

          - destination {
              - bucket        = "arn:replica" -> null
              - storage_class = "Standard" -> null
            }

          - filter {
              - tags = {} -> null
            }
        }
    }

You’ve not included the important bits that would enable people to help. Please include at least the entire resource.