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

Running Regula against OPA 0.1x vs 0.2x #51

Closed
parvez84 opened this issue Jun 26, 2020 · 3 comments · Fixed by #52
Closed

Running Regula against OPA 0.1x vs 0.2x #51

parvez84 opened this issue Jun 26, 2020 · 3 comments · Fixed by #52

Comments

@parvez84
Copy link

Hi,

I was testing some rules against some terraform code and noticed two different behaviors. Realized that the OPA version was different in my environments.

simple rules like rules.ebs_volume_encrypted fail in OPA 0.20.0 and 0.21.0 and the same work fine in version 0.19.0

`# New resource for the S3 bucket.

provider "aws" {
region = "us-east-1"

}

resource "aws_s3_bucket" "bucket" {

NOTE: S3 bucket names must be unique across all AWS accounts.

bucket = "sometest"
acl = "private"
versioning {
enabled = true
}

server_side_encryption_configuration {
rule {
apply_server_side_encryption_by_default {
sse_algorithm = "AES256"
}
}
}
tags = {
Name = "regulatest"
}
}

resource "aws_ebs_volume" "example" {
availability_zone = "us-west-2a"
size = 40
encrypted = true

tags = {
Name = "regulatest"
}
}

DB

resource "aws_db_instance" "default" {
allocated_storage = 5
identifier = "demodb-postgres"
engine = "postgres"
engine_version = "9.6.9"
instance_class = "db.t2.large"
name = "demodb"
username = "demouser"
password = "demotest1234"
vpc_security_group_ids = ["sg-0b9e83bf4e0062cf5"]
skip_final_snapshot = true
storage_encrypted = true
db_subnet_group_name = "pc-0076debee908b9286-dbsubnetgroup"

tags = {
Name = "regulatest"
}
}

output "aws_db_address" {
value = "${aws_db_instance.default.address}"
}

Security Rule

resource "aws_security_group_rule" "example" {
type = "ingress"
from_port = 443
to_port = 443
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
security_group_id = "sg-0461a30232b33c576"
}

resource "aws_security_group" "allow_tls" {
name = "allow_rdp"
description = "Allow TLS inbound traffic"
vpc_id = "vpc-0732dd645e9e3167b"

ingress {
description = "TLS from VPC"
from_port = 3389
to_port = 3389
protocol = "tcp"
cidr_blocks = ["10.0.0.0/8"]
}

tags = {
Name = "allow_tls"
}
}`

@alleynec
Copy link
Contributor

I've noticed the same thing with version .20 and .21 and the security group rules.

@jaspervdj-luminal
Copy link
Member

Thanks for reporting this! I've been able to reproduce this issue and it seems like there is a possible regression in OPA 0.20. I've created a bug upstream, but I'll also see if I can provide a workaround in regula so we can get this closed sooner.

@parvez84
Copy link
Author

parvez84 commented Jun 26, 2020 via email

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

Successfully merging a pull request may close this issue.

3 participants