Skip to content
This repository was archived by the owner on Sep 3, 2024. It is now read-only.
This repository was archived by the owner on Sep 3, 2024. It is now read-only.

[BUG] object keys must be unique #410

@davops

Description

@davops

Describe the bug
When regula is run over a Terraform configuration with two buckets referencing a regex and data resource, it fails with:
FATAL rules/tf/aws/cloudtrail/s3_access_logging.rego:42: eval_conflict_error: object keys must be unique

How you're running Regula

  • I'm using Regula v3.2.1 as a CLI tool and my Terraform source code as an input:
regula run

Operating System
This error occurs on multiple operating systems.

IaC Configuration
Terraform Example:

resource "aws_s3_bucket" "first" {
  bucket = local.first_bucket_name
}

resource "aws_s3_bucket" "second" {
  bucket = local.second_bucket_name
}

locals {
  region             = data.aws_region.current.name
  abbr_region        = join("", regex("(\\w\\w)-(\\w).*-(\\d)", local.region)) # Example: us-east-2 -> use2
  first_bucket_name  = "bucket1-${local.abbr_region}"
  second_bucket_name = "bucket2-${local.abbr_region}"
}

data "aws_region" "current" {}

Additional context
It's only once the second bucket is added that this error message appears.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions