Regula checks infrastructure as code templates (Terraform, CloudFormation, k8s manifests) for AWS, Azure, Google Cloud, and Kubernetes security and compliance using Open Policy Agent/Rego
Describe the bug
FG_R00041 is working is as expected if you are creating a new stack. But if you try updating an existing stack which has resource aws_security_group then it'll flag FG_R00041 as a false positive.
Some investigation on my end has revealed that for an existing stack where "address": "aws_security_group.alb", there are ingress definitions defined within the aws_security_group resource in the plan despite the definitions done by aws_security_group_rule resource.
This is not being handled well by regula and is generating a false positive
How you're running Regula
Please include versions of all relevant tools. Some examples:
Regula v3.1.0
TF v0.13.4
AWS v4.55.0
Operating System
Mac
Steps to reproduce
Copy the following terraform configuration to re-create the error:
terraform init
terraform plan -input=false -out=tfplan.txt
terraform show -json tfplan.txt > plan.json
regula run # you will notice there are no issues
# now apply these changes and create a stack
terraform apply -auto-approve
After the stack is created, again run
terraform plan -input=false -out=tfplan.txt
terraform show -json tfplan.txt > plan.json
regula run # you will notice FG_R00041 is raised against `plan.json`
Describe the bug FG_R00041 is working is as expected if you are creating a new stack. But if you try updating an existing stack which has resource
aws_security_group
then it'll flag FG_R00041 as a false positive.Some investigation on my end has revealed that for an existing stack where
"address": "aws_security_group.alb"
, there areingress
definitions defined within theaws_security_group
resource in the plan despite the definitions done byaws_security_group_rule
resource.How you're running Regula Please include versions of all relevant tools. Some examples:
Operating System Mac
Steps to reproduce Copy the following terraform configuration to re-create the error:
main.tf
Then run:
After the stack is created, again run