总是重新创建地形资源google_compute_instance_group_named_port

时间:2020-10-15 10:08:57

标签: google-cloud-platform continuous-integration terraform


应用Terraform时,尽管没有任何更改,但始终会重新创建资源google_compute_instance_group_named_port。
有人可以帮助我了解为什么会这样吗?
这是google_compute_instance_group_named_port模块配置:
resource "google_compute_instance_group_named_port" "instance_group_node_port" {
  group       = var.instance_group_name
  zone        = var.zone
  name        = "port-${var.istio_node_port}"
  port        = var.istio_node_port
}
正在从istio模块的kubernetes提供程序读取

istio_node_port:

data "kubernetes_service" "istio-ingressgateway" {
  metadata {
    name      = "istio-ingressgateway"
    namespace = "istio-system"
  }
}

output "istio_node_port" {
  value = data.kubernetes_service.istio-ingressgateway.spec.0.port[2].node_port
}

module.tf:

module "instance_group_named_port" {
  source              = "modules/instance_group_named_port"
  instance_group_name = module.gke_cluster.gke_cluster_instance_group_urls.0
  zone                = var.GCP_ZONE_1
  istio_node_port     = module.istio.istio_node_port
}

这是计划的输出:

# module.instance_group_named_port.google_compute_instance_group_named_port.instance_group_node_port must be replaced
 -/+ resource "google_compute_instance_group_named_port" "instance_group_node_port" {
       ~ group   = "cluster--default-pool-21bb12ca-grp" -> "https://www.googleapis.com/compute/beta/projects/my-proj/zones/europe-west1-b/instanceGroups/cluster--default-pool-21bb12ca-grp"
       ~ id      = "projects/my_proj/zones/europe-west1-b/instanceGroups/cluster--default-pool-21bb12ca-grp/30336/port-30336" -> (known after apply)
       ~ name    = "port-30336" -> (known after apply) # forces replacement
       ~ port    = 30336 -> (known after apply) # forces replacement
       ~ project = "my_proj" -> (known after apply)
         zone    = "europe-west1-b"
}

0 个答案:

没有答案