2022-04-03 13:32:52 -07:00
|
|
|
/**
|
|
|
|
* Copyright 2022 Google LLC
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
2022-10-12 03:59:36 -07:00
|
|
|
# tfdoc:file:description GKE hub configuration.
|
|
|
|
|
2022-07-29 02:31:34 -07:00
|
|
|
locals {
|
|
|
|
fleet_enabled = (
|
|
|
|
var.fleet_features != null || var.fleet_workload_identity
|
|
|
|
)
|
2022-08-02 09:28:06 -07:00
|
|
|
fleet_mcs_enabled = (
|
|
|
|
try(var.fleet_features.multiclusterservicediscovery, false) == true
|
|
|
|
)
|
2022-07-29 02:31:34 -07:00
|
|
|
}
|
|
|
|
|
2022-04-03 13:32:52 -07:00
|
|
|
module "gke-hub" {
|
2022-08-10 06:37:20 -07:00
|
|
|
source = "../../../modules/gke-hub"
|
2022-07-29 02:31:34 -07:00
|
|
|
count = local.fleet_enabled ? 1 : 0
|
2022-04-03 13:32:52 -07:00
|
|
|
project_id = module.gke-project-0.project_id
|
2022-07-29 02:31:34 -07:00
|
|
|
clusters = {
|
2022-04-03 13:32:52 -07:00
|
|
|
for cluster_id in keys(var.clusters) :
|
|
|
|
cluster_id => module.gke-cluster[cluster_id].id
|
|
|
|
}
|
2022-07-29 02:31:34 -07:00
|
|
|
features = var.fleet_features
|
|
|
|
configmanagement_templates = var.fleet_configmanagement_templates
|
|
|
|
configmanagement_clusters = var.fleet_configmanagement_clusters
|
|
|
|
workload_identity_clusters = (
|
|
|
|
var.fleet_workload_identity ? keys(var.clusters) : []
|
|
|
|
)
|
2022-08-25 08:35:51 -07:00
|
|
|
|
|
|
|
depends_on = [
|
|
|
|
module.gke-nodepool
|
|
|
|
]
|
2022-04-03 13:32:52 -07:00
|
|
|
}
|