On this page
google_container_clusters resource
Syntax
A google_container_clusters is used to test a Google Cluster resource.
Beta Resource
This resource has beta fields available. To retrieve these fields, include beta: true in the constructor for the resource.
Examples
describe google_container_clusters(project: 'chef-gcp-inspec', location: 'europe-west2-a') do
its('cluster_names') { should include 'gcp-inspec-kube-cluster' }
end
Test that there are no more than a specified number of clusters available for the project in a particular zone
describe google_container_clusters(project: 'chef-inspec-gcp', location: 'europe-west2-a') do
its('count') { should be <= 5}
end
Test that an expected cluster is available for the project
describe google_container_clusters(project: 'chef-inspec-gcp', location: 'europe-west2-a') do
its('cluster_names') { should include "my-cluster" }
end
Test whether any clusters are in status “STOPPING”
describe google_container_clusters(project: 'chef-inspec-gcp', location: 'europe-west2-a') do
its('cluster_statuses') { should_not include "STOPPING" }
end
Test that a subset of all clusters matching “kube*” are “RUNNING”
google_container_clusters(project: gcp_project_id).where(cluster_name: /^kube/).cluster_names.each do |cluster_name|
describe google_container_cluster(project: 'chef-inspec-gcp', location: 'europe-west2-a', name: cluster_name) do
it { should exist }
its('status') { should eq 'RUNNING' }
end
end
Properties
Properties that can be accessed from the google_container_clusters resource:
See the google_container_cluster resource for more information.
-
cluster_names -
an array of
google_container_clustername -
descriptions -
an array of
google_container_clusterdescription -
initial_node_counts -
an array of
google_container_clusterinitial_node_count -
node_configs -
an array of
google_container_clusternode_config -
master_auths -
an array of
google_container_clustermaster_auth -
logging_services -
an array of
google_container_clusterlogging_service -
monitoring_services -
an array of
google_container_clustermonitoring_service -
cluster_networks -
an array of
google_container_clusternetwork -
private_cluster_configs -
an array of
google_container_clusterprivate_cluster_config -
cluster_ipv4_cidrs -
an array of
google_container_clustercluster_ipv4_cidr -
enable_tpus -
an array of
google_container_clusterenable_tpu -
tpu_ipv4_cidr_blocks -
an array of
google_container_clustertpu_ipv4_cidr_block -
addons_configs -
an array of
google_container_clusteraddons_config -
subnetworks -
an array of
google_container_clustersubnetwork -
locations -
an array of
google_container_clusterlocations -
resource_labels -
an array of
google_container_clusterresource_labels -
label_fingerprints -
an array of
google_container_clusterlabel_fingerprint -
legacy_abacs -
an array of
google_container_clusterlegacy_abac -
network_policies -
an array of
google_container_clusternetwork_policy -
default_max_pods_constraints -
an array of
google_container_clusterdefault_max_pods_constraint -
ip_allocation_policies -
an array of
google_container_clusterip_allocation_policy -
endpoints -
an array of
google_container_clusterendpoint -
initial_cluster_versions -
an array of
google_container_clusterinitial_cluster_version -
current_master_versions -
an array of
google_container_clustercurrent_master_version -
current_node_versions -
an array of
google_container_clustercurrent_node_version -
create_times -
an array of
google_container_clustercreate_time -
cluster_statuses -
an array of
google_container_clusterstatus -
status_messages -
an array of
google_container_clusterstatus_message -
node_ipv4_cidr_sizes -
an array of
google_container_clusternode_ipv4_cidr_size -
services_ipv4_cidrs -
an array of
google_container_clusterservices_ipv4_cidr -
current_node_counts -
an array of
google_container_clustercurrent_node_count -
expire_times -
an array of
google_container_clusterexpire_time -
conditions -
an array of
google_container_clusterconditions -
master_authorized_networks_configs -
an array of
google_container_clustermaster_authorized_networks_config -
node_pools -
an array of
google_container_clusternode_pools -
pod_security_policy_configs -
(Beta only) an array of
google_container_clusterpod_security_policy_config -
binary_authorizations -
an array of
google_container_clusterbinary_authorization -
locations -
an array of
google_container_clusterlocation
Filter Criteria
This resource supports all of the above properties as filter criteria, which can be used with where as a block or a method.
GCP Permissions
Ensure the Kubernetes Engine API is enabled for the current project.
© Chef Software, Inc.
Licensed under the Creative Commons Attribution 3.0 Unported License.
The Chef™ Mark and Chef Logo are either registered trademarks/service marks or trademarks/servicemarks of Chef, in the United States and other countries and are used with Chef Inc's permission.
We are not affiliated with, endorsed or sponsored by Chef Inc.
https://docs.chef.io/inspec/resources/google_container_clusters/