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

[BUG] object keys must be unique #410

Open
davops opened this issue Jul 6, 2023 · 0 comments
Open

[BUG] object keys must be unique #410

davops opened this issue Jul 6, 2023 · 0 comments

Comments

@davops
Copy link

davops commented Jul 6, 2023

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant