HashiCorp released version 6.0 of the Terraform Google provider, delivering key updates to improve cloud infrastructure management and developer workflows. The release introduces automatic labeling for Terraform-created resources, expanded naming flexibility, and removal of deprecated features. It also simplifies handling Google IDs and IAM binding for external resources.
Google and HashiCorp are collaborating to develop new integrations that focus on improving cloud infrastructure deployment and enhancing the developer experience. This year, the companies prioritized community feedback, incorporating highly requested features into the Google Cloud provider to address evolving user needs.
In version 5.16.0 of the Google provider, a new goog-terraform-provisioned = true
label was introduced, allowing users to easily identify resources created by Terraform when using other tools like gcloud or the GCP console. Initially, this label had to be manually enabled. However, with the release of version 6.0, the label is now automatically applied to all newly created resources by default. This behavior can be turned off through the provider configuration if needed. Users who prefer not to use the default label can disable it by setting the add_terraform_attribution_label
option to false in the provider block configuration:
provider "google" {
add_terraform_attribution_label = false
}
Furthermore, Terraform 1.8 added support for custom provider functions, allowing them to be called within Terraform configurations. Earlier this year, the Google Cloud provider introduced provider-defined functions, enabling users to easily retrieve regions, zones, names, and projects from resource IDs not managed by Terraform. These functions now also support parsing Google IDs when adding IAM bindings to resources managed outside of Terraform, simplifying the process further:
resource "google_cloud_run_service_iam_member" "example_run_invoker" {
member = "user:jan.kowalski@mail.com"
role = "run.invoker"
service = provider::google::name_from_id(var.cloud_run_service_id)
location = provider::google::location_from_id(var.cloud_run_service_id)
project = provider::google::project_from_id(var.cloud_run_service_id)
}
The version 6.0 release addresses an issue reported by Riccardo Albertazzi regarding the default behavior for name_prefix
in multiple resources. The maximum length for user-defined name_prefix
has been increased from 37 to 54 characters. For prefixes longer than 37 characters, the provider will now append a shorter suffix, providing flexibility for resource naming.
In version 6.0, the Terraform Google provider has removed various deprecated resources and properties that were either renamed or are no longer supported by Google. This major release addresses the accumulation of outdated elements over time. A complete list of behavior changes and removed properties can be found in the Google Provider 6.0 upgrade guide.