Skip to content

Support Windows MDM secrets for GCP#228

Open
robbiet480 wants to merge 5 commits intofleetdm:mainfrom
CampusTech:gcp-windows-mdm-secrets
Open

Support Windows MDM secrets for GCP#228
robbiet480 wants to merge 5 commits intofleetdm:mainfrom
CampusTech:gcp-windows-mdm-secrets

Conversation

@robbiet480
Copy link
Copy Markdown

@robbiet480 robbiet480 commented May 1, 2026

Summary

This PR adds GCP Secret Manager support for the Windows MDM WSTEP identity certificate and key, enabling the GCP Terraform module to provision and expose these secrets to Fleet via Cloud Run's secret environment variable injection.

Changes

gcp/main.tf

  • Creates two GCP Secret Manager secrets: fleet-mdm-wstep-identity-cert and fleet-mdm-wstep-identity-key
  • Uses secret_data_wo (write-only) for secret versions to avoid storing sensitive values in Terraform state
  • Injects the secrets into Fleet's Cloud Run service as FLEET_MDM_WINDOWS_WSTEP_IDENTITY_CERT_BYTES and FLEET_MDM_WINDOWS_WSTEP_IDENTITY_KEY_BYTES via extra_secret_env_vars

gcp/variables.tf

  • Adds windows_mdm_wstep_identity_cert and windows_mdm_wstep_identity_key input variables (sensitive strings, PEM-encoded)

gcp/byo-project/iam.tf

  • Consolidates the two separate google_secret_manager_secret_iam_member resources into a single for_each-based resource that iterates over all secrets in local.fleet_secrets_env_vars — this ensures the Fleet Cloud Run service account automatically gets Secret Accessor access to any secrets added via extra_secret_env_vars, including the new WSTEP secrets

.gitignore

  • Adds .DS_Store, terraform.tfvars, *.key, and *.crt to prevent accidental commits of local state and key material

Usage

Provide the WSTEP cert and key via terraform.tfvars or a secrets manager pipeline:

windows_mdm_wstep_identity_cert = <<-EOT
  -----BEGIN CERTIFICATE-----
  ...
  -----END CERTIFICATE-----
EOT

windows_mdm_wstep_identity_key = <<-EOT
  -----BEGIN PRIVATE KEY-----
  ...
  -----END PRIVATE KEY-----
EOT

These map directly to the FLEET_MDM_WINDOWS_WSTEP_IDENTITY_CERT_BYTES and FLEET_MDM_WINDOWS_WSTEP_IDENTITY_KEY_BYTES environment variables required by Fleet for Windows MDM enrollment.


PR description drafted with Claude (claude.ai/claude-code), reviewed by author.

@robbiet480 robbiet480 requested review from a team and ddribeiro as code owners May 1, 2026 00:13
@robbiet480 robbiet480 force-pushed the gcp-windows-mdm-secrets branch 2 times, most recently from 11fdca3 to 041abfc Compare May 1, 2026 00:21
robbiet480 and others added 5 commits April 30, 2026 20:23
Creates Secret Manager secrets for FLEET_MDM_WINDOWS_WSTEP_IDENTITY_CERT_BYTES
and FLEET_MDM_WINDOWS_WSTEP_IDENTITY_KEY_BYTES, populated via sensitive Terraform
variables. Wires them into the fleet module via extra_secret_env_vars. Also adds
terraform.tfvars and *.key/*.crt to .gitignore to prevent secret leakage.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Avoids storing secret content in Terraform state.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replaces two hardcoded IAM bindings with a single for_each over
fleet_secrets_env_vars, so any secret passed via extra_secret_env_vars
(including the new Windows MDM WSTEP secrets) automatically gets the
correct IAM grant.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Rotates to PKCS#1 RSA key format (BEGIN RSA PRIVATE KEY) required by
Fleet's WSTEP parser. Previous version used PKCS#8 which Fleet rejects.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@robbiet480 robbiet480 force-pushed the gcp-windows-mdm-secrets branch from 041abfc to fd64963 Compare May 1, 2026 00:23
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.

1 participant