terraform-aws-alb icon indicating copy to clipboard operation
terraform-aws-alb copied to clipboard

Tons of s3 "argument is deprecated" warnings

Open nk9 opened this issue 2 years ago • 1 comments

Describe the Bug

Create an ALB and plan it, and you will get 15 warnings about deprecated S3 arguments. Example:

Warning: Argument is deprecated
with module.project_module.module.alb.module.access_logs.module.s3_bucket.aws_s3_bucket.default
on .terraform/modules/project_module.alb.access_logs.s3_bucket/main.tf line 1, in resource "aws_s3_bucket" "default":

resource "aws_s3_bucket" "default" {

Use the aws_s3_bucket_lifecycle_configuration resource instead

Expected Behavior

No warnings.

Steps to Reproduce

provider "aws" {
  region = var.region
}

# Fetch the pre-existing domain certificate
data "aws_acm_certificate" "domain_cert" {
  domain      = var.domain
  statuses    = ["ISSUED"]
  most_recent = true
}

module "alb" {
  source  = "cloudposse/alb/aws"
  version = "1.1.0"

  attributes = ["alb"]
  tags       = { "declaration" : "alb" }

  vpc_id             = module.vpc.vpc_id
  security_group_ids = [module.vpc.vpc_default_security_group_id]
  subnet_ids         = module.subnets.public_subnet_ids
  internal           = false

  target_group_port = 5000
  http2_enabled   = true
  https_enabled   = true
  certificate_arn = data.aws_acm_certificate.domain_cert.arn
  http_redirect   = true

  access_logs_enabled                     = true
  alb_access_logs_s3_bucket_force_destroy = true
  cross_zone_load_balancing_enabled       = true
  deletion_protection_enabled             = false

  health_check_interval = 30

  context = module.this.context
}

Screenshots

Screenshot 2022-05-12 at 12 40 42

Environment (please complete the following information):

I'm using Terraform Cloud with Terraform 1.1.9

Additional Context

This is presumably related to the changes to the AWS 4 provider. terraform-aws-s3-bucket has been updated (latest version 2.0.1) but the module this module relies upon (aws-lb-s3-bucket) hasn't been updated.

nk9 avatar May 12 '22 11:05 nk9

Hi @nk9 . This will take some time to complete. The underlying s3 bucket module has been upgraded and no longer contains these deprecated arguments but a lot of our child modules that consume the s3 bucket module have not been upgraded yet.

Currently this module consumes cloudposse/lb-s3-bucket/aws

https://github.com/cloudposse/terraform-aws-alb/blob/bce6ca20fb8813db320b8b0e9ba1066c063948ac/main.tf#L41-L43

Which consumes cloudposse/lb-s3-bucket/aws

https://github.com/cloudposse/terraform-aws-lb-s3-bucket/blob/4bd8e00b6baa2c885afc194cf6d03efd8addc7f1/main.tf#L61-L63

Which consumes cloudposse/s3-bucket/aws and this currently uses 0.x instead of the latest

https://github.com/cloudposse/terraform-aws-s3-log-storage/blob/cb983370a2fcfefac4731d6d06d232ee246b59b5/main.tf#L52-L54

See the latest s3-bucket module version

https://github.com/cloudposse/terraform-aws-s3-bucket

nitrocode avatar Jun 27 '22 23:06 nitrocode