Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
marko-fabry opened this issue Oct 27, 2023 · 0 comments · May be fixed by #323
Labels
bug Something isn't working

Comments

@marko-fabry
Copy link

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.

@marko-fabry marko-fabry added the bug Something isn't working label Oct 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
1 participant