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

Add intercepting sinks to the organization module #2799

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

rshokati2
Copy link

@rshokati2 rshokati2 commented Jan 5, 2025

Allow fabric organization module to intercept audit logging including all child resources. The validation block ensures both intercept_children and include_children as set to true, and the destination 'type' is a 'project'.


Checklist

I applicable, I acknowledge that I have:

  • Read the contributing guide
  • Ran terraform fmt on all modified files
  • Regenerated the relevant README.md files using tools/tfdoc.py
  • Made sure all relevant tests pass

Copy link

google-cla bot commented Jan 5, 2025

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@juliocc juliocc changed the title RS-469: Allow fabric organization module to intercept audit logging Allow organization module to intercept audit logging Jan 6, 2025
@juliocc juliocc changed the title Allow organization module to intercept audit logging Add intercepting sinks to the organization module Jan 6, 2025
Copy link
Collaborator

@juliocc juliocc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rshokati2 Thanks for sending this PR! It's been on my to-do list for a while.

These changes also make sense for the folder module. Could you replicate them there as well?

I've left a few more comments below.

@@ -56,11 +56,19 @@ variable "logging_sinks" {
exclusions = optional(map(string), {})
filter = optional(string)
iam = optional(bool, true)
include_children = optional(bool, true)
include_children = bool
intercept_children = bool
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a breaking change. Anyone currently using the module without specifying include_children will have an error after updating.

Can we keep include_children=optional(bool, true) and intercept_children=optional(bool, false)?

for k, v in var.logging_sinks :
v.intercept_children == false || (v.intercept_children == true && v.include_children == true && v.type == "project")
])
error_message = "if 'intercept_children' = true' then 'include_children' also needs to be true when the logging_sink 'type' is 'project'."
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This validation is already done server-side. I'm not sure we want to replicate it here. @ludoo what do you think?

The condition can be simplified to

    condition = alltrue([
      for k, v in var.logging_sinks :
        !v.intercept_children || (v.include_children && v.type == "project") 
    ])

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

Successfully merging this pull request may close these issues.

3 participants