-
Notifications
You must be signed in to change notification settings - Fork 109
What if bucket name is dynamic in terraform ? #190
Comments
That's a great question and a good insight -- it's generally not possible to know final IDs of resources, and this also includes e.g. ARNs. This is a big difference in between IaC versus checking actual resources in the cloud (like our SaaS does). However, that doesn't mean that we can't statically analyze these templates. What regula does is use a made-up ID that corresponds to the address in the file, e.g. This can't work in 100% of cases (you always can do complicated things through auxiliary files, or complex functions that we can't predict what the result will be, or fetching info from data resources that we don't have access to...), but our goal is to cover as much as possible within reason. I hope that answered your question! |
Yes it does , I am like stuck in rule "FG_R00031" which is s3 bucket access logging should be enabled on s3 bucket that store cloudtrail log files although the bucket has the logging enabled but still that fails due to the same reason may be :orz: But my s3 bucket do hold the logging enabled 😢 |
@jaspervdj-luminal can you elaborate a little about what conditions make "FG_R00031" --> Failed 😢 |
Also how do we handle exceptions if we writing custom rules , please help 🙇 |
@ninjahck We have instructions for making the rule pass here: https://docs.fugue.co/FG_R00031.html#terraform. Based on your earlier question about bucket names, it is possible that our rule has issues connecting the bucket with the cloudtrail. It is important that the log bucket is somewhere in the I'm not sure about your last question about exceptions: are you referring to runtime exceptions (like throwing an error) or exceptions to compliance (e.g. this single bucket is allowed to pass)? |
@jaspervdj-luminal Below is the code which is not working as you can see it has the logging enabled as well but it says logging must needs to be enabled 🙇
|
Hi, @ninjahck! I'm not able to reproduce What I do see, though, is that |
Hi @jason-fugue , Thanks for the information , one more question I have over here is regarding the rule : FG_R00229 , it seems like if we have a scenario where we are attaching the block_public_access settings by using Below doesn't work for rule FG_R00229
But if I change the terraform below it will work , why so ?
|
Hi, @ninjahck! Whenever you get a chance, could you please confirm that you're using the latest version of regula and describe how you're running it? I'm not able to reproduce this issue with FG_R00229. Both of your examples produce a passing result in my testing, both as Terraform source code and as a plan JSON file. Both of those properties resolve to the bucket name and that rule should accept either one. |
@jason-fugue I am running it from conftest integration by pulling the rego files and running them as policy but that's okay , I also did run it like from regula as well and with latest code available at github |
@ninjahck there was an incompatibility with the latest versions of Terraform that we fixed in the recent v1.6.0 release. I just tried now and I was able to reproduce the issue from your last comment using Terraform v1.0.8 and Regula v1.5.0, but not with Regula v1.6.0. Could you please give the latest version a try when you get a chance and see if that resolves your issue? |
Thanks @jason-fugue I did tested with latest version and it did worked 🙇 hence closing the issue :) |
What I mean is in terraform you can have the bucket where bucket id is not known at the time of
terraform plan
, sometimes you just see in theterraform
plan is likeid: (known after apply)
now this is tricky we wanted to capture the issue at plan but not at apply 🙇So all that policies which works on
id
will fail due to this dynamic thing 🤔Which I think is not really a issue with
regula
but it's an limitation ofopa
as it works on decission not on processing the file and it's to get that , so yeah btw is there any possibility that we can handle this from regula ?The text was updated successfully, but these errors were encountered: