Skip to content

Commit 99d8e37

Browse files
Added support for resource usage export config
* Based on PR #230 * Add support for beta feature resource_usage_export_config (Fixes #232)
1 parent a95ce1b commit 99d8e37

File tree

10 files changed

+20
-12
lines changed

10 files changed

+20
-12
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Extending the adopted spec, each change should have a link to its corresponding
99
## [Unreleased]
1010
### Added
1111

12+
* Added support for resource usage export config [#238]
1213
* Added `grant_registry_access` variable to grant Container Registry access to created SA [#236]
1314
* Support for Intranode Visbiility (IV) and Veritical Pod Autoscaling (VPA) beta features [#216]
1415
* Support for Workload Identity beta feature [#234]
@@ -170,6 +171,7 @@ Extending the adopted spec, each change should have a link to its corresponding
170171
[v0.3.0]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/compare/v0.2.0...v0.3.0
171172
[v0.2.0]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/compare/v0.1.0...v0.2.0
172173

174+
[#238]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/238
173175
[#236]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/236
174176
[#217]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/217
175177
[#234]: https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/pull/234

autogen/cluster.tf

+2-1
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,13 @@ resource "google_container_cluster" "primary" {
6666
enabled = pod_security_policy_config.value.enabled
6767
}
6868
}
69+
6970
dynamic "resource_usage_export_config" {
7071
for_each = var.resource_usage_export_dataset_id != "" ? [var.resource_usage_export_dataset_id] : []
7172
content {
7273
enable_network_egress_metering = true
7374
bigquery_destination {
74-
dataset_id = resource_usage_export_dataset_id.value
75+
dataset_id = resource_usage_export_config.value
7576
}
7677
}
7778
}

autogen/main.tf

+3-3
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,10 @@ locals {
102102

103103
{% if beta_cluster %}
104104
# BETA features
105-
cluster_output_istio_enabled = google_container_cluster.primary.addons_config.0.istio_config != null ? google_container_cluster.primary.addons_config.0.istio_config.0.disabled : "true"
106-
cluster_output_pod_security_policy_enabled = google_container_cluster.primary.pod_security_policy_config != null ? google_container_cluster.primary.pod_security_policy_config.0.enabled : "false"
105+
cluster_output_istio_enabled = google_container_cluster.primary.addons_config.0.istio_config.0.disabled
106+
cluster_output_pod_security_policy_enabled = google_container_cluster.primary.pod_security_policy_config.0.enabled
107107
cluster_output_intranode_visbility_enabled = google_container_cluster.primary.enable_intranode_visibility
108-
cluster_output_vertical_pod_autoscaling_enabled = google_container_cluster.primary.vertical_pod_autoscaling != null ? google_container_cluster.primary.vertical_pod_autoscaling.0.enabled : "false"
108+
cluster_output_vertical_pod_autoscaling_enabled = google_container_cluster.primary.vertical_pod_autoscaling.0.enabled
109109

110110
# /BETA features
111111
{% endif %}

autogen/variables.tf

+1
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,7 @@ variable "pod_security_policy_config" {
367367
}
368368

369369
variable "resource_usage_export_dataset_id" {
370+
type = string
370371
description = "The dataset id for which network egress metering for this cluster will be enabled. If enabled, a daemonset will be created in the cluster to meter network egress traffic."
371372
default = ""
372373
}

modules/beta-private-cluster/cluster.tf

+2-1
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,13 @@ resource "google_container_cluster" "primary" {
6161
enabled = pod_security_policy_config.value.enabled
6262
}
6363
}
64+
6465
dynamic "resource_usage_export_config" {
6566
for_each = var.resource_usage_export_dataset_id != "" ? [var.resource_usage_export_dataset_id] : []
6667
content {
6768
enable_network_egress_metering = true
6869
bigquery_destination {
69-
dataset_id = resource_usage_export_dataset_id.value
70+
dataset_id = resource_usage_export_config.value
7071
}
7172
}
7273
}

modules/beta-private-cluster/main.tf

+3-3
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,10 @@ locals {
9191
cluster_output_kubernetes_dashboard_enabled = google_container_cluster.primary.addons_config.0.kubernetes_dashboard.0.disabled
9292

9393
# BETA features
94-
cluster_output_istio_enabled = google_container_cluster.primary.addons_config.0.istio_config != null ? google_container_cluster.primary.addons_config.0.istio_config.0.disabled : "true"
95-
cluster_output_pod_security_policy_enabled = google_container_cluster.primary.pod_security_policy_config != null ? google_container_cluster.primary.pod_security_policy_config.0.enabled : "false"
94+
cluster_output_istio_enabled = google_container_cluster.primary.addons_config.0.istio_config.0.disabled
95+
cluster_output_pod_security_policy_enabled = google_container_cluster.primary.pod_security_policy_config.0.enabled
9696
cluster_output_intranode_visbility_enabled = google_container_cluster.primary.enable_intranode_visibility
97-
cluster_output_vertical_pod_autoscaling_enabled = google_container_cluster.primary.vertical_pod_autoscaling != null ? google_container_cluster.primary.vertical_pod_autoscaling.0.enabled : "false"
97+
cluster_output_vertical_pod_autoscaling_enabled = google_container_cluster.primary.vertical_pod_autoscaling.0.enabled
9898

9999
# /BETA features
100100

modules/beta-private-cluster/variables.tf

+1
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,7 @@ variable "pod_security_policy_config" {
364364
}
365365

366366
variable "resource_usage_export_dataset_id" {
367+
type = string
367368
description = "The dataset id for which network egress metering for this cluster will be enabled. If enabled, a daemonset will be created in the cluster to meter network egress traffic."
368369
default = ""
369370
}

modules/beta-public-cluster/cluster.tf

+2-1
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,13 @@ resource "google_container_cluster" "primary" {
6161
enabled = pod_security_policy_config.value.enabled
6262
}
6363
}
64+
6465
dynamic "resource_usage_export_config" {
6566
for_each = var.resource_usage_export_dataset_id != "" ? [var.resource_usage_export_dataset_id] : []
6667
content {
6768
enable_network_egress_metering = true
6869
bigquery_destination {
69-
dataset_id = resource_usage_export_dataset_id.value
70+
dataset_id = resource_usage_export_config.value
7071
}
7172
}
7273
}

modules/beta-public-cluster/main.tf

+3-3
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,10 @@ locals {
9191
cluster_output_kubernetes_dashboard_enabled = google_container_cluster.primary.addons_config.0.kubernetes_dashboard.0.disabled
9292

9393
# BETA features
94-
cluster_output_istio_enabled = google_container_cluster.primary.addons_config.0.istio_config != null ? google_container_cluster.primary.addons_config.0.istio_config.0.disabled : "true"
95-
cluster_output_pod_security_policy_enabled = google_container_cluster.primary.pod_security_policy_config != null ? google_container_cluster.primary.pod_security_policy_config.0.enabled : "false"
94+
cluster_output_istio_enabled = google_container_cluster.primary.addons_config.0.istio_config.0.disabled
95+
cluster_output_pod_security_policy_enabled = google_container_cluster.primary.pod_security_policy_config.0.enabled
9696
cluster_output_intranode_visbility_enabled = google_container_cluster.primary.enable_intranode_visibility
97-
cluster_output_vertical_pod_autoscaling_enabled = google_container_cluster.primary.vertical_pod_autoscaling != null ? google_container_cluster.primary.vertical_pod_autoscaling.0.enabled : "false"
97+
cluster_output_vertical_pod_autoscaling_enabled = google_container_cluster.primary.vertical_pod_autoscaling.0.enabled
9898

9999
# /BETA features
100100

modules/beta-public-cluster/variables.tf

+1
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,7 @@ variable "pod_security_policy_config" {
340340
}
341341

342342
variable "resource_usage_export_dataset_id" {
343+
type = string
343344
description = "The dataset id for which network egress metering for this cluster will be enabled. If enabled, a daemonset will be created in the cluster to meter network egress traffic."
344345
default = ""
345346
}

0 commit comments

Comments
 (0)