Repository navigation
Conversation
|
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. |
|
刚 force push 了 erraform fmt 修复 Repository Lint(for_each map key 对齐)。CI 会重新跑。 |
|
Hi, I just signed the Google Contributor License Agreement (CLA). Could someone please re-run the \cla/google\ check? Thanks! |
aghassemlouei
left a comment
There was a problem hiding this comment.
Thank you for putting together the Stage 2 networking and NGFW crypto profile fixes for #370. Running terraform init and terraform validate across both Stage 2 networking directories surfaced two issues:
fast/stages-aw/2-networking-b-il5-ngfw/psc.tf, which is also symlinked fromfast/stages-aw/2-networking-a-fedramp/psc.tf, combinesfor_eachandcounton the same resource blocks and indexesvar.psa_rangeswithoutlower(k), failing HCL parsing duringterraform initacross both Stage 2 networking flavors.- Please align metadata string formatting in
ngfw.tf, keep<log-end>yes</log-end>without<log-start>yes</log-start>inbootstrap.xml.tplunless session-start logging is explicitly desired, and populate the.github/pull_request_template.mdsections.
Pushing a new commit with these fixes will also re-trigger the cla/google check against the signed Contributor License Agreement.
| resource "google_compute_global_address" "private_service_connect_ip" { | ||
| for_each = var.envs_folders | ||
|
|
||
| project = module.env-spoke-vpc[each.key].project_id | ||
| project = module.env-spoke-projects[each.key].project_id | ||
| name = "default-peering" | ||
| purpose = "VPC_PEERING" | ||
| address_type = "INTERNAL" | ||
| prefix_length = 22 | ||
| network = module.env-spoke-vpc[each.key].self_link | ||
| count = try(length(var.psa_ranges[each.key]), 0) == 0 ? 1 : 0 | ||
| } | ||
|
|
||
| resource "google_service_networking_connection" "default" { | ||
| for_each = var.envs_folders | ||
| network = module.env-spoke-vpc[each.key].self_link | ||
| service = "servicenetworking.googleapis.com" | ||
| reserved_peering_ranges = [google_compute_global_address.private_service_connect_ip[each.key].name] | ||
| count = try(length(var.psa_ranges[each.key]), 0) == 0 ? 1 : 0 | ||
| } |
There was a problem hiding this comment.
Combining for_each and count on the same resource block is invalid in Terraform and fails both 2-networking-b-il5-ngfw and 2-networking-a-fedramp via its psc.tf symlink with The "count" and "for_each" meta-arguments are mutually-exclusive, and each.key cannot be referenced inside count. In addition, var.psa_ranges in variables.tf uses lowercase dev and prod object attributes whereas var.envs_folders keys may be capitalized, matching lower(k) in variables.tf at line 341.
Filter the for_each map directly on both resources:
| resource "google_compute_global_address" "private_service_connect_ip" { | |
| for_each = var.envs_folders | |
| project = module.env-spoke-vpc[each.key].project_id | |
| project = module.env-spoke-projects[each.key].project_id | |
| name = "default-peering" | |
| purpose = "VPC_PEERING" | |
| address_type = "INTERNAL" | |
| prefix_length = 22 | |
| network = module.env-spoke-vpc[each.key].self_link | |
| count = try(length(var.psa_ranges[each.key]), 0) == 0 ? 1 : 0 | |
| } | |
| resource "google_service_networking_connection" "default" { | |
| for_each = var.envs_folders | |
| network = module.env-spoke-vpc[each.key].self_link | |
| service = "servicenetworking.googleapis.com" | |
| reserved_peering_ranges = [google_compute_global_address.private_service_connect_ip[each.key].name] | |
| count = try(length(var.psa_ranges[each.key]), 0) == 0 ? 1 : 0 | |
| } | |
| resource "google_compute_global_address" "private_service_connect_ip" { | |
| for_each = { | |
| for k, v in var.envs_folders : k => v | |
| if length(try(var.psa_ranges[lower(k)], [])) == 0 | |
| } | |
| project = module.env-spoke-projects[each.key].project_id | |
| name = "default-peering" | |
| purpose = "VPC_PEERING" | |
| address_type = "INTERNAL" | |
| prefix_length = 22 | |
| network = module.env-spoke-vpc[each.key].self_link | |
| } | |
| resource "google_service_networking_connection" "default" { | |
| for_each = { | |
| for k, v in var.envs_folders : k => v | |
| if length(try(var.psa_ranges[lower(k)], [])) == 0 | |
| } | |
| network = module.env-spoke-vpc[each.key].self_link | |
| service = "servicenetworking.googleapis.com" | |
| reserved_peering_ranges = [google_compute_global_address.private_service_connect_ip[each.key].name] | |
| } |
| serial-port-enable = false | ||
| serial-port-logging-enable = true | ||
| block-project-ssh-keys = "true" |
There was a problem hiding this comment.
GCE instance metadata expects map(string), so use consistent string literals such as "false" and "true" across serial-port-enable, serial-port-logging-enable, and block-project-ssh-keys.
| <log-start>yes</log-start> | ||
| <log-end>yes</log-end> |
There was a problem hiding this comment.
PAN-OS best practice and item 4 of #370 require <log-end>yes</log-end>, which records complete session byte counts, NAT translations, and termination reason; enabling <log-start>yes</log-start> on a broad allow rule doubles firewall traffic log volume without adding audit fields beyond the session-end record.
|
Hi maintainers! @GoogleCloudPlatform/foundation-framework 👋 This PR is all green (no conflicts, CI passing) and has been rebased on latest. Could someone take a look when you have a moment? Thanks! |
Handing off review to @pulsingSignal.
… NGFW - outputs.tf: fix host_project_ids to reference env-spoke-projects instead of env-spoke-vpc - psc.tf: use env-spoke-projects for project_id, add conditional count to skip duplicate peering when psa_ranges configured - ngfw.tf: use each.value for region, disable serial port, add block-project-ssh-keys - bootstrap.xml.tpl: replace weak default crypto profiles with AES-256-GCM/SHA-384/DH-group20, add session logging
13c7654 to
b5e7033
Compare
|
@LeonxLJX Hello, thank you for the contribution so far. Please let us know if you are able to reconcile all outstanding comments/conversations related to the submitted code for this PR. If you are not able to resolve them by Friday, we will close this PR as the review is becoming stale. |
Fixes #370.
Summary
This PR addresses functional and security defects in
fast/stages-aw/2-networking-a-fedrampandfast/stages-aw/2-networking-b-il5-ngfw.Changes Made
Both networking stages
outputs.tf: Changed
host_project_idsfrommodule.env-spoke-vpc(the VPC module output, which does not provide project_id) to[for k, v in module.env-spoke-projects : v.project_id], producing a list of spoke project IDs that downstream Stage 3 VPC Service Controls configuration requires.psc.tf: Fixed
google_compute_global_address.projectfrommodule.env-spoke-vpc[each.key].project_idtomodule.env-spoke-projects[each.key].project_id. Addedcountcondition (try(length(var.psa_ranges[each.key]), 0) == 0 ? 1 : 0) to skip duplicate peering allocation whenpsa_rangesare already configured on a spoke VPC.NGFW stage only
ngfw.tf:
regionfrom hardcodedvar.regions["primary"]toeach.valueso template mirrors the iteration region.serial-port-enablefromtruetofalseto disable serial console access.block-project-ssh-keys = "true"metadata entry to prevent project-wide SSH keys on NGFW instances.bootstrap.xml.tpl:
<log-start>yes</log-start>and<log-end>yes</log-end>to the Trust-to-Untrust security rule for session audit logging.Security Impact
project_idon VPC module output