google_gke_hub_feature

Feature represents the settings and status of any Hub Feature.

To get more information about Feature, see:

Example Usage - Gkehub Feature Multi Cluster Ingress

resource "google_container_cluster" "cluster" {
  name               = "my-cluster"
  location           = "us-central1-a"
  initial_node_count = 1
}

resource "google_gke_hub_membership" "membership" {
  membership_id = "my-membership"
  endpoint {
    gke_cluster {
      resource_link = "//container.googleapis.com/${google_container_cluster.cluster.id}"
    }
  }
  description = "Membership"
}

resource "google_gke_hub_feature" "feature" {
  name = "multiclusteringress"
  location = "global"
  spec {
    multiclusteringress {
      config_membership = google_gke_hub_membership.membership.id
    }
  }
}

Example Usage - Gkehub Feature Multi Cluster Service Discovery

resource "google_gke_hub_feature" "feature" {
  name = "multiclusterservicediscovery"
  location = "global"
  labels = {
    foo = "bar"
  }
}

Example Usage - Gkehub Feature Anthos Service Mesh

resource "google_gke_hub_feature" "feature" {
  name = "servicemesh"
  location = "global"
}

Example Usage - Enable Fleet Observability For Default Logs With Copy

resource "google_gke_hub_feature" "feature" {
  name = "fleetobservability"
  location = "global"
  spec {
    fleetobservability {
      logging_config {
        default_config {
          mode = "COPY"
        }
      }
    }
  }
}

Example Usage - Enable Fleet Observability For Scope Logs With Move

resource "google_gke_hub_feature" "feature" {
  name = "fleetobservability"
  location = "global"
  spec {
    fleetobservability {
      logging_config {
        fleet_scope_logs_config {
          mode = "MOVE"
        }
      }
    }
  }
}

Example Usage - Enable Fleet Observability For Both Default And Scope Logs

resource "google_gke_hub_feature" "feature" {
  name = "fleetobservability"
  location = "global"
  spec {
    fleetobservability {
      logging_config {
        default_config {
          mode = "COPY"
        }
        fleet_scope_logs_config {
          mode = "MOVE"
        }
      }
    }
  }
}

Example Usage - Enable Fleet Default Member Config Service Mesh

resource "google_gke_hub_feature" "feature" {
  name = "servicemesh"
  location = "global"
  fleet_default_member_config {
    mesh {
      management = "MANAGEMENT_AUTOMATIC"
    }
  }
}

Example Usage - Enable Fleet Default Member Config Configmanagement

resource "google_gke_hub_feature" "feature" {
  name = "configmanagement"
  location = "global"
  fleet_default_member_config {
    configmanagement {
      config_sync {
        git {
          sync_repo = "https://github.com/hashicorp/terraform"
        }
      }
    }
  }
}

Example Usage - Enable Fleet Default Member Config Policycontroller

resource "google_gke_hub_feature" "feature" {
  name = "policycontroller"
  location = "global"
  fleet_default_member_config {
    policycontroller {
      policy_controller_hub_config {
        install_spec = "INSTALL_SPEC_ENABLED"
        exemptable_namespaces = ["foo"]
        policy_content {
          bundles {
            bundle = "policy-essentials-v2022"
            exempted_namespaces = ["foo", "bar"]
          }
          template_library {
            installation = "ALL"
          }
        }
        audit_interval_seconds = 30
        referential_rules_enabled = true
      }
    }
  }
}

Example Usage - Enable Fleet Default Member Config Policycontroller Full

resource "google_gke_hub_feature" "feature" {
  name = "policycontroller"
  location = "global"
  fleet_default_member_config {
    policycontroller {
      policy_controller_hub_config {
        install_spec = "INSTALL_SPEC_SUSPENDED"
        policy_content {
          bundles {
            bundle = "pci-dss-v3.2.1"
            exempted_namespaces = ["baz", "bar"]
          }
          bundles {
            bundle = "nist-sp-800-190"
            exempted_namespaces = []
          }
          template_library {
            installation = "ALL"
          }
        }
        constraint_violation_limit = 50
        referential_rules_enabled = true
        log_denies_enabled = true
        mutation_enabled = true
        deployment_configs {
          component = "admission"
          replica_count = 2
          pod_affinity = "ANTI_AFFINITY"
        }
        deployment_configs {
          component = "audit"
          container_resources {
            limits {
              memory = "1Gi"
              cpu = "1.5"
            }
            requests {
              memory = "500Mi"
              cpu = "150m"
            }
          }
          pod_toleration {
            key = "key1"
            operator = "Equal"
            value = "value1"
            effect = "NoSchedule"
          }
        }
        monitoring {
          backends = [
            "PROMETHEUS"
          ]
        }
      }
    }
  }
}

Example Usage - Enable Fleet Default Member Config Policycontroller Minimal

resource "google_gke_hub_feature" "feature" {
  name = "policycontroller"
  location = "global"
  fleet_default_member_config {
    policycontroller {
      policy_controller_hub_config {
        install_spec = "INSTALL_SPEC_ENABLED"
        policy_content {}
        constraint_violation_limit = 50
        referential_rules_enabled = true
        log_denies_enabled = true
        mutation_enabled = true
        deployment_configs {
          component = "admission"
        }
        monitoring {}
      }
    }
  }
}

Example Usage - Gkehub Feature Clusterupgrade

resource "google_gke_hub_feature" "feature" {
  name = "clusterupgrade"
  location = "global"
  spec {
    clusterupgrade {
      upstream_fleets = []
      post_conditions {
        soaking = "60s"
      }
    }
  }
}

Argument Reference

The following arguments are supported:


The spec block supports:

The multiclusteringress block supports:

The fleetobservability block supports:

The logging_config block supports:

The default_config block supports:

The fleet_scope_logs_config block supports:

The clusterupgrade block supports:

The post_conditions block supports:

The gke_upgrade_overrides block supports:

The upgrade block supports:

The post_conditions block supports:

The fleet_default_member_config block supports:

The mesh block supports:

The configmanagement block supports:

The config_sync block supports:

The git block supports:

The oci block supports:

The policycontroller block supports:

The policy_controller_hub_config block supports:

The monitoring block supports:

The deployment_configs block supports:

The container_resources block supports:

The limits block supports:

The requests block supports:

The pod_toleration block supports:

The policy_content block supports:

The template_library block supports:

The bundles block supports:

Attributes Reference

In addition to the arguments listed above, the following computed attributes are exported:

The resource_state block contains:

The state block contains:

The state block contains:

Timeouts

This resource provides the following Timeouts configuration options:

Import

Feature can be imported using any of these accepted formats:

In Terraform v1.5.0 and later, use an import block to import Feature using one of the formats above. For example:

import {
  id = "projects/{{project}}/locations/{{location}}/features/{{name}}"
  to = google_gke_hub_feature.default
}

When using the terraform import command, Feature can be imported using one of the formats above. For example:

$ terraform import google_gke_hub_feature.default projects/{{project}}/locations/{{location}}/features/{{name}}
$ terraform import google_gke_hub_feature.default {{project}}/{{location}}/{{name}}
$ terraform import google_gke_hub_feature.default {{location}}/{{name}}

User Project Overrides

This resource supports User Project Overrides.