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

feat: add hierarchical firewall policy sub-module #553

Conversation

imrannayer
Copy link
Collaborator

No description provided.

@imrannayer imrannayer requested a review from a team as a code owner April 3, 2024 05:41
Copy link
Contributor

@g-awmalik g-awmalik left a comment

Choose a reason for hiding this comment

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

Thanks @imrannayer. Can you help me understand this module a bit better? I left a few comments.

modules/hierarchical-firewall-policy/.gitignore Outdated Show resolved Hide resolved
modules/hierarchical-firewall-policy/README.md Outdated Show resolved Hide resolved
modules/hierarchical-firewall-policy/README.md Outdated Show resolved Hide resolved
target_org = var.org_id
target_folders = [var.folder2, var.folder3]

rules = [
Copy link
Contributor

Choose a reason for hiding this comment

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

How are you associating rules to the respective containers? Based on this diagram it seems like rules can be specified at org/folder/project level but this rules block doesn't have that association.

Can you explain that a bit for me?

Copy link
Collaborator Author

@imrannayer imrannayer Apr 4, 2024

Choose a reason for hiding this comment

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

Firewall policy itself can attach to org or or folder.
Rules can be for specific VMs with service account which are provided as target_service_accounts or you can apply a rule to a specific VPC which is provided as target_resources. These are the only options available for hierarchical firewall policies
example Line 82, 103, 142 and 163.

Copy link
Contributor

Choose a reason for hiding this comment

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

I see. So line 51 and 52 are default targets and additionally a target_resources slice in rules adds an additional FW rule for the for those resources specifically. Did I get that right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Line 51 and 52 applies whole firewall policy (all rules) to folders or an org. But Line 82, 103, 143 and 163 allow users to apply a firewall rule to VMs of specific VPC network of VM with specific service account instead of all the VMs under the folders/org.

@imrannayer imrannayer requested a review from g-awmalik April 4, 2024 23:22
@imrannayer
Copy link
Collaborator Author

@g-awmalik leme know if you need more info?

Thanks

@imrannayer imrannayer merged commit c7c0f07 into terraform-google-modules:master Apr 15, 2024
4 checks passed
@imrannayer imrannayer deleted the feat/hierarchical-firewall-policies branch April 15, 2024 16:59
@imrannayer imrannayer self-assigned this Apr 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants