streamline gke module peering project id

This commit is contained in:
Ludovico Magnocavallo 2020-08-16 20:36:52 +02:00
parent a3962dcaf7
commit 2e644a3333
2 changed files with 6 additions and 2 deletions

View File

@ -58,7 +58,7 @@ module "cluster-1" {
| *min_master_version* | Minimum version of the master, defaults to the version of the most recent official release. | <code title="">string</code> | | <code title="">null</code> |
| *monitoring_service* | Monitoring service (disable with an empty string). | <code title="">string</code> | | <code title="">monitoring.googleapis.com/kubernetes</code> |
| *node_locations* | Zones in which the cluster's nodes are located. | <code title="list&#40;string&#41;">list(string)</code> | | <code title="">[]</code> |
| *peering_config* | Configure peering with the master VPC for private clusters. | <code title="object&#40;&#123;&#10;export_routes &#61; bool&#10;import_routes &#61; bool&#10;project_id &#61; string&#10;&#125;&#41;">object({...})</code> | | <code title="">null</code> |
| *peering_config* | Configure peering with the master VPC for private clusters. | <code title="object&#40;&#123;&#10;export_routes &#61; bool&#10;import_routes &#61; bool&#10;project_id &#61; string&#10;&#125;&#41;">object({...})</code> | | <code title="">null</code> |
| *pod_security_policy* | Enable the PodSecurityPolicy feature. | <code title="">bool</code> | | <code title="">null</code> |
| *private_cluster_config* | Enable and configure private cluster, private nodes must be true if used. | <code title="object&#40;&#123;&#10;enable_private_nodes &#61; bool&#10;enable_private_endpoint &#61; bool&#10;master_ipv4_cidr_block &#61; string&#10;&#125;&#41;">object({...})</code> | | <code title="">null</code> |
| *release_channel* | Release channel for GKE upgrades. | <code title="">string</code> | | <code title="">null</code> |

View File

@ -22,7 +22,11 @@ locals {
google_container_cluster.cluster.private_cluster_config.0.peering_name,
null
)
peering_project_id = try(var.peering_config.project_id, "") == "" ? var.project_id : (var.peering_config.project_id == "" ? var.project_id : var.peering_config.project_id)
peering_project_id = (
try(var.peering_config.project_id, null) == null
? var.project_id
: var.peering_config.project_id
)
}
resource "google_container_cluster" "cluster" {