Repository navigation
Conversation
- dataflow: fix network reference from var.network_project_id to var.network_name - gke(il5): set private_nodes = true instead of variable reference - gke-hardened: truncate SA account_id to 30 chars, fix secret_type to gcenode - gitlab: switch LB protocol to HTTPS/443, create dedicated node service account - wire node SA into compute network user and KMS crypto key IAM bindings
|
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.
Appreciate the work addressing the il5 and fedramp-high blueprint defects. Running terraform plan across the touched blueprints surfaced four functional and deployment gaps documented inline:
blueprints/fedramp-high/gitlab/main.tfomitsproject = var.project_idongoogle_service_account.gitlab_node_saandgitlab_saunlike the sibling resources in the file, leavessubstr(..., 0, 30)susceptible to a trailing hyphen at character 30, and omits the baseline GKE node service account IAM roles ongitlab_node_sa.blueprints/il5/dataflow/main.tfpasses barevar.network_nametogoogle_dataflow_job.jobalongside a Shared VPC subnetwork invar.network_project_idand omitsproject = var.main_project_idplus trailing-hyphen trimming ongoogle_service_account.dataflow_worker.blueprints/il5/gke-hardened/main.tfcan produce a trailing hyphen insubstr(..., 0, 30)and hardcodes Config Syncsecret_type = "gcenode", which breaks external Git repositories such as GitHub or GitLab;blueprints/il5/gke/main.tfalso leavesgke-sa-${var.gke_cluster_name}untruncated.- The description uses
Fixes #373.while items 2, 3, and 4 of #373 incloud-translation,document-ai, andil5/kms-projectremain open, and omits the.github/pull_request_template.mdsections. Please switchFixes #373.toPart of #373.unless those items are included, and populate the pull request template.
Pushing a new commit with these updates will also re-trigger the cla/google check against the signed Contributor License Agreement.
| resource "google_service_account" "gitlab_node_sa" { | ||
| account_id = substr("gitlab-node-${var.project_id}", 0, 30) | ||
| display_name = "gitlab-gke-node-sa" | ||
| } |
There was a problem hiding this comment.
Three issues prevent gitlab_node_sa from validating cleanly across project IDs and registering GKE nodes:
- Set
project = var.project_idexplicitly ongoogle_service_account.gitlab_node_saandgoogle_service_account.gitlab_saat line 24 to match the sibling resources in this file so child-module callers without a default providerprojectdo not fail or target the wrong project. substr("gitlab-node-${var.project_id}", 0, 30)fails GCP service account ID validation whenever character 30 is a hyphen-. Wrap the expression intrimsuffix(substr("gitlab-node-${var.project_id}", 0, 30), "-").gitlab_node_sais never granted the baseline GKE node IAM roles ondata.google_project.project.project_id, specificallyroles/logging.logWriter,roles/monitoring.metricWriter,roles/monitoring.viewer,roles/autoscaling.metricsWriter, androles/artifactregistry.reader, andmodule "cluster"at line 246 still omitsservice_accountundernode_configfor initial default-pool creation prior to removal.
| parameters = var.parameters | ||
|
|
||
| network = var.network_project_id | ||
| network = var.network_name |
There was a problem hiding this comment.
In a Shared VPC deployment where subnetwork resolves data.google_compute_subnetwork.subnetwork.self_link inside var.network_project_id, setting network = var.network_name causes Dataflow to look up the network inside var.main_project_id rather than the host project. Omit network when subnetwork is a full regions/.../subnetworks/... self link or pass data.google_compute_network.network.self_link, and add project = var.main_project_id plus trimsuffix(substr(..., 0, 30), "-") on google_service_account.dataflow_worker at line 55 so child-module callers do not rely on a provider-level default project.
|
|
||
| resource "google_service_account" "gke" { | ||
| account_id = "gke-${var.main_project_id}" | ||
| account_id = substr("gke-${var.main_project_id}", 0, 30) |
There was a problem hiding this comment.
substr("gke-${var.main_project_id}", 0, 30) fails GCP account_id regex validation ^[a-z](?:[-a-z0-9]{4,28}[a-z0-9])$ whenever character 30 is -. Use trimsuffix(substr("gke-${var.main_project_id}", 0, 30), "-"), and apply the same 30-character truncation to google_service_account.cluster_service_account in blueprints/il5/gke/main.tf at line 79 for gke-sa-${var.gke_cluster_name} from item 1 of #373:
| account_id = substr("gke-${var.main_project_id}", 0, 30) | |
| account_id = trimsuffix(substr("gke-${var.main_project_id}", 0, 30), "-") |
| git { | ||
| sync_repo = var.source_repo | ||
| secret_type = "none" | ||
| secret_type = "gcenode" |
There was a problem hiding this comment.
Hardcoding secret_type = "gcenode" authenticates only to Cloud Source Repositories or Secure Source Manager via the node service account and breaks Config Sync whenever var.source_repo points to GitHub, GitLab, or an unauthenticated repository. Expose a config_sync_secret_type variable in variables.tf with a validation block covering none, ssh, cookiefile, gcenode, gcpserviceaccount, token, and githubapp, then regenerate README.md with tools/tfdoc.py.
|
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.
|
@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 #373.
Summary
This PR addresses multiple security and functional defects in blueprints/il5 and blueprints/fedramp-high:
Changes Made
blueprints/il5/dataflow/main.tf - Fixed broken Terraform reference:
blueprints/il5/gke/main.tf - Fixed private endpoint configuration:
blueprints/il5/gke-hardened/main.tf - Fixed SA ID length limit and Config Sync:
blueprints/fedramp-high/gitlab/main.tf - Switched to HTTPS and created dedicated node SA:
Security Impact