Skip to content

Setting '*_key_prefix' variables to empty string results in S3 paths containing pointless duplicit slash "/" #322

@marko-fabry

Description

@marko-fabry

Describe the bug

Setting '*_s3_key_prefix' variables to empty string results in S3 paths containing pointless duplicit slash "/"

Versions

  • Terraform: 1.4.6
  • Provider: 5.0
  • Module: v2.1.0

Reproduction

The following is from the simple example + *_key_prefix variables set to empty string.

module "secure_baseline" {
  source = "nozaq/secure-baseline/aws""

  audit_log_bucket_name           = "test-test-test-audit-log-bucket"
  aws_account_id                  = data.aws_caller_identity.current.account_id
  region                          = var.region
  support_iam_role_principal_arns = []


  audit_log_bucket_force_destroy = true

  cloudtrail_s3_key_prefix    = ""
  config_s3_bucket_key_prefix = ""
  vpc_flow_logs_s3_key_prefix = ""

  providers = {
    aws                = aws
    aws.ap-northeast-1 = aws.ap-northeast-1
    aws.ap-northeast-2 = aws.ap-northeast-2
    aws.ap-northeast-3 = aws.ap-northeast-3
    aws.ap-south-1     = aws.ap-south-1
    aws.ap-southeast-1 = aws.ap-southeast-1
    aws.ap-southeast-2 = aws.ap-southeast-2
    aws.ca-central-1   = aws.ca-central-1
    aws.eu-central-1   = aws.eu-central-1
    aws.eu-north-1     = aws.eu-north-1
    aws.eu-west-1      = aws.eu-west-1
    aws.eu-west-2      = aws.eu-west-2
    aws.eu-west-3      = aws.eu-west-3
    aws.sa-east-1      = aws.sa-east-1
    aws.us-east-1      = aws.us-east-1
    aws.us-east-2      = aws.us-east-2
    aws.us-west-1      = aws.us-west-1
    aws.us-west-2      = aws.us-west-2
  }
}

Expected behavior

The S3 destination paths don't contain double "/".

Actual behavior

The S3 destination paths contain double "/" after the S3 bucket name.

Additional context

I'll submit PR for this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions