Skip to content

Commit

Permalink
feat: added lebale
Browse files Browse the repository at this point in the history
  • Loading branch information
Kkhandale2024 committed Aug 28, 2024
1 parent 5b2bfd5 commit c832fda
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 0 deletions.
6 changes: 6 additions & 0 deletions examples/managed-node-pools/example.tf
Original file line number Diff line number Diff line change
Expand Up @@ -129,4 +129,10 @@ module "gke" {
preemptible = true
}
]

enable_resource_labels = false

resource_labels = {
"env" = "production"
}
}

Check notice

Code scanning / defsec

Clusters should be configured with Labels Note

Cluster does not use GCE resource labels.

Check failure

Code scanning / defsec

Master authorized networks should be configured on GKE clusters Error

Cluster does not have master authorized networks enabled.

Check warning

Code scanning / defsec

Clusters should be set to private Warning

Cluster does not have private nodes.

Check warning

Code scanning / defsec

Network Policy should be enabled on GKE clusters Warning

Cluster does not have a network policy enabled.
6 changes: 6 additions & 0 deletions examples/self-hosted-node-pools/example.tf
Original file line number Diff line number Diff line change
Expand Up @@ -127,4 +127,10 @@ module "gke" {
preemptible = true
}
]

enable_resource_labels = false

resource_labels = {
"env" = "production"
}
}

Check failure

Code scanning / defsec

Node metadata value disables metadata concealment. Error

Node pool exposes node metadata.

Check failure

Code scanning / defsec

Node metadata value disables metadata concealment. Error

Node pool exposes node metadata.

Check notice

Code scanning / defsec

Ensure Container-Optimized OS (cos) is used for Kubernetes Engine Clusters Node image Note

Node pool is not using the COS containerd image type.

Check notice

Code scanning / defsec

Ensure Container-Optimized OS (cos) is used for Kubernetes Engine Clusters Node image Note

Node pool is not using the COS containerd image type.

Check notice

Code scanning / defsec

Clusters should be configured with Labels Note

Cluster does not use GCE resource labels.

Check failure

Code scanning / defsec

Master authorized networks should be configured on GKE clusters Error

Cluster does not have master authorized networks enabled.

Check warning

Code scanning / defsec

Clusters should be set to private Warning

Cluster does not have private nodes.

Check warning

Code scanning / defsec

Network Policy should be enabled on GKE clusters Warning

Cluster does not have a network policy enabled.
2 changes: 2 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ resource "google_container_cluster" "primary" {
}
}

resource_labels = var.enable_resource_labels ? var.resource_labels : {}

cluster_autoscaling {
enabled = var.cluster_autoscaling

Expand Down
10 changes: 10 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -300,4 +300,14 @@ variable "enable_master_authorized_networks" {
default = true
}

variable "enable_resource_labels" {
description = "Flag to enable or disable GCE resource labels."
type = bool
default = false
}

variable "resource_labels" {
description = "Resource labels for GCE resources."
type = map(string)
default = {}
}

0 comments on commit c832fda

Please sign in to comment.