Skip to content

Commit

Permalink
chore: Change in constraint for list_org_example (#50)
Browse files Browse the repository at this point in the history
* Change in constraint for list_org_example

* Update test

* Update variable name

* Update variable name

Co-authored-by: Stenal P Jolly <[email protected]>
  • Loading branch information
stenalpjolly and stenalpjolly authored Oct 28, 2021
1 parent 904a5c4 commit a4cea33
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion examples/list_org_exclude/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ Specifically, it sets a trusted image policy so only images from a trusted image

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| image\_project\_id | The ID of a project to trust images from | `string` | n/a | yes |
| organization\_id | The organization id for putting the policy | `string` | n/a | yes |
| shared\_reservation\_project\_id | The ID of a project that are allowed to create and own shared reservations in the org | `string` | n/a | yes |

## Outputs

Expand Down
6 changes: 3 additions & 3 deletions examples/list_org_exclude/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ module "org-policy" {
source = "../../"
policy_for = "organization"
organization_id = var.organization_id
constraint = "compute.trustedImageProjects"
constraint = "compute.sharedReservationsOwnerProjects"
policy_type = "list"
allow = ["projects/${var.image_project_id}"]
allow = ["projects/${var.shared_reservation_project_id}"]
allow_list_length = "1"
exclude_projects = [var.image_project_id]
exclude_projects = [var.shared_reservation_project_id]
}
4 changes: 2 additions & 2 deletions examples/list_org_exclude/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ variable "organization_id" {
type = string
}

variable "image_project_id" {
description = "The ID of a project to trust images from"
variable "shared_reservation_project_id" {
description = "The ID of a project that are allowed to create and own shared reservations in the org"
type = string
}
4 changes: 2 additions & 2 deletions test/fixtures/list_org_exclude/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@
module "list-org-exclude" {
source = "../../../examples/list_org_exclude"

organization_id = var.org_id
image_project_id = var.project_id
organization_id = var.org_id
shared_reservation_project_id = var.project_id
}
4 changes: 2 additions & 2 deletions test/integration/list_org_exclude/controls/gcloud.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@

let(:data) do
if subject.exit_status == 0
JSON.parse(subject.stdout).select{|x| x['constraint'] == 'constraints/compute.trustedImageProjects'}[0]
JSON.parse(subject.stdout).select{|x| x['constraint'] == 'constraints/compute.sharedReservationsOwnerProjects'}[0]
else
{}
end
end

describe "list exclude org policy compute.trustedImageProjects" do
describe "list exclude org policy compute.sharedReservationsOwnerProjects" do
it "should exist" do
expect(data).to_not be_empty
end
Expand Down

0 comments on commit a4cea33

Please sign in to comment.