File tree Expand file tree Collapse file tree 9 files changed +104
-33
lines changed
multiple_service_accounts
fixtures/multiple_service_accounts
multiple_service_accounts
single_service_account/controls Expand file tree Collapse file tree 9 files changed +104
-33
lines changed Original file line number Diff line number Diff line change 1- # Simple Example
1+ # Multiple Service Accounts
22
3- This example illustrates how to use the ` service-accounts ` module.
3+ This example illustrates how to use the ` service-accounts ` module to generate multiple service accounts .
44
55[ ^ ] : (autogen_docs_start)
66
Original file line number Diff line number Diff line change 1- # Simple Example
1+ # Single Service Account
22
3- This example illustrates how to use the ` service-accounts ` module.
3+ This example illustrates how to use the ` service-accounts ` module to generate a single service account .
44
55[ ^ ] : (autogen_docs_start)
66
Original file line number Diff line number Diff line change @@ -36,3 +36,13 @@ suites:
3636 backend : gcp
3737 controls :
3838 - gcp
39+ - name : multiple_service_accounts
40+ driver :
41+ root_module_directory : test/fixtures/multiple_service_accounts/
42+ verifier :
43+ color : false
44+ systems :
45+ - name : multiple_service_accounts gcp
46+ backend : gcp
47+ controls :
48+ - gcp
Original file line number Diff line number Diff line change 1+ /* *
2+ * Copyright 2018 Google LLC
3+ *
4+ * Licensed under the Apache License, Version 2.0 (the "License");
5+ * you may not use this file except in compliance with the License.
6+ * You may obtain a copy of the License at
7+ *
8+ * http://www.apache.org/licenses/LICENSE-2.0
9+ *
10+ * Unless required by applicable law or agreed to in writing, software
11+ * distributed under the License is distributed on an "AS IS" BASIS,
12+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+ * See the License for the specific language governing permissions and
14+ * limitations under the License.
15+ */
16+
17+ module "example" {
18+ source = " ../../../examples/multiple_service_accounts"
19+ project_id = " ${ var . project_id } "
20+ }
Original file line number Diff line number Diff line change 1+ /* *
2+ * Copyright 2018 Google LLC
3+ *
4+ * Licensed under the Apache License, Version 2.0 (the "License");
5+ * you may not use this file except in compliance with the License.
6+ * You may obtain a copy of the License at
7+ *
8+ * http://www.apache.org/licenses/LICENSE-2.0
9+ *
10+ * Unless required by applicable law or agreed to in writing, software
11+ * distributed under the License is distributed on an "AS IS" BASIS,
12+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+ * See the License for the specific language governing permissions and
14+ * limitations under the License.
15+ */
16+
17+ output "emails" {
18+ description = " The service account emails."
19+ value = " ${ module . example . emails } "
20+ }
21+
22+ output "project_id" {
23+ description = " Project id variable."
24+ value = " ${ var . project_id } "
25+ }
Original file line number Diff line number Diff line change 1+ /* *
2+ * Copyright 2018 Google LLC
3+ *
4+ * Licensed under the Apache License, Version 2.0 (the "License");
5+ * you may not use this file except in compliance with the License.
6+ * You may obtain a copy of the License at
7+ *
8+ * http://www.apache.org/licenses/LICENSE-2.0
9+ *
10+ * Unless required by applicable law or agreed to in writing, software
11+ * distributed under the License is distributed on an "AS IS" BASIS,
12+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+ * See the License for the specific language governing permissions and
14+ * limitations under the License.
15+ */
16+
17+ variable "project_id" {
18+ description = " The ID of the project in which to provision resources."
19+ type = " string"
20+ }
Original file line number Diff line number Diff line change 1212# See the License for the specific language governing permissions and
1313# limitations under the License.
1414
15- control "gsutil " do
16- title "gsutil "
15+ control "gcp " do
16+ title "GCP Resources "
1717
18- describe command ( "gsutil ls -p #{ attribute ( "project_id" ) } " ) do
19- its ( :exit_status ) { should eq 0 }
20- its ( :stderr ) { should eq "" }
21- its ( :stdout ) { should match "gs://#{ attribute ( "bucket_name" ) } " }
18+ attribute ( 'emails' ) . each do |email |
19+ describe google_service_accounts ( project : 'ludo-tf-playground' ) do
20+ its ( 'service_account_emails' ) { should include email }
21+ end
22+ describe google_project_iam_binding ( project : "#{ attribute ( "project_id" ) } " , role : 'roles/viewer' ) do
23+ its ( 'members' ) { should include "serviceAccount:#{ email } " }
24+ end
25+ describe google_project_iam_binding ( project : "#{ attribute ( "project_id" ) } " , role : 'roles/storage.objectViewer' ) do
26+ its ( 'members' ) { should include "serviceAccount:#{ email } " }
27+ end
2228 end
29+
2330end
Original file line number Diff line number Diff line change 1+ name : multiple_service_accounts
2+ depends :
3+ - name : inspec-gcp
4+ git : https://github.com/inspec/inspec-gcp.git
5+ tag : v0.10.0
6+ attributes :
7+ - name : project_id
8+ required : true
9+ type : string
10+ - name : emails
11+ required : true
12+ type : array
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments