google_gkeonprem_bare_metal_cluster

A Google Bare Metal User Cluster.

Example Usage - Gkeonprem Bare Metal Cluster Basic

resource "google_gkeonprem_bare_metal_cluster" "cluster-basic" {
  name = "my-cluster"
  location = "us-west1"
  admin_cluster_membership = "projects/870316890899/locations/global/memberships/gkeonprem-terraform-test"
  bare_metal_version = "1.12.3"
  network_config {
    island_mode_cidr {
      service_address_cidr_blocks = ["172.26.0.0/16"]
      pod_address_cidr_blocks = ["10.240.0.0/13"]
    }
  }
  control_plane {
    control_plane_node_pool_config {
      node_pool_config {
        labels = {}
        operating_system = "LINUX"
        node_configs {
          labels = {}
          node_ip = "10.200.0.9"
        }
      }
    }
  }
  load_balancer {
    port_config {
      control_plane_load_balancer_port = 443
    }
    vip_config {
      control_plane_vip = "10.200.0.13"
      ingress_vip = "10.200.0.14"
    }
    metal_lb_config {
      address_pools {
        pool = "pool1"
        addresses = [
          "10.200.0.14/32",
          "10.200.0.15/32",
          "10.200.0.16/32",
          "10.200.0.17/32",
          "10.200.0.18/32",
          "fd00:1::f/128",
          "fd00:1::10/128",
          "fd00:1::11/128",
          "fd00:1::12/128"
        ]
        avoid_buggy_ips = true
        manual_assign = true
      }
    }
  }
  storage {
    lvp_share_config {
      lvp_config {
        path = "/mnt/localpv-share"
        storage_class = "local-shared"
      }
      shared_path_pv_count = 5
    }
    lvp_node_mounts_config {
      path = "/mnt/localpv-disk"
      storage_class = "local-disks"
    }
  }
  security_config {
    authorization {
      admin_users {
        username = "admin@hashicorptest.com"
      }
    }
  }
}

Example Usage - Gkeonprem Bare Metal Cluster Manuallb

resource "google_gkeonprem_bare_metal_cluster" "cluster-manuallb" {
  name = "cluster-manuallb"
  location = "us-west1"
  admin_cluster_membership = "projects/870316890899/locations/global/memberships/gkeonprem-terraform-test"
  bare_metal_version = "1.12.3"
  network_config {
    island_mode_cidr {
      service_address_cidr_blocks = ["172.26.0.0/16"]
      pod_address_cidr_blocks = ["10.240.0.0/13"]
    }
  }
  control_plane {
    control_plane_node_pool_config {
      node_pool_config {
        labels = {}
        operating_system = "LINUX"
        node_configs {
          labels = {}
          node_ip = "10.200.0.9"
        }
      }
    }
  }
  load_balancer {
    port_config {
      control_plane_load_balancer_port = 443
    }
    vip_config {
      control_plane_vip = "10.200.0.13"
      ingress_vip = "10.200.0.14"
    }
    manual_lb_config {
      enabled = true
    }
  }
  storage {
    lvp_share_config {
      lvp_config {
        path = "/mnt/localpv-share"
        storage_class = "local-shared"
      }
      shared_path_pv_count = 5
    }
    lvp_node_mounts_config {
      path = "/mnt/localpv-disk"
      storage_class = "local-disks"
    }
  }
  security_config {
    authorization {
      admin_users {
        username = "admin@hashicorptest.com"
      }
    }
  }
  binary_authorization {
    evaluation_mode = "DISABLED"
  }
  upgrade_policy {
    policy = "SERIAL"
  }
}

Example Usage - Gkeonprem Bare Metal Cluster Bgplb

