Skip to content

chore: cleanup unused autopilot vars #1170

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions autogen/main/main.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ locals {

release_channel = var.release_channel != null ? [{ channel : var.release_channel }] : []

{% if autopilot_cluster != true %}
autoscaling_resource_limits = var.cluster_autoscaling.enabled ? concat([{
resource_type = "cpu"
minimum = var.cluster_autoscaling.min_cpu_cores
Expand All @@ -65,6 +66,7 @@ locals {
minimum = var.cluster_autoscaling.min_memory_gb
maximum = var.cluster_autoscaling.max_memory_gb
}], var.cluster_autoscaling.gpu_resources) : []
{% endif %}


custom_kube_dns_config = length(keys(var.stub_domains)) > 0
Expand Down Expand Up @@ -92,7 +94,7 @@ locals {
provider = null
}]
{% endif %}
{% if beta_cluster %}
{% if beta_cluster and autopilot_cluster != true %}
cluster_cloudrun_config_load_balancer_config = (var.cloudrun && var.cloudrun_load_balancer_type != "") ? {
load_balancer_type = var.cloudrun_load_balancer_type
} : {}
Expand All @@ -104,21 +106,22 @@ locals {
local.cluster_cloudrun_config_load_balancer_config
)
] : []

cluster_cloudrun_enabled = var.cloudrun
cluster_gce_pd_csi_config = var.gce_pd_csi_driver ? [{ enabled = true }] : [{ enabled = false }]

{% endif %}

cluster_authenticator_security_group = var.authenticator_security_group == null ? [] : [{
security_group = var.authenticator_security_group
}]

{% if autopilot_cluster != true %}
// legacy mappings https://github.com/hashicorp/terraform-provider-google/pull/10238
old_node_metadata_config_mapping = { GKE_METADATA_SERVER = "GKE_METADATA", GCE_METADATA = "EXPOSE" }

cluster_node_metadata_config = var.node_metadata == "UNSPECIFIED" ? [] : [{
mode = lookup(local.old_node_metadata_config_mapping, var.node_metadata, var.node_metadata)
}]
{% endif %}

cluster_output_name = google_container_cluster.primary.name
cluster_output_regional_zones = google_container_cluster.primary.node_locations
Expand Down Expand Up @@ -192,7 +195,6 @@ locals {
{% if beta_cluster %}
# BETA features
cluster_istio_enabled = ! local.cluster_output_istio_disabled
cluster_cloudrun_enabled = var.cloudrun
cluster_dns_cache_enabled = var.dns_cache
cluster_telemetry_type_is_set = var.cluster_telemetry_type != null
cluster_pod_security_policy_enabled = local.cluster_output_pod_security_policy_enabled
Expand Down
14 changes: 9 additions & 5 deletions autogen/main/outputs.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -162,14 +162,18 @@ output "peering_name" {
{% endif %}
{% if beta_cluster %}

output "istio_enabled" {
description = "Whether Istio is enabled"
value = local.cluster_istio_enabled
}

output "cloudrun_enabled" {
description = "Whether CloudRun enabled"
{% if autopilot_cluster != true %}
value = local.cluster_cloudrun_enabled
{% else %}
value = false
{% endif %}
}

output "istio_enabled" {
description = "Whether Istio is enabled"
value = local.cluster_istio_enabled
}

output "dns_cache_enabled" {
Expand Down
Loading