Jump to Content
Management Tools

Announcing Terraform Google Provider 6.0.0: More Flexibility, Better Control

August 26, 2024
Swati Chadha

Product Manager, Google

Cameron Thornton

Software Engineer, Google

Join us at Google Cloud Next

Early bird pricing available now through Feb 14th.

Register

The Terraform Google Provider v6.0.0 is now GA. Since the last major Terraform provider release in September 2023, the combined Hashicorp/Google provider team has been listening closely to the community's feedback. Discussed below are the primary enhancements and bug fixes that this major release focuses on. Support for earlier versions of HashiCorp Terraform will not change as a result of the major version release v6.0.0.

Terraform Google Provider Highlights 

The key notable changes are as follows: 

  • Opt-out default label “goog-terraform-provisioned”

  • Deletion protection fields added to multiple resources

  • Allowed reducing the suffix length in “name_prefix” for multiple resources

Opt-out default label “goog-terraform-provisioned”

As a follow-up to the addition of provider-level default labels in 5.16.0, the 6.0.0 major release includes an opt-out default label “goog-terraform-provisioned”. This provider-level label “goog-terraform-provisioned” will be added to applicable resources to identify resources that were created by Terraform. This default label will only apply for newly created resources with a labels field. This will enable users to have a view of resources managed by Terraform when viewing/editing these resources in other tools like Cloud Console, Cloud Billing etc.

The label “goog-terraform-provisioned” can be used for the following:

  • To filter on the Billing Reports page:

https://storage.googleapis.com/gweb-cloudblog-publish/images/image2_zYrUahV.max-1200x1200.png
  • To view the Cost breakdown:
https://storage.googleapis.com/gweb-cloudblog-publish/images/image1_XVZqCGC.max-1200x1200.png

Please note that an opt-in version of the label was already released in 5.16.0, and 6.0.0 will change the label to opt-out. To opt-out of this default label, the users may toggle the add_terraform_attribution_label provider configuration field. This can be set explicitly using any release from 5.16.0 onwards and the value in configuration will apply after the 6.0.0 upgrade.

Loading...

Deletion protection fields added to multiple resources

In order to prevent the accidental deletion of important resources, many resources now have a form of deletion protection enabled by default. These resources include google_domain, google_cloud_run_v2_job, google_cloud_run_v2_service, google_folder and google_project. Most of these are enabled by the deletion_protection field. google_project specifically has a deletion_policy field which is set to PREVENT by default.

Allowed reducing the suffix length in “name_prefix”

Another notable issue resolved in this major release is, “Allow reducing the suffix length appended to instance templates name_prefix (#15374 ),” which changes the default behavior for name_prefix in multiple resources. The max length of the user-defined name_prefix has increased from 37 characters to 54. The provider will use a shorter appended suffix when using a name_prefix longer than 37 characters, which should allow for more flexible resource names. For example, google_instance_template.name_prefix.

With features like opt-out default labels and deletion protection, this version enables users to have a view of resources managed by Terraform in other tools and also prevents accidental deletion of important resources. The Terraform Google Provider 6.0.0 launch aims to improve the usability and safety of Terraform for managing Google Cloud resources on 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. Please check out the Release notes for Terraform Google Provider 6.0.0 for more details on this major version release. Learn more about Terraform on Google Cloud in the Terraform on Google Cloud documentation.

Posted in