diff --git a/docs/resources/google_project.md b/docs/resources/google_project.md index e9a384019..250a4c6c2 100644 --- a/docs/resources/google_project.md +++ b/docs/resources/google_project.md @@ -5,17 +5,26 @@ platform: gcp # google\_project -Use the `google_project` InSpec audit resource to test properties of a GCP project. +Use the `google_project` InSpec audit resource to test properties of a GCP project.
## Syntax -A `google_project` resource block declares the tests for a single GCP project by name. +Google projects have a name, ID and number as described [here](https://cloud.google.com/resource-manager/docs/creating-managing-projects#identifying_projects). + +A `google_project` resource block declares the tests for a single GCP project identified by `project_id` or `project_number`: describe google_project(project: 'chef-inspec-gcp') do it { should exist } its('name') { should eq 'chef-inspec-gcp' } + its('project_number') { should eq 12345678 } + end + + describe google_project(project: 12345678) do + it { should exist } + its('name') { should eq 'chef-inspec-gcp' } + its('project_number') { should eq 12345678 } end
diff --git a/test/integration/verify/controls/gcp_project.rb b/test/integration/verify/controls/gcp_project.rb index c59716429..d76a97d3c 100644 --- a/test/integration/verify/controls/gcp_project.rb +++ b/test/integration/verify/controls/gcp_project.rb @@ -16,4 +16,10 @@ its('lifecycle_state') { should eq "ACTIVE" } end + describe google_project(project: gcp_project_number.to_i) do + it { should exist } + its('name') { should eq gcp_project_name } + its('project_number') { should eq gcp_project_number.to_i } + its('lifecycle_state') { should eq "ACTIVE" } + end end