Google ML Engine Model

This page shows how to write Terraform for ML Engine Model and write them securely.

google_ml_engine_model (Terraform)

The Model in ML Engine can be configured in Terraform with the resource name google_ml_engine_model. The following sections describe 4 examples of how to use the resource and its parameters.

Example Usage from GitHub
resource "google_ml_engine_model" "default" {
  name                              =
  description                       = var.description
  regions                           = var.regions
  online_prediction_logging         = var.logging
  online_prediction_console_logging = var.console_logging
resource "google_ml_engine_model" "default" {
  name        = "terraform_test"
  description = "terraform_test"
  regions     = ["us-central1"]
  labels = {
    my_model = "foo"
resource "google_ml_engine_model" "this" {
  description                       = var.description
  labels                            = var.labels
  name                              =
  online_prediction_console_logging = var.online_prediction_console_logging
  online_prediction_logging         = var.online_prediction_logging
resource "google_ml_engine_model" "gdelt_ftse_regression_model" {
  name        = "gdelt_ftse_regression_model"
  regions     = ["europe-west1"]
  default_version {
    name = "projects/gdelt-ftse/models/gdelt_ftse_regression_model/versions/v1"

Review your Terraform file for Google best practices

Shisho Cloud, our free checker to make sure your Terraform configuration follows best practices, is available (beta).


The description specified for the model when it was created.

  • id optional computed - string
  • labels optional - map from string to string

One or more labels that you can add, to organize your models.

The name specified for the model.

If true, online prediction nodes send stderr and stdout streams to Stackdriver Logging

If true, online prediction access logs are sent to StackDriver Logging.

The list of regions where the model is going to be deployed. Currently only one region per model is supported

Explanation in Terraform Registry

Represents a machine learning solution. A model can have multiple versions, each of which is a deployed, trained model ready to receive prediction requests. The model itself is just a container. To get more information about Model, see:

Frequently asked questions

What is Google ML Engine Model?

Google ML Engine Model is a resource for ML Engine of Google Cloud Platform. Settings can be wrote in Terraform.

Where can I find the example code for the Google ML Engine Model?

For Terraform, the chinmaydorlikar/terraform-gcp, yaroslavopsguru/gcp-tf-resources and niveklabs/google source code examples are useful. See the Terraform Example section for further details.


Automate config file reviews on your commits

Fix issues in your infrastructure as code with auto-generated patches.