google_container_attached_cluster

An Anthos cluster running on customer owned infrastructure.

To get more information about Cluster, see:

Open in Cloud Shell

Example Usage - Container Attached Cluster Basic

data "google_project" "project" {
}

data "google_container_attached_versions" "versions" {
    location       = "us-west1"
    project        = data.google_project.project.project_id
}

resource "google_container_attached_cluster" "primary" {
  name     = "basic"
  location = "us-west1"
  project = data.google_project.project.project_id
  description = "Test cluster"
  distribution = "aks"
  oidc_config {
      issuer_url = "https://oidc.issuer.url"
  }
  platform_version = data.google_container_attached_versions.versions.valid_versions[0]
  fleet {
    project = "projects/${data.google_project.project.number}"
  }
}
Open in Cloud Shell

Example Usage - Container Attached Cluster Full

data "google_project" "project" {
}

data "google_container_attached_versions" "versions" {
    location       = "us-west1"
    project        = data.google_project.project.project_id
}

resource "google_container_attached_cluster" "primary" {
  name     = "basic"
  project = data.google_project.project.project_id
  location = "us-west1"
  description = "Test cluster"
  distribution = "aks"
  annotations = {
    label-one = "value-one"
  }
  authorization {
    admin_users = [ "user1@example.com", "user2@example.com"]
    admin_groups = [ "group1@example.com", "group2@example.com"]
  }
  oidc_config {
      issuer_url = "https://oidc.issuer.url"
      jwks = base64encode("{\"keys\":[{\"use\":\"sig\",\"kty\":\"RSA\",\"kid\":\"testid\",\"alg\":\"RS256\",\"n\":\"somedata\",\"e\":\"AQAB\"}]}")
  }
  platform_version = data.google_container_attached_versions.versions.valid_versions[0]
  fleet {
    project = "projects/${data.google_project.project.number}"
  }
  logging_config {
    component_config {
      enable_components = ["SYSTEM_COMPONENTS", "WORKLOADS"]
    }
  }
  monitoring_config {
    managed_prometheus_config {
      enabled = true
    }
  }
  binary_authorization {
    evaluation_mode = "PROJECT_SINGLETON_POLICY_ENFORCE"
  }
  proxy_config {
    kubernetes_secret {
      name = "proxy-config"
      namespace = "default"
    }
  }
}
Open in Cloud Shell

Example Usage - Container Attached Cluster Ignore Errors

data "google_project" "project" {
}

data "google_container_attached_versions" "versions" {
    location       = "us-west1"
    project        = data.google_project.project.project_id
}

resource "google_container_attached_cluster" "primary" {
  name     = "basic"
  location = "us-west1"
  project = data.google_project.project.project_id
  description = "Test cluster"
  distribution = "aks"
  oidc_config {
      issuer_url = "https://oidc.issuer.url"
  }
  platform_version = data.google_container_attached_versions.versions.valid_versions[0]
  fleet {
    project = "projects/${data.google_project.project.number}"
  }

  deletion_policy = "DELETE_IGNORE_ERRORS"
}

Argument Reference

The following arguments are supported:

The oidc_config block supports:

The fleet block supports:


The logging_config block supports:

The component_config block supports:

The authorization block supports:

The monitoring_config block supports:

The managed_prometheus_config block supports:

The binary_authorization block supports:

The proxy_config block supports:

The kubernetes_secret block supports:

Attributes Reference

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

The workload_identity_config block contains:

The errors block contains:

Timeouts

This resource provides the following Timeouts configuration options:

Import

Cluster can be imported using any of these accepted formats:

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

import {
  id = "projects/{{project}}/locations/{{location}}/attachedClusters/{{name}}"
  to = google_container_attached_cluster.default
}

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

$ terraform import google_container_attached_cluster.default projects/{{project}}/locations/{{location}}/attachedClusters/{{name}}
$ terraform import google_container_attached_cluster.default {{project}}/{{location}}/{{name}}
$ terraform import google_container_attached_cluster.default {{location}}/{{name}}

User Project Overrides

This resource supports User Project Overrides.