resource "google_gkeonprem_bare_metal_cluster" "cluster-bgplb" {
  name = "cluster-bgplb"
  location = "us-west1"
  admin_cluster_membership = "projects/870316890899/locations/global/memberships/gkeonprem-terraform-test"
  bare_metal_version = "1.12.3"
  network_config {
    island_mode_cidr {
      service_address_cidr_blocks = ["172.26.0.0/16"]
      pod_address_cidr_blocks = ["10.240.0.0/13"]
    }
    advanced_networking = true
    multiple_network_interfaces_config {
      enabled = true
    }
    sr_iov_config {
      enabled = true
    }
  }
  control_plane {
    control_plane_node_pool_config {
      node_pool_config {
        labels = {}
        operating_system = "LINUX"
        node_configs {
          labels = {}
          node_ip = "10.200.0.9"
        }
        taints {
          key = "test-key"
          value = "test-value"
          effect = "NO_EXECUTE"
        }
      }
    }
    api_server_args {
      argument = "test-argument"
      value = "test-value"
    }
  }
  load_balancer {
    port_config {
      control_plane_load_balancer_port = 443
    }
    vip_config {
      control_plane_vip = "10.200.0.13"
      ingress_vip = "10.200.0.14"
    }
    bgp_lb_config {
      asn = 123456
      bgp_peer_configs {
        asn = 123457
        ip_address = "10.0.0.1"
        control_plane_nodes = ["test-node"]
      }
      address_pools {
        pool = "pool1"
        addresses = [
          "10.200.0.14/32",
          "10.200.0.15/32",
          "10.200.0.16/32",
          "10.200.0.17/32",
          "10.200.0.18/32",
          "fd00:1::f/128",
          "fd00:1::10/128",
          "fd00:1::11/128",
          "fd00:1::12/128"
        ]
      }
      load_balancer_node_pool_config {
        node_pool_config {
          labels = {}
          operating_system = "LINUX"
          node_configs {
            labels = {}
            node_ip = "10.200.0.9"
          }
          taints {
            key = "test-key"
            value = "test-value"
            effect = "NO_EXECUTE"
          }
          kubelet_config {
            registry_pull_qps = 10
            registry_burst = 12
            serialize_image_pulls_disabled = true
          }
        }
      }
    }
  }
  storage {
    lvp_share_config {
      lvp_config {
        path = "/mnt/localpv-share"
        storage_class = "local-shared"
      }
      shared_path_pv_count = 5
    }
    lvp_node_mounts_config {
      path = "/mnt/localpv-disk"
      storage_class = "local-disks"
    }
  }
  security_config {
    authorization {
      admin_users {
        username = "admin@hashicorptest.com"
      }
    }
  }
  proxy {
    uri = "http://test-domain/test"
    no_proxy = ["127.0.0.1"]
  }
  cluster_operations {
    enable_application_logs = true
  }
  maintenance_config {
    maintenance_address_cidr_blocks = ["192.168.0.1/20"] 
  }
  node_config {
    max_pods_per_node = 10
    container_runtime = "CONTAINERD"
  }
  node_access_config {
    login_user = "test@example.com"
  }
  os_environment_config {
    package_repo_excluded = true
  }
}

Argument Reference

The following arguments are supported:

The network_config block supports:

The island_mode_cidr block supports:

The multiple_network_interfaces_config block supports:

The sr_iov_config block supports:

The control_plane block supports:

The control_plane_node_pool_config block supports:

The node_pool_config block supports:

The node_configs block supports:

The taints block supports:

The api_server_args block supports:

The load_balancer block supports:

The vip_config block supports:

The port_config block supports:

The metal_lb_config block supports:

The address_pools block supports:

The load_balancer_node_pool_config block supports:

The node_pool_config block supports:

The node_configs block supports:

The taints block supports:

The manual_lb_config block supports:

The bgp_lb_config block supports:

The bgp_peer_configs block supports:

The address_pools block supports:

The load_balancer_node_pool_config block supports:

The node_pool_config block supports:

The node_configs block supports:

The taints block supports:

The kubelet_config block supports:

The storage block supports:

The lvp_share_config block supports:

The lvp_config block supports:

The lvp_node_mounts_config block supports:


The proxy block supports:

The cluster_operations block supports:

The maintenance_config block supports:

The node_config block supports:

The node_access_config block supports:

The os_environment_config block supports:

The security_config block supports:

The authorization block supports:

The admin_users block supports:

The binary_authorization block supports:

The upgrade_policy block supports:

Attributes Reference

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

The fleet block contains:

The status block contains:

The conditions block contains:

The validation_check block contains:

The status block contains:

The result block contains:

Timeouts

This resource provides the following Timeouts configuration options:

Import

BareMetalCluster can be imported using any of these accepted formats:

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

import {
  id = "projects/{{project}}/locations/{{location}}/bareMetalClusters/{{name}}"
  to = google_gkeonprem_bare_metal_cluster.default
}

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

$ terraform import google_gkeonprem_bare_metal_cluster.default projects/{{project}}/locations/{{location}}/bareMetalClusters/{{name}}
$ terraform import google_gkeonprem_bare_metal_cluster.default {{project}}/{{location}}/{{name}}
$ terraform import google_gkeonprem_bare_metal_cluster.default {{location}}/{{name}}

User Project Overrides

This resource supports User Project Overrides.