terraform自动删除旧的实例模板

时间:2018-02-21 20:56:30

标签: google-cloud-platform terraform terraform-provider-gcp

我遇到一个问题,每当我创建一个新的实例模板时,terraform auto会删除我创建的上一个实例。即使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"]
  }
}

0 个答案:

没有答案
相关问题