page_title | description |
---|---|
Terraform provider for Google Cloud 6.0.0 Upgrade Guide |
Terraform provider for Google Cloud 6.0.0 Upgrade Guide |
The 6.0.0
release of the Google provider for Terraform is a major version and
includes some changes that you will need to consider when upgrading. This guide
is intended to help with that process and focuses only on the changes necessary
to upgrade from the final 5.X
series release to 6.0.0
.
Most of the changes outlined in this guide have been previously marked as
deprecated in the Terraform plan
/apply
output throughout previous provider
releases, up to and including the final 5.X
series release. These changes,
such as deprecation notices, can always be found in the CHANGELOG of the
affected providers. google
google-beta
If you've inadvertently upgraded to 6.0.0
, first see the
Provider Version Configuration Guide to lock
your provider version; if you've constrained the provider to a lower version
such as shown in the previous version example in that guide, Terraform will pull
in a 5.X
series release on terraform init
.
If you've only ran terraform init
or terraform plan
, your state will not
have been modified and downgrading your provider is sufficient.
If you've ran terraform refresh
or terraform apply
, Terraform may have made
state changes in the meantime.
-
If you're using a local state, or a remote state backend that does not support versioning,
terraform refresh
with a downgraded provider is likely sufficient to revert your state. The Google provider generally refreshes most state information from the API, and the properties necessary to do so have been left unchanged. -
If you're using a remote state backend that supports versioning such as Google Cloud Storage, you can revert the Terraform state file to a previous version. If you do so and Terraform had created resources as part of a
terraform apply
in the meantime, you'll need to either delete them by hand orterraform import
them so Terraform knows to manage them.
-> Before upgrading to version 6.0.0, it is recommended to upgrade to the most
recent 5.X
series release of the provider, make the changes noted in this guide,
and ensure that your environment successfully runs
terraform plan
without unexpected changes or deprecation notices.
It is recommended to use version constraints
when configuring Terraform providers. If you are following that recommendation,
update the version constraints in your Terraform configuration and run
terraform init
to download
the new version.
If you aren't using version constraints, you can use terraform init -upgrade
in order to upgrade your provider to the latest released version.
For example, given this previous configuration:
terraform {
required_providers {
google = {
version = "~> 5.30.0"
}
}
}
An updated configuration:
terraform {
required_providers {
google = {
version = "~> 6.0.0"
}
}
}
Description of the change and how users should adjust their configuration (if needed).
Description of the change and how users should adjust their configuration (if needed).
A view
can no longer be created when schema
contains required fields
This field is no longer supported by the BigQuery Reservation API.
Removed in favor of field settings.ip_configuration.ssl_mode
.
An empty value means the setting should be cleared.
The field deletion_protection
has been added with a default value of true
. This field prevents
Terraform from destroying or recreating the Domain. In 6.0.0, existing domains will have
deletion_protection
set to true
during the next refresh unless otherwise set in configuration.
deletion_protection
does NOT prevent deletion outside of Terraform.
To disable deletion protection, explicitly set this field to false
in configuration
and then run terraform apply
to apply the change.
Previously, containers.env
was a list, making it order-dependent. It is now a set.
If you were relying on accessing an individual environment variable by index (for example, google_cloud_run_v2_job.template.containers.0.env.0.name
), then that will now need to by hash (for example, google_cloud_run_v2_job.template.containers.0.env.<some-hash>.name
).
Cloud Run does not provide a default value for liveness probe. Now removing this field will remove the liveness probe from the Cloud Run service.
Previously, containers.env
was a list, making it order-dependent. It is now a set.
If you were relying on accessing an individual environment variable by index (for example, google_cloud_run_v2_service.template.containers.0.env.0.name
), then that will now need to by hash (for example, google_cloud_run_v2_service.template.containers.0.env.<some-hash>.name
).
To apply the IAP settings to the backend service, true
needs to be set for enabled
field.
Empty values mean the setting should be cleared.
An empty value now means 300.
An empty value now means UTILIZATION.
The fields min_throughput
and max_throughput
no longer have default values
set by the provider. This was necessary to add conflicting field validation, also
described in this guide.
No configuration changes are needed for existing resources as these fields' values will default to values present in data returned from the API.
Conflicting field validation added for min_throughput
and min_instances
, and max_throughput
and max_instances
The provider will now enforce that google_vpc_access_connector
resources can only
include one of min_throughput
and min_instances
and one of max_throughput
and
max_instances
. Previously if a user included all four fields in a resource block
they would experience a permadiff. This is a result of how min_instances
and
max_instances
fields' values take precedence in the API, and how the API calculates
values for min_throughput
and max_throughput
that match the number of instances.
Users will need to check their configuration for any google_vpc_access_connector
resource blocks that contain both fields in a conflicting pair, and remove one of those fields.
The fields that are removed from the configuration will still have Computed values,
that are derived from the API.