# Announcing Terraform Google Provider 6.0.0: More Flexibility, Better Control


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](https://registry.terraform.io/providers/hashicorp/google/latest/docs/guides/provider_reference#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](https://storage.googleapis.com/gweb-cloudblog-publish/images/image2_zYrUahV.max-1200x1200.png align="center")

* To view the Cost breakdown:
    

![https://storage.googleapis.com/gweb-cloudblog-publish/images/image1_XVZqCGC.max-1200x1200.png](https://storage.googleapis.com/gweb-cloudblog-publish/images/image1_XVZqCGC.max-1200x1200.png align="center")

* The label can also be used with [BigQuery export.](https://cloud.google.com/blog/topics/cost-management/use-labels-to-gain-visibility-into-gcp-resource-usage-and-spending)
    

Please note that an [opt-in version](https://github.com/GoogleCloudPlatform/magic-modules/pull/9808) of the label was already released in [5.16.0](https://github.com/hashicorp/terraform-provider-google/releases/tag/v5.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](https://registry.terraform.io/providers/hashicorp/google/latest/docs/guides/provider_reference#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.

```basic
provider "google" {
```

```basic
  // opt out of “goog-terraform-provisioned” default label
```

```basic
  add_terraform_attribution_label = false
```

```basic
}
```

### **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](https://github.com/hashicorp/terraform-provider-google/issues/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](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/compute_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](https://registry.terraform.io/providers/hashicorp/google/latest/docs/guides/version_6_upgrade), which contains a full list of the changes and upgrade considerations. Please check out the [Release notes](https://github.com/hashicorp/terraform-provider-google/releases) 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](https://cloud.google.com/docs/terraform).
