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

Fix net-firewall-policy factory name and action #1614

Conversation

richard-olson
Copy link
Contributor

Currently the net-firewall-policy module factory implementation doesn't enable customisation of the rule action, nor does it plan correctly due to a missing name attribute.

Customisable action - the action for egress and ingress rules generated using the factory is hardcoded to "deny" and "allow" respectively. The previous net-vpc-firewall-policy module allowed customisation but set deny egress and allow ingress by default, which has been replicated in this PR rather than requiring an explicit action which the HFW set up in the folder module required.

Missing attribute - while the rules passed via .tfvars have a name/direction appended in main.tf the factory rules do not. As the direction for factory rules is assigned in factory.tf, this PR adds the name there too.

│ Error: Unsupported attribute
│
│   on .terraform/modules/firewall-policy/net-global.tf line 43, in resource "google_compute_network_firewall_policy_rule" "net-global":
│   43:   rule_name               = local.rules[each.key].name
│     ├────────────────
│     │ each.key is "egress/internet-deny"
│     │ local.rules is object with 4 attributes
│
│ This object does not have an attribute named "name"

@google-cla
Copy link

google-cla bot commented Aug 23, 2023

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.

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.

Good catch.

Left a couple of comments but otherwise LGTM.

modules/net-firewall-policy/factory.tf Show resolved Hide resolved
modules/net-firewall-policy/factory.tf Show resolved Hide resolved
@juliocc juliocc merged commit d051d41 into GoogleCloudPlatform:master Aug 23, 2023
9 checks passed
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.

None yet

2 participants