Hi Guys,
I am trying to provision GCP AppEngine flexible with custom runtime where I will use my Dockerfile to install the runtime,
I am getting below error everytime whenever I am trying the create app engine
google_app_engine_flexible_app_version.myapp_flex: Creating...
google_app_engine_flexible_app_version.myapp_flex: Still creating... [10s elapsed]
╷
│ Error: Error waiting to create FlexibleAppVersion: Error waiting for Creating FlexibleAppVersion: Error code 3, message: "runtime: custom" requires either cloudbuild.yaml or Dockerfile to be present.
Following the official documentation of Harshicorp terraform its not mentioned about Dockerfile in which block we should define the docker file. I just keep my Dockerfile already in / dir.
resource "google_storage_bucket" "source-code" {
name = "source-code-gcs" #bucket-name
location = "US"
force_destroy = true
}
data "archive_file" "app-engine-source-zip" {
type = "zip"
source_dir = "./source/app-engine/full-stack-app" #source-code path
output_path = "./full-stack-app.zip"
}
resource "google_storage_bucket_object" "app-engine-source-zip-obj" {
name = "source-app-engine.${data.archive_file.app-engine-source-zip.output_md5}.zip"
bucket = google_storage_bucket.source-code.name
source = data.archive_file.app-engine-source-zip.output_path
}
resource "google_app_engine_flexible_app_version" "myapp_flex" {
version_id = "v1"
project = var.project_id
service = "flex"
runtime = "custom"
entrypoint {
shell = "./build_and_run.sh"
}
deployment {
zip {
source_url = "https://storage.googleapis.com/${google_storage_bucket.source-code.name}/${google_storage_bucket_object.app-engine-source-zip-obj.name}"
}
cloud_build_options {
app_yaml_path = "app.yaml"
}
}
}
liveness_check {
path = "/"
}
readiness_check {
path = "/"
}
env_variables = {
port = "8081"
}
automatic_scaling {
cool_down_period = "120s"
cpu_utilization {
target_utilization = 0.5
}
}
delete_service_on_destroy = true
}