Skip to content
This repository has been archived by the owner on Nov 14, 2024. It is now read-only.

Commit

Permalink
Update the google_project version as per #39. Also udpate the associa…
Browse files Browse the repository at this point in the history
…ted test to explicitly cover both project_id and project_number cases.

Signed-off-by: Stuart Paterson <spaterson@chef.io>
  • Loading branch information
Stuart Paterson committed Jul 30, 2018
1 parent 43c88a0 commit b322af0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
13 changes: 11 additions & 2 deletions docs/resources/google_project.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

<br>

## 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

<br>
Expand Down
6 changes: 6 additions & 0 deletions test/integration/verify/controls/gcp_project.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit b322af0

Please sign in to comment.