Skip to content

Cloud Run Job start_execution_token breaks subsequent runs #24451

@brantian

Description

@brantian

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request.
  • Please do not leave +1 or me too comments, they generate extra noise for issue followers and do not help prioritize the request.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.
  • If an issue is assigned to a user, that user is claiming responsibility for the issue.
  • Customers working with a Google Technical Account Manager or Customer Engineer can ask them to reach out internally to expedite investigation and resolution of this issue.

Terraform Version & Provider Version(s)

Terraform v1.12.0
on

  • provider registry.terraform.io/hashicorp/google v6.50.0
  • provider registry.terraform.io/hashicorp/google-beta v6.50.0

Affected Resource(s)

google_cloud_run_v2_job

Terraform Configuration

resource "google_cloud_run_v2_job" "airbyte-connector" {

  for_each = { for connector in var.connectors_list : connector.platform => connector if connector.yaml_config != null }

  provider = google-beta

  project               = var.google_project_id
  name                  = "airbyte-${replace(each.value.platform, "_", "-")}"
  location              = var.google_region
  deletion_protection   = false
  start_execution_token = "initial-run"

  template {

    template {
      max_retries     = 0
      timeout         = "7200s"
      service_account = var.insentric-compute

      containers {

        image   = local.sources[each.value.platform]
        command = ["/bin/sh"]
        args    = ["-c", "pip install --user airbyte-serverless && export PATH=\"/tmp/.local/bin:$PATH\" && abs run-env-vars"]

        resources {
          limits = {
            cpu    = "1"
            memory = "1024Mi"
          }
        }
        env {
          name  = "YAML_CONFIG"
          value = each.value.yaml_config
        }

        env {
          name  = "HOME"
          value = "/tmp"
        }

      }
    }
  }

}

Debug Output

No response

Expected Behavior

Setting start_execution_token to a fixed value should trigger a run when the Cloud Run Job is created and Terraform should not try to deploy the same run again afterwards

Actual Behavior

When the Cloud Run Job is deployed, the start_execution_token trigger works as expected. However, after that, if the Cloud Run Job is run again, but not from Terraform, the next time Terraform runs it tries to create the initial-run again and then the apply fails with the following message:

Error: Error waiting for Updating Job: Error code 6, message: Resource 'airbyte-google-ads-initial-run' already exists. Resource readiness deadline exceeded.
with module.insentric-airbyte.google_cloud_run_v2_job.airbyte-connector["google_ads"]
on insentric-airbyte/google_cloud_run_job.tf line 1, in resource "google_cloud_run_v2_job" "airbyte-connector":
resource "google_cloud_run_v2_job" "airbyte-connector" {

Steps to reproduce

  1. Create a Cloud Run job with the start_execution_token property set to a fixed value.
  2. Run terraform apply to create the job and start a run
  3. Trigger a new run for the Cloud Run job manually through the console or the API
  4. Run terraform apply again

Important Factoids

No response

References

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions