-
Notifications
You must be signed in to change notification settings - Fork 119
Description
PR #620 introduces a Lit webcomponent for direct asset downloading and utilizes the signed URL for GCS asset access.
@csantos & @awaemmanuel can you review the following and let me know if this is a good course of action.
-
Service Account Identified: The
main.tf
file creates a dedicated service account for the application:- Terraform resource name:
google_service_account.creative_studio
- Account ID:
service-creative-studio
- The full email will be:
service-creative-studio@<YOUR_PROJECT_ID>.iam.gserviceaccount.com
- Terraform resource name:
-
Missing IAM Role: Of the
google_project_iam_member
resources, theroles/iam.serviceAccountTokenCreator
role is not granted to this service account. Without this, the API call to access the GCS asset will fail, and the download will error with "Failed to retrieve signed URL from API.". -
Missing Environment Variable: The
main.tf
file defines alocals
block for environment variables.SERVICE_ACCOUNT_EMAIL
is not included in this block. The backend code will fail to get the correct service account email to use for signing the URL.
2. main.tf
Modifications
Change 1: Add the missing IAM role.
In main.tf
, add the following resource block. Potential suggestion, right after the google_project_iam_member.creative_studio_vertex_access
resource.
resource "google_project_iam_member" "creative_studio_sa_token_creator" {
project = var.project_id
role = "roles/iam.serviceAccountTokenCreator"
member = google_service_account.creative_studio.member
}
Change 2: Add the missing environment variable.
In main.tf
, inside the locals
block, add the SERVICE_ACCOUNT_EMAIL
variable.
locals {
creative_studio_env_vars = {
PROJECT_ID = var.project_id
LOCATION = var.region
SERVICE_ACCOUNT_EMAIL = google_service_account.creative_studio.email # <-- ADD THIS LINE
MODEL_ID = var.model_id
VEO_MODEL_ID = var.veo_model_id
# ... keep the rest of the variables
}
}