hello everyone. i'm an ML engineer turned full sta...
# general
i
hello everyone. i'm an ML engineer turned full stack engineer turned devops engineer since i'm the only engineer in my startup. pulumi has been an absolute godsend for someone like me. thanks! i'm using GCP for our infra. trying to set up a cloudbuild trigger to automate builds. here is my build trigger:
Copy code
frontend_trigger = gcp.cloudbuild.Trigger(
    "frontend-trigger",
    name="frontend-trigger",
    github={
        "owner": github_repo["owner"],
        "name": github_repo["repo"],
        "push": {
            "branch": "^main$",
        }
    },
    filename="frontend/infra/cloudbuild.yaml",
    substitutions={
        "_REGION": gcp_region, # set to us-west-1
        "_REPO": docker_repo, # set to frontend
    },
)
when i run pulumi up, i'm getting:
Copy code
Diagnostics:
  pulumi:pulumi:Stack (frontend-dev):
    error: update failed

  gcp:cloudbuild:Trigger (frontend-trigger):
    error:   sdk-v2/provider2.go:509: sdk.helper_schema: Error creating Trigger: googleapi: Error 400: Request contains an invalid argument.: provider=google-beta@8.25.0
    error: 1 error occurred:
    	* Error creating Trigger: googleapi: Error 400: Request contains an invalid argument.
i checked all the arguments for
frontend_trigger
against the Google source documentation and can't seem to find anything wrong. am i missing something dumb here?
s
Just throwing it out there, could it possibly be missing the Cloud Build location parameter? (ex:
location="us-central1"
)
i
thanks LM. looks like it needed service account and project for trigger creation. i added that and it now works. this worked:
Copy code
frontend_trigger = gcp.cloudbuild.Trigger(
    "frontend-trigger",
    name="frontend-trigger",
    project=gcp_project, <---- added this
    github=gcp.cloudbuild.TriggerGithubArgs(
        owner=github_repo["owner"],
        name=github_repo["repo"],
        push=gcp.cloudbuild.TriggerGithubPushArgs(
            branch="^main$",
        ),
    ),
    filename="frontend/infra/cloudbuild.yaml",
    service_account=f"projects/{gcp_project}/serviceAccounts/{gcp_service_account_id}", <--- added this
    substitutions={
        "_REGION": gcp_region,
        "_REPO": docker_repo,
    },
)
s
Ah, good find!