title | platform |
---|---|
About the google_container_cluster Resource |
gcp |
Use the google_container_cluster
InSpec audit resource to test properties of a single GCP container cluster.
A google_container_cluster
resource block declares the tests for a single GCP container cluster by project, zone and name.
describe google_container_cluster(project: 'chef-inspec-gcp', zone: 'europe-west2-a', name: 'inspec-gcp-kube-cluster') do
it { should exist }
its('name') { should eq 'inspec-gcp-kube-cluster' }
its('zone') { should match 'europe-west2-a' }
end
The following examples show how to use this InSpec audit resource.
describe google_container_cluster(project: 'chef-inspec-gcp', zone: 'europe-west2-a', name: 'inspec-gcp-kube-cluster') do
its('status') { should eq 'RUNNING' }
end
describe google_container_cluster(project: 'chef-inspec-gcp', zone: 'europe-west2-a', name: 'inspec-gcp-kube-cluster') do
its('master_auth.username'){ should eq "user_name"}
its('master_auth.password'){ should eq "choose_something_strong"}
end
describe google_container_cluster(project: 'chef-inspec-gcp', zone: 'europe-west2-a', name: 'inspec-gcp-kube-cluster') do
its('locations.sort'){should cmp ["europe-west2-a", "europe-west2-b", "europe-west2-c"].sort}
end
describe google_container_cluster(project: 'chef-inspec-gcp', zone: 'europe-west2-a', name: 'inspec-gcp-kube-cluster') do
its('network'){should eq "default"}
its('subnetwork'){should eq "default"}
end
describe google_container_cluster(project: 'chef-inspec-gcp', zone: 'europe-west2-a', name: 'inspec-gcp-kube-cluster') do
its('node_config.disk_size_gb'){should eq 100}
its('node_config.image_type'){should eq "COS"}
its('node_config.machine_type'){should eq "n1-standard-1"}
its('node_ipv4_cidr_size'){should eq 24}
its('node_pools.count'){should eq 1}
end
addons_config
,cluster_ipv4_cidr
,create_time
,current_master_version
,current_node_count
,current_node_version
,endpoint
,initial_cluster_version
,initial_node_count
,instance_group_urls
,label_fingerprint
,legacy_abac
,locations
,logging_service
,master_auth
,monitoring_service
,name
,network
,node_config
,node_ipv4_cidr_size
,node_pools
,services_ipv4_cidr
,status
,subnetwork
,zone
Ensure the Kubernetes Engine API is enabled for the project where the resource is located.