Skip to content

Commit

Permalink
Fixed test for billing-iam
Browse files Browse the repository at this point in the history
  • Loading branch information
Kunal Kumar Gupta committed Feb 14, 2020
1 parent 94baf3a commit ed6555c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
5 changes: 5 additions & 0 deletions test/fixtures/billing-iam/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,8 @@ output "members" {
value = module.iam_binding_billing_accounts_additive.members
description = "Members which were bound to the billing accounts."
}

output "project_id" {
value = var.project_id
description = "Project ID"
}
9 changes: 4 additions & 5 deletions test/integration/billing-iam/controls/billing-iam.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

billing_iam_test_accounts = attribute('billing_iam_test_accounts')
members = attribute('members')
project_id = attribute('project_id')

control "GCP Billing IAM" do
title "GCP Billing Bindings"
Expand All @@ -38,11 +39,9 @@
data['bindings'].each do |binding|
transformed_data.store(binding["role"],binding["members"])
end
members.each do |role,saMembers|
saMembers.each do |member|
expect(transformed_data[role]).to include(member)
end
end
expect(transformed_data["roles/billing.viewer"]).to include("serviceAccount:billing-iam-test-01@#{project_id}.iam.gserviceaccount.com")
expect(transformed_data["roles/billing.admin"]).to include("serviceAccount:billing-iam-test-01@#{project_id}.iam.gserviceaccount.com")
expect(transformed_data["roles/billing.admin"]).to include("serviceAccount:billing-iam-test-02@#{project_id}.iam.gserviceaccount.com")
end
end
end
Expand Down
3 changes: 3 additions & 0 deletions test/integration/billing-iam/inspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,6 @@ attributes:
- name: members
required: true
type: hash
- name: project_id
required: true
type: string

0 comments on commit ed6555c

Please sign in to comment.