Replies: 1 comment 1 reply
-
|
the issue is that make deploy likely uses gcloud run deploy which has its own --set-env-vars flag that overrides terraform config. few approaches:
from google.cloud import secretmanager
client = secretmanager.SecretManagerServiceClient()
name = f"projects/{project}/secrets/{secret_id}/versions/latest"
response = client.access_secret_version(request={"name": name})
value = response.payload.data.decode("UTF-8")
ENV_VARS := $(shell cat .env | grep -v "^\#" | xargs | tr " " ",")
deploy:
gcloud run deploy ... --set-env-vars="$(ENV_VARS)"
resource "google_cloud_run_service" "agent" {
template {
spec {
containers {
env {
name = "FARMBETTER_ASSISTANT_USER_ID"
value = var.assistant_user_id
}
}
}
}
}
the root cause is deployment pipeline not picking up terraform state. the gcloud deploy command needs to either read from terraform output or use same env vars. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, I'm looking for some guidance on how to manage environment configuration when using agent-starter-pack.
I was previously using the
-env-fileoption to app_utils.deploy, but that was removed in #652.I had assumed that adding the env variables to the deployment/terraform/dev/service.tf would work, and indeed environment variables there appear to be set in the Agent Engine Service configuration deployment details, after running
make setup-dev-envHowever, these environment variables are NOT available to the application after running
make deploy. My agent crashes on the startup with a Pydantic configuration error.I guess the env vars that were added in the terraform deploy are overwritten by the smaller default set in
make deploy.I can make the agent start by hacking the .env file into the app_utils.deploy command as follows
but I'm pretty sure this is not what was intended by #652.
Any thoughts/guidance gratefully received. (cc @eliasecchig - apologies for the tag, but I'd love your thoughts on it 🙏 )
Beta Was this translation helpful? Give feedback.
All reactions