Upgrading from 7.9.0 to 8.0.0 breaks existing google_compute_instance_template
jsumali opened this issue · 0 comments
jsumali commented
TL;DR
Upgrading from 7.9.0 to 8.0.0, google_compute_instance_template
tries to get updated with network_interface.stack_type = IPV4_ONLY
but fails since templates can't be updated.
Expected behavior
The template should be recreated instead of trying to be updated.
Observed behavior
Terraform will perform the following actions:
# module.appname-instance-template.google_compute_instance_template.tpl will be updated in-place
~ resource "google_compute_instance_template" "tpl" {
id = "..."
name = "appname-20221013075303688800000005"
tags = [
"allow-from-bastion",
"appname",
]
# (8 unchanged attributes hidden)
~ network_interface {
name = "nic0"
+ stack_type = "IPV4_ONLY"
# (4 unchanged attributes hidden)
}
# (5 unchanged blocks hidden)
}
Plan: 0 to add, 1 to change, 0 to destroy.
Do you want to perform these actions?
Terraform will perform the actions described above.
Only 'yes' will be accepted to approve.
Enter a value: yes
module.appname-instance-template.google_compute_instance_template.tpl: Modifying... [id=...]
╷
│ Error: doesn't support update
│
│ with module.appname-instance-template.google_compute_instance_template.tpl,
│ on .terraform/modules/appname-instance-template/modules/instance_template/main.tf line 61, in resource "google_compute_instance_template" "tpl":
│ 61: resource "google_compute_instance_template" "tpl" {
│
Terraform Configuration
module "appname-instance-template" {
source = "terraform-google-modules/vm/google//modules/instance_template"
# TODO: version 8.0.0 breaks trying to add stack_type = "IPV4_ONLY" to an existing template
version = "8.0.0"
# insert the 3 required variables here
project_id = var.project_id
region = var.region
service_account = {
email = data.terraform_remote_state.global.outputs.service-accounts.service_accounts_map.single-account.email
scopes = ["cloud-platform"]
}
###
subnetwork = module.gcp-network.subnets["${var.region}/main"].name
tags = ["allow-from-bastion", "appname"]
machine_type = "e2-small"
source_image_project = var.project_id
source_image_family = var.appname_base_image
auto_delete = true
disk_size_gb = 10
name_prefix = "${var.env_prefix}appname"
preemptible = false
}
### Terraform Version
```sh
$ terraform version
Terraform v1.3.3
on darwin_amd64
+ provider registry.terraform.io/hashicorp/google v4.50.0
+ provider registry.terraform.io/hashicorp/google-beta v4.50.0
+ provider registry.terraform.io/hashicorp/kubernetes v2.17.0
+ provider registry.terraform.io/hashicorp/random v3.4.3
+ provider registry.terraform.io/hashicorp/tls v4.0.4
Your version of Terraform is out of date! The latest version
is 1.3.7. You can update by downloading from https://www.terraform.io/downloads.html
### Additional information
_No response_