0

我有一个问题,每次我创建一个新的实例模板时,terraform 都会自动删除我之前创建的实例。即使 auto_delete = false 并且名称不同,也会发生这种情况。我的代码位于下方。

    // Create instance template (replace with created image)
resource "google_compute_instance_template" "default" {
  name        = "appserver-template-020103"
  description = "This template is used to create app server instances."

  tags = ["foo", "bar"]

  labels = {
    environment = "dev"
  }

  instance_description = "description assigned to instances"
  machine_type         = "f1-micro"
  can_ip_forward       = false

  scheduling {
    automatic_restart   = true
    on_host_maintenance = "MIGRATE"
  }

  // Create a new boot disk from an image
  disk {
    source_image = "ubuntu-1604-xenial-v20180126"
    auto_delete  = false
    boot         = false
  }

  network_interface {
    network = "default"
  }

  metadata {
    foo = "bar"
  }

  service_account {
    scopes = ["userinfo-email", "compute-ro", "storage-ro"]
  }
}
4

0 回答 0