Skip to content

Convert gem4gov GE application(s) creation to Terraform#148

Open
jmpugh wants to merge 5 commits into
mainfrom
jeffpugh/gem4gov-tf
Open

Convert gem4gov GE application(s) creation to Terraform#148
jmpugh wants to merge 5 commits into
mainfrom
jeffpugh/gem4gov-tf

Conversation

@jmpugh

@jmpugh jmpugh commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator

Description

Converts the gem4gov create app functionality to Terraform to follow IaC best practices.

Fixes #100

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Technical Debt

Deployment & Compliance Impact

  • Applicable Regimes:
    • US Region Restricted (e.g., Access Policy constraint)
    • FedRAMP Moderate
    • FedRAMP High
    • DoD IL4
    • DoD IL5
    • General / All
  • NIST 800-53r5 Controls: (If this PR helps satisfy or modifies control implementations, list them here)

Checklist

Code Quality & Reusability

  • My code adheres to the Maximize Reusability principle. I have not redefined common elements and have reused existing base configurations and modules where possible.
  • I have checked that no existing module or configuration in modules/ or fast/ can be leveraged for this change.
  • My code follows the established naming conventions outlined in documentation/naming-convention.md.

Documentation

  • I have updated the README.md of the modified module or blueprint.
  • I have added/updated documentation for inputs (variables) and outputs.

Security

  • My change adheres to GCP security best practices and the principle of least privilege.
  • I have ensured compliance with the targeted regime (FedRAMP High, IL5, etc.).

Testing

  • I have tested my changes locally.
  • I have included details of my testing in this PR.

Testing Performed

I have performed several deployments for GE and have confirmed that the proper infrastructure is correctly set up and the application is accessible to authorized users.


dynamic "path_matcher" {
for_each = data.terraform_remote_state.stage_0.outputs.acl_idp_type == "GSUITE" ? ["gsuite"] : []
for_each = contains(["GSUITE", "GOOGLE_CLOUD_IDENTITY"], data.terraform_remote_state.stage_0.outputs.acl_idp_type) ? ["gsuite"] : []

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

fixes a bug where the routing rules were not properly configured when using Cloud Identity as the IdP

url_rewrite {
host_rewrite = "vertexaisearch.cloud.google.com"
path_prefix_rewrite = "/us/home/cid/${var.gemini_config_id}?hl=en_US"
path_prefix_rewrite = "/us/home/cid/${data.terraform_remote_state.stage_0.outputs.gemini_apps_widget_ids[keys(data.terraform_remote_state.stage_0.outputs.gemini_apps_widget_ids)[0]]}?hl=en_US"

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

we no longer need to prompt the user for the gemini config IDs, just pull them in from the stage 0 state


# Prompts for Gemini Applications configuration
echo ""
echo -e "${BLUE}--- Gemini Enterprise Applications ---${NC}"

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

added to the Stage 0 steps to configure GE apps


# Write gemini_apps to terraform.tfvars.json
if [[ "$APPS_OBJ" != "{}" && -n "$APPS_OBJ" ]]; then
echo "{\"gemini_apps\": ${APPS_OBJ}}" > gemini-stage-0/terraform.tfvars.json

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

writes GE app configs to a separate terraform.tfvars.json file for better readability

if ! terraform apply -var-file="terraform.tfvars"; then
VAR_FILES=(-var-file="terraform.tfvars")
if [[ -f "terraform.tfvars.json" ]]; then
VAR_FILES+=(-var-file="terraform.tfvars.json")

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

apply terraform with GE app configurations


# Post-Deployment: Configure Observability (Audit Logs) and Default Assistants for Gemini Apps
echo ""
echo "Configuring logging and assistant compliance settings for Gemini applications..."

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

when creating the GE engine via Terraform it automatically creates the Default Assistant when the engine is set to Enterprise, so we need to subsequently update the assistant with the proper configuration.

see hashicorp/terraform-provider-google#26316 for more details

@jmpugh jmpugh added gemini enterprise Gemini Enterprise (GE) related gemini for government Gemini for Government (G4G) related labels Jul 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gemini enterprise Gemini Enterprise (GE) related gemini for government Gemini for Government (G4G) related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request] Convert gem4gov-cli Python tool to Terraform

2 participants