Skip to content

Commit 325ee8e

Browse files
authored
chore: cleanup unused autopilot vars (terraform-google-modules#1170)
* chore: cleanup unused autopilot vars * address comments
1 parent a68fe69 commit 325ee8e

File tree

26 files changed

+1034
-1496
lines changed

26 files changed

+1034
-1496
lines changed

autogen/main/main.tf.tmpl

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ locals {
5656

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

59+
{% if autopilot_cluster != true %}
5960
autoscaling_resource_limits = var.cluster_autoscaling.enabled ? concat([{
6061
resource_type = "cpu"
6162
minimum = var.cluster_autoscaling.min_cpu_cores
@@ -65,6 +66,7 @@ locals {
6566
minimum = var.cluster_autoscaling.min_memory_gb
6667
maximum = var.cluster_autoscaling.max_memory_gb
6768
}], var.cluster_autoscaling.gpu_resources) : []
69+
{% endif %}
6870

6971

7072
custom_kube_dns_config = length(keys(var.stub_domains)) > 0
@@ -92,7 +94,7 @@ locals {
9294
provider = null
9395
}]
9496
{% endif %}
95-
{% if beta_cluster %}
97+
{% if beta_cluster and autopilot_cluster != true %}
9698
cluster_cloudrun_config_load_balancer_config = (var.cloudrun && var.cloudrun_load_balancer_type != "") ? {
9799
load_balancer_type = var.cloudrun_load_balancer_type
98100
} : {}
@@ -104,21 +106,22 @@ locals {
104106
local.cluster_cloudrun_config_load_balancer_config
105107
)
106108
] : []
107-
109+
cluster_cloudrun_enabled = var.cloudrun
108110
cluster_gce_pd_csi_config = var.gce_pd_csi_driver ? [{ enabled = true }] : [{ enabled = false }]
109-
110111
{% endif %}
111112

112113
cluster_authenticator_security_group = var.authenticator_security_group == null ? [] : [{
113114
security_group = var.authenticator_security_group
114115
}]
115116

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

119121
cluster_node_metadata_config = var.node_metadata == "UNSPECIFIED" ? [] : [{
120122
mode = lookup(local.old_node_metadata_config_mapping, var.node_metadata, var.node_metadata)
121123
}]
124+
{% endif %}
122125

123126
cluster_output_name = google_container_cluster.primary.name
124127
cluster_output_regional_zones = google_container_cluster.primary.node_locations
@@ -192,7 +195,6 @@ locals {
192195
{% if beta_cluster %}
193196
# BETA features
194197
cluster_istio_enabled = ! local.cluster_output_istio_disabled
195-
cluster_cloudrun_enabled = var.cloudrun
196198
cluster_dns_cache_enabled = var.dns_cache
197199
cluster_telemetry_type_is_set = var.cluster_telemetry_type != null
198200
cluster_pod_security_policy_enabled = local.cluster_output_pod_security_policy_enabled

autogen/main/outputs.tf.tmpl

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -162,14 +162,18 @@ output "peering_name" {
162162
{% endif %}
163163
{% if beta_cluster %}
164164

165-
output "istio_enabled" {
166-
description = "Whether Istio is enabled"
167-
value = local.cluster_istio_enabled
168-
}
169-
170165
output "cloudrun_enabled" {
171166
description = "Whether CloudRun enabled"
167+
{% if autopilot_cluster != true %}
172168
value = local.cluster_cloudrun_enabled
169+
{% else %}
170+
value = false
171+
{% endif %}
172+
}
173+
174+
output "istio_enabled" {
175+
description = "Whether Istio is enabled"
176+
value = local.cluster_istio_enabled
173177
}
174178

175179
output "dns_cache_enabled" {

0 commit comments

Comments
 (0)