Error waiting for Creating FlexibleAppVersion

I have a GCP project utilizing a variety of services: GC Functions, Firestore, VPC Connector, Storage Buckets, App Engine, Compute Engine. I use Terraform for deployment.

I decided to add a message queue using Google Tasks Queue, and run it on App Engine.

There is a nodejs handler function I put into an archive_file before attempting to deploy it to App Engine. I do this for my GC Function and it works great.

From my research it looks like I need Terraform resource app_engine_standard_app_version or app_engine_flexible_app_version to run my handler function on my App Engine.

When I try to create this resource via terraform apply I get an error. Neither flexible or standard works.

TFE Code

locals {
  timestamp = formatdate("YYMMDDhhmmss", timestamp())

resource "google_cloud_tasks_queue" "task-queue-b" {
  name     = "task-queue-b"
  location = "us-east1"

  rate_limits {
    max_concurrent_dispatches = 3
    max_dispatches_per_second = 2

  retry_config {
    max_attempts       = 5
    max_retry_duration = "4s"
    max_backoff        = "3s"
    min_backoff        = "2s"
    max_doublings      = 1

# Compress source code and make archive file
data "archive_file" "task-queue-source" {
  type        = "zip"
  output_path = "/tmp/task-queue-${local.timestamp}.zip"
  source_dir  = "../../../../queue/build/src" # index.js is here with handler func

# Create bucket that will host the source code
resource "google_storage_bucket" "task-queue-bucket" {
  name = "${var.project}-task-queue"

# Add source code zip to bucket
resource "google_storage_bucket_object" "task-queue-zip" {
  # Append file MD5 to force bucket to be recreated
  name       = "${data.archive_file.task-queue-source.output_md5}"
  bucket     =
  source     = data.archive_file.task-queue-source.output_path
  depends_on = [data.archive_file.task-queue-source]

resource "google_app_engine_flexible_app_version" "task-queue-flexible-v1" {
  project    = var.project
  service    = "default"
  version_id = "v1"
  runtime    = "nodejs14"

  entrypoint {
    shell = "node ./index.js"

  deployment {
    zip {
      source_url = "${}/${}"

  liveness_check {
    path = "."

  readiness_check {
    path = "."

  automatic_scaling {
    cool_down_period = "120s"
    cpu_utilization {
      target_utilization = 0.5

  delete_service_on_destroy = true

I receive the following:

First warning: I don’t think this is related…

2021-10-10T12:37:50.296-0400 [WARN]  Provider "provider[\"\"]" produced an unexpected new value for, but we are tolerating it because it is using the legacy plugin SDK.
    The following problems may be the cause of any confusing errors from downstream operations:
      - .source_archive_object: was cty.StringVal(""), but now cty.StringVal("") Modifications complete after 2m16s [id=projects/<proj>/locations/us-east1/functions/analytics]

Main error I can not for the life of me figure out:

│ Error: Error waiting to create FlexibleAppVersion: Error waiting for Creating FlexibleAppVersion: Error code 13, message: An internal error occurred.
│   with module.task-queue.google_app_engine_flexible_app_version.task-queue-flexible-v1,
│   on ..\..\modules\taskqueue\ line 74, in resource "google_app_engine_flexible_app_version" "task-queue-flexible-v1":
│   74: resource "google_app_engine_flexible_app_version" "task-queue-flexible-v1" {
2021-10-10T12:37:50.302-0400 [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = transport is closing"


Terraform v1.0.8
on windows_amd64
+ provider v2.2.0
+ provider v3.88.0


  1. Am I correct with my chosen resources to run my Task Queue handler function (nodejs express app)? Are there any resources I am missing? Do I need an actual google_app_engine_application TFE resource?

  2. Any insight into this unhelpful error?

Thanks so much