Skip to content

Commit c0f744b

Browse files
authored
fix: delete unused datastore terraform files in agentic_rag projects (#797)
Both vertex_ai_search and vector_search terraform files were being included in generated agentic_rag projects regardless of the selected --datastore flag. The Jinja2 conditionals rendered the file contents as empty but the files themselves remained. Add conditional file deletion entries for all datastore-specific terraform files so only the selected datastore's files are kept. Also fix Makefile template where the Infrastructure Setup section was nested inside an elif for datastore_type instead of being a separate conditional block for cicd_runner.
1 parent 6b194a7 commit c0f744b

File tree

2 files changed

+42
-1
lines changed

2 files changed

+42
-1
lines changed

agent_starter_pack/base_templates/python/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,8 @@ sync-data:
351351
PROJECT_ID=$$(gcloud config get-value project) && \
352352
DATA_STORE_REGION=$$(grep 'data_store_region' deployment/terraform/dev/vars/env.tfvars | sed 's/.*= *"//;s/".*//') && \
353353
uv run deployment/terraform/scripts/start_connector_run.py $$PROJECT_ID $$DATA_STORE_REGION {{cookiecutter.project_name}}-collection --wait
354-
{%- elif cookiecutter.cicd_runner != 'skip' %}
354+
{%- endif %}
355+
{%- if cookiecutter.cicd_runner != 'skip' %}
355356

356357
# ==============================================================================
357358
# Infrastructure Setup

agent_starter_pack/cli/utils/template.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,46 @@ def _exclude_adk_live_agent_engine(c: dict) -> bool:
123123
"deployment/terraform/dev/service.tf": _exclude_adk_live_agent_engine,
124124
# Data ingestion conditional (only for vertex_ai_vector_search)
125125
"data_ingestion": lambda c: c.get("datastore_type") == "vertex_ai_vector_search",
126+
# Datastore-specific terraform files (vertex_ai_search vs vertex_ai_vector_search)
127+
"deployment/terraform/vertex_ai_search.tf": (
128+
lambda c: c.get("datastore_type") == "vertex_ai_search"
129+
),
130+
"deployment/terraform/vertex_ai_search_variables.tf": (
131+
lambda c: c.get("datastore_type") == "vertex_ai_search"
132+
),
133+
"deployment/terraform/vertex_ai_search_github.tf": (
134+
lambda c: c.get("datastore_type") == "vertex_ai_search"
135+
),
136+
"deployment/terraform/dev/vertex_ai_search.tf": (
137+
lambda c: c.get("datastore_type") == "vertex_ai_search"
138+
),
139+
"deployment/terraform/dev/vertex_ai_search_variables.tf": (
140+
lambda c: c.get("datastore_type") == "vertex_ai_search"
141+
),
142+
"deployment/terraform/vector_search.tf": (
143+
lambda c: c.get("datastore_type") == "vertex_ai_vector_search"
144+
),
145+
"deployment/terraform/vector_search_variables.tf": (
146+
lambda c: c.get("datastore_type") == "vertex_ai_vector_search"
147+
),
148+
"deployment/terraform/vector_search_github.tf": (
149+
lambda c: c.get("datastore_type") == "vertex_ai_vector_search"
150+
),
151+
"deployment/terraform/vector_search_iam.tf": (
152+
lambda c: c.get("datastore_type") == "vertex_ai_vector_search"
153+
),
154+
"deployment/terraform/vector_search_service_accounts.tf": (
155+
lambda c: c.get("datastore_type") == "vertex_ai_vector_search"
156+
),
157+
"deployment/terraform/dev/vector_search.tf": (
158+
lambda c: c.get("datastore_type") == "vertex_ai_vector_search"
159+
),
160+
"deployment/terraform/dev/vector_search_variables.tf": (
161+
lambda c: c.get("datastore_type") == "vertex_ai_vector_search"
162+
),
163+
"deployment/terraform/dev/vector_search_iam.tf": (
164+
lambda c: c.get("datastore_type") == "vertex_ai_vector_search"
165+
),
126166
}
127167

128168

0 commit comments

Comments
 (0)