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

Upgrade of instance_template and compute_instance from v10.1.1 to v11.1.0 triggers replacement of the VM #402

Closed
drengskapr opened this issue May 2, 2024 · 1 comment
Labels
bug Something isn't working Stale

Comments

@drengskapr
Copy link

TL;DR

Hello there! My VM was created using instance_template and compute_instance modules both v10.1.1. Now after I have upgraded these modules version to v11.1.0 terraform plan triggers replacement of that VM. Nothing apart from module versions is changed.

Expected behavior

terraform plan must not trigger replacement of the VM

Observed behavior

source_instance_template  = "https://www.googleapis.com/compute/v1/projects/my-project/global/instanceTemplates/vm-xxx" -> "https://www.googleapis.com/compute/beta/projects/my-project/global/instanceTemplates/vm-xxx" # forces replacement

Since v11.0.0 instance_template module uses google-beta provider instead of google, thus the source_instance_template is changed. Note https://www.googleapis.com/compute/v1 is changed to https://www.googleapis.com/compute/beta.

Terraform Configuration

module "instance_template" {
  source               = "terraform-google-modules/vm/google//modules/instance_template"
  version              = "11.1.0"
  name_prefix          = "vm-vpn-template"
  metadata             = var.vm_vpn_metadata
  tags                 = var.vm_vpn_tags
  region               = var.default_region
  project_id           = var.default_project
  subnetwork           = var.management_subnetwork_name
  service_account      = var.service_account
  machine_type         = var.vm_vpn_machine_type
  disk_type            = var.vm_vpn_disk_type
  disk_size_gb         = var.vm_vpn_disk_size_gb
  source_image_family  = var.vm_vpn_source_image_family
  source_image_project = var.vm_vpn_source_image_project
  can_ip_forward       = false
  enable_shielded_vm   = true

  shielded_instance_config = {
    enable_secure_boot          = true
    enable_vtpm                 = false
    enable_integrity_monitoring = false
  }

}

module "compute_instance" {
  source              = "terraform-google-modules/vm/google//modules/compute_instance"
  version             = "11.1.0"
  region              = var.default_region
  zone                = var.default_zone
  subnetwork          = var.management_subnetwork_name
  num_instances       = var.vm_vpn_num_instances
  hostname            = "vpn"
  instance_template   = module.instance_template.self_link

  access_config = [{
    nat_ip       = google_compute_address.vpn_external_ip.address
    network_tier = var.vm_vpn_network_tier
  }, ]
}

Terraform Version

v1.7.5

Additional information

If I use instance_template v10.1.1 and compute_instance v11.1.0 everything is working fine.

@drengskapr drengskapr added the bug Something isn't working label May 2, 2024
Copy link

github-actions bot commented Jul 1, 2024

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days

@github-actions github-actions bot added the Stale label Jul 1, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jul 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Stale
1 participant