Skip to main content

Terraform provider for Google Cloud 6.0 is now GA

Version 6.0 of the HashiCorp Terraform Google provider brings updates to default labels, letting practitioners view and edit resources with ease.

We are excited to announce the release of version 6.0 of the HashiCorp Terraform Google provider, with updates to labels designed to improve usability. Users now have the ability to view resources managed by Terraform when viewing/editing such resources through other tools. This post covers the details and benefits of the updated provider, and recaps key new features released this year.

»2024 Terraform Google provider highlights

As the Terraform Google provider tops 300 million downloads this year, Google and HashiCorp continue to develop new integrations to help customers work faster, get benefits from more services and features, and find developer-friendly ways to deploy cloud infrastructure. This year, we focused on listening to the community by adding oft-requested new features to the Google provider, including:

  • Provider-defined functions
  • Default attribution label
  • Expanding labels model support across more resources

»Provider-defined functions

With the release of Terraform 1.8, providers can implement custom functions that you can call from the Terraform configuration. Earlier this year we announced the general availability of provider-defined functions in the Google Cloud provider, adding a simplified way to get regions, zones, names, and projects from the IDs of resources that aren’t managed by your Terraform configuration. Provider-defined functions can now help parse Google IDs when adding an IAM binding to a resource that’s managed outside of Terraform:

resource "google_cloud_run_service_iam_member" "example_run_invoker_jane" {
 
 member   = "user:jane@example.com"
 
 role     = "run.invoker"
 
 service  = provider::google::name_from_id(var.example_cloud_run_service_id)
 
 location = provider::google::location_from_id(var.example_cloud_run_service_id)
 
 project  = provider::google::project_from_id(var.example_cloud_run_service_id)
 
}

This release represents another step forward in our unique approach to ecosystem extensibility.

»Default Terraform attribution label

In version 5.16 of the Google provider, a new optional goog-terraform-provisioned provider-level default label helps users track resources created by Terraform. Previously, users had to explicitly opt into this feature by setting the add_terraform_attribution_label option in the provider configuration block. In version 6.0, this attribution label is now enabled by default, and will be added to all newly created resources that support labels. This helps users easily identify and report on resources managed by Terraform when viewing/editing such resources through tools like Google Cloud Console, Cloud Billing, etc.

Users who wish to opt out of this new default label can do so by disabling the add_terraform_attribution_label option in the provider block:

provider "google" {
  # Opt out of the “goog-terraform-provisioned” default label
  add_terraform_attribution_label = false
}

By default, the label is added to resources only upon creation. To proactively apply the label to existing resources, set the terraform_attribution_label_addition_strategy option to PROACTIVE in the provider block, which adds the label to all supported resources on the next terraform apply:

provider "google" {
  # Apply the “goog-terraform-provisioned” label to existing resources
  add_terraform_attribution_label               = true
  terraform_attribution_label_addition_strategy = “PROACTIVE”
}

»Removing deprecated attributes and other behavior changes

Since the last major release, the Terraform Google provider has accumulated resources and properties that have been deprecated, renamed, or are no longer supported by Google. As version 6.0 is a major release, we have removed a number of resources and attributes that have been deprecated over the course of the provider’s lifetime. A complete list of behavior changes and removed properties can be found in the Google 6.0 upgrade guide.

»Learn more about Google Cloud and HashiCorp

To learn the basics of Terraform using the Google provider, check out the Get Started tutorials for Google Cloud.

When upgrading to version 6.0 of the Terraform Google provider, please consult the upgrade guide on the Terraform Registry, which contains a full list of the changes and upgrade considerations. Because this release introduces breaking changes, we recommend pinning your provider version to protect against unexpected results. For a complete list of the changes in 6.0, please refer to the Google provider changelog.

HashiCorp and Google partner on cloud infrastructure to make it easy for users to provision and manage Google Cloud resources. You can find out more about our partnership on our Google Cloud partner page.

If you are currently using Terraform Community Edition or are completely new to Terraform, sign up for HCP Terraform and get started using the free offering today.

Sign up for the latest HashiCorp news

By submitting this form, you acknowledge and agree that HashiCorp will process your personal information in accordance with the Privacy Policy.