Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrading from 7.9.0 to 8.0.0 breaks existing google_compute_instance_template #291

Closed
jsumali opened this issue Jan 25, 2023 · 0 comments · Fixed by #293
Closed

Upgrading from 7.9.0 to 8.0.0 breaks existing google_compute_instance_template #291

jsumali opened this issue Jan 25, 2023 · 0 comments · Fixed by #293
Labels
bug Something isn't working

Comments

@jsumali
Copy link

jsumali commented Jan 25, 2023

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_
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant