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

[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 join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant