» Google Provider Versions

Starting with the 1.19.0 release, there are two versions of the Google provider:

This documentation (https://www.terraform.io/docs/providers/google/) is shared between both providers, and all generally available (GA) products and features are available in both versions of the provider.

The google-beta provider is distinct from the google provider in that it supports GCP products and features that are in beta, while google does not. Fields and resources that are only present in google-beta will be marked as such in the shared provider documentation.

1.X series releases of the google provider supported beta features; from 2.0.0 onwards, beta features are only supported in google-beta.

Beta GCP features have no deprecation policy and no SLA, but are otherwise considered to be feature-complete with only minor outstanding issues after their Alpha period. Beta is when GCP features are publicly announced, and is when they generally become publicly available. For more information see the official documentation on GCP launch stages.

The google-beta provider sends all requests to the beta endpoint for GCP if one exists for that product, regardless of whether the request contains any beta features.

» Using the google-beta provider

To use the google-beta provider, explicitly define a google-beta provider block, and state on the resource which provider you wish to use.

provider "google-beta" {
  credentials = "${file("account.json")}"
  project     = "my-project-id"
  region      = "us-central1"
}

resource "google_compute_instance" "beta-instance" {
  provider = "google-beta"

  # ...
}

» Using both provider versions together

To have resources at different API versions, set up provider blocks for each version:

provider "google" {
  credentials = "${file("account.json")}"
  project     = "my-project-id"
  region      = "us-central1"
}

provider "google-beta" {
  credentials = "${file("account.json")}"
  project     = "my-project-id"
  region      = "us-central1"
}

In each resource, state which provider that resource should be used with:

resource "google_compute_instance" "ga-instance" {
  provider = "google"

  # ...
}

resource "google_compute_instance" "beta-instance" {
  provider = "google-beta"

  # ...
}

» Importing resources with google-beta

By default, Terraform will always import resources using the google provider. To import resources with google-beta, you need to explicitly specify a provider with the -provider flag, similarly to if you were using a provider alias.

terraform import -provider=google-beta google_compute_instance.beta-instance my-instance

» Converting resources between versions

Resources can safely be converted from one version to the other without needing to rebuild infrastructure.

To go from GA to beta, change the provider field from "google" to "google-beta".

To go from beta to GA, do the reverse. If you were previously using beta fields that you no longer wish to use:

  1. (Optional) Explicitly set the fields back to their default values in your Terraform config file, and run terraform apply.
  2. Change the provider field to "google".
  3. Remove any beta fields from your Terraform config.
  4. Run terraform plan or terraform refresh+terraform show to see that the beta fields are no longer in state.