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"
}