cloudposse / terraform-aws-tfstate-backend

Terraform module that provision an S3 bucket to store the `terraform.tfstate` file and a DynamoDB table to lock the state file to prevent concurrent modifications and state corruption.
https://cloudposse.com/accelerate
Apache License 2.0
408 stars 177 forks source link

terraform apply completes successfully with "Warning: Argument is deprecated" #118

Closed gw-versent closed 1 year ago

gw-versent commented 2 years ago

Describe the Bug

terraform apply completed successfully. However, there is a warning in the log that will need attention in future:

╷ │ Warning: Argument is deprecated │ │ with module.terraform_state_backend.module.log_storage.aws_s3_bucket.default, │ on .terraform/modules/terraform_state_backend.log_storage/main.tf line 1, in resource "aws_s3_bucket" "default": │ 1: resource "aws_s3_bucket" "default" { │ │ Use the aws_s3_bucket_logging resource instead │ │ (and 21 more similar warnings elsewhere)

Expected Behavior

No deprecated argument warning.

Steps to Reproduce

Steps to reproduce the behavior:

  1. Add the below to my main.tf
module "terraform_state_backend" {
  source      = "cloudposse/tfstate-backend/aws"
  version     = "0.38.1"
  namespace   = "versent-digital-dev-kit"
  stage       = var.aws_region
  name        = "terraform"
  attributes  = ["state"]

  terraform_backend_config_file_path = "."
  terraform_backend_config_file_name = "backend.tf"
  force_destroy                      = false
}
  1. Run 'terraform apply -auto-approve'
  2. See warning in console output

Screenshots

Screen Shot 2022-07-15 at 13 53 33

vanastassiou commented 2 years ago

Here's a list of all of the deprecated arguments that generated a warning when I ran terraform plan:

→ terraform validate -json | jq '.diagnostics[] | {detail: .detail, filename: .range.filename, start_line: .range.start.line}'
{
  "detail": "Use the attribute \"override_policy_documents\" instead.",
  "filename": ".terraform/modules/terraform_state_backend.log_storage/main.tf",
  "start_line": 159
}
{
  "detail": "Use the attribute \"source_policy_documents\" instead.",
  "filename": ".terraform/modules/terraform_state_backend.log_storage/main.tf",
  "start_line": 158
}
{
  "detail": "Use the aws_s3_bucket_versioning resource instead",
  "filename": ".terraform/modules/terraform_state_backend.log_storage/main.tf",
  "start_line": 1
}
{
  "detail": "Use the aws_s3_bucket_server_side_encryption_configuration resource instead",
  "filename": ".terraform/modules/terraform_state_backend.log_storage/main.tf",
  "start_line": 1
}
{
  "detail": "Use the aws_s3_bucket_policy resource instead",
  "filename": ".terraform/modules/terraform_state_backend.log_storage/main.tf",
  "start_line": 8
}
{
  "detail": "Use the aws_s3_bucket_acl resource instead",
  "filename": ".terraform/modules/terraform_state_backend.log_storage/main.tf",
  "start_line": 6
}
{
  "detail": "Use the aws_s3_bucket_lifecycle_configuration resource instead",
  "filename": ".terraform/modules/terraform_state_backend.log_storage/main.tf",
  "start_line": 1
}
{
  "detail": "Use the aws_s3_bucket_logging resource instead",
  "filename": ".terraform/modules/terraform_state_backend.log_storage/main.tf",
  "start_line": 1
}
{
  "detail": "Use the aws_s3_bucket_acl resource instead",
  "filename": ".terraform/modules/terraform_state_backend/main.tf",
  "start_line": 162
}
{
  "detail": "Use the aws_s3_bucket_logging resource instead",
  "filename": ".terraform/modules/terraform_state_backend/main.tf",
  "start_line": 156
}
{
  "detail": "Use the aws_s3_bucket_server_side_encryption_configuration resource instead",
  "filename": ".terraform/modules/terraform_state_backend/main.tf",
  "start_line": 156
}
{
  "detail": "Use the aws_s3_bucket_versioning resource instead",
  "filename": ".terraform/modules/terraform_state_backend/main.tf",
  "start_line": 156
}
{
  "detail": "Use the aws_s3_bucket_policy resource instead",
  "filename": ".terraform/modules/terraform_state_backend/main.tf",
  "start_line": 164
}
{
  "detail": "Use the aws_s3_bucket_replication_configuration resource instead",
  "filename": ".terraform/modules/terraform_state_backend/main.tf",
  "start_line": 156
}
dejwsz commented 2 years ago

Yes, this needs to be updated in this module as at some point it will stop working with new aws tf provider.

dejwsz commented 2 years ago

something like in this module probably: https://github.com/nozaq/terraform-aws-remote-state-s3-backend

matthewmrichter commented 1 year ago

Any chance the PR could get merged? Or, some other means of addressing these issues?

xophere commented 1 year ago

Yeah I want to use this module but is it deprecated? Why are the PR's to fix these basic errors blocked?