-
Notifications
You must be signed in to change notification settings - Fork 276
Constraints not being validated correctly #3761
Comments
Thank you for opening an issue. Our team's interrupts engineer will review your issue shortly. Issue Resolution:
|
Hi @stuartgunter, I did a quick test to see if the location was being mangled by Forseti and it appears that the location is correctly being sent to CV. I actually submitted a PR earlier this year to handle some of these issues, but this is not the case here. Can you tell me what the root resource is for your Forseti deployment (or composite resources)? Just curious if you are targeting an org, or a mix of folders/projects. If you are targeting a project (which it kind of looks like you are based on the log output for the bucket data), then the target for the policy constraint needs to be updated. The default for the policies is |
Thanks for looking into this for me. I was targeting a single project using the I will try your suggestion and amend the target for the policy constraint and see if that helps. I had assumed that a target of It's interesting that the constraint (even when targeting I'll test the change you suggested and reply here with more info. Thanks again for your help |
Right, here's a quick update on what I've found based on your advice. Firstly, thanks for the pointers - you're right that the I first tried setting the target to I then tried setting the target to I looked for an authoritative guide on how to specify a With
For now, I've found that the easiest way to avoid these issues is to not specify a target at all and have the constraint apply to everything (at least, that's what I'm assuming it does). This seems to work with TV and CV. It would be great to have more detailed guidance on how to work with |
@stuartgunter Thanks for trying that, I believe the glob is intended to work, but it might not work with the version of latest release of Forseti. In the next release of Forseti, the version of CV is going to be updated and I believe this will work with that version. For now, it looks like using the project target or removing it altogether is the best approach. Config Validator is using the target to match the ancestry path of the resource being scanned. When Forseti is targeting a project instead of an org, then the ancestry path for that resource doesn't have the Organization as part of the path. Sorry for the confusion on this, I thought there was some documentation on this in the Policy Library but I don't see any. I created an issue for this and will try to get to soon, let me know if you need any additional help. |
Great, thanks @gkowalski-google. I'll close this issue and keep an eye on the other one you created. Appreciate all your help. |
Forseti Version: 2.25.1
Module: Config Validator
Deployment mechanism: Terraform (based on setup instructions)
I have constraints that work locally with Terraform Validator but not with Forseti Config Validator. This is an example of one of the constraints (there's another based on
GCPComputeZoneConstraintV1
that has similar issues):I'm running Forseti on GCE and using
git-sync
to pull my policy library directly from a git repo. I've confirmed this is working correctly and the right policy files are in the configured location on the server instance. There are no violations after running the scanner, but I can see resources in the CAI model that violate the policy. The logs show that it's finding resources to scan, but it seems to contain a lot of null-related values. This is what a typical log message looks like when CV runs (I've redacted sensitive data e.g.<PROJECT>
):Due to log truncation I'm unable to know exactly which bucket this is referring to, or even whether the
null_value
permeates throughout the content or just applies to empty maps/lists. I've included an example bucket from the CAI export below:The bucket clearly violates the policy, so I was expecting to see this reported by the notifier but instead I get:
I've looked for CV logs (following the troubleshooting docs) but nothing appears. I was expecting some information there to help diagnose the problem - or even evidence that it's working correctly and the issue may be elsewhere. Unfortunately no logs mean I'm now unsure how to diagnose the problem - or even whether CV is running/being called at all.
Please could someone help me figure out what might be going wrong here?
The text was updated successfully, but these errors were encountered: