-
Notifications
You must be signed in to change notification settings - Fork 493
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
solves issue #382, and improved policy to relate disk with the instance
- Loading branch information
1 parent
1fd99c3
commit 8fbe227
Showing
3 changed files
with
37 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 29 additions & 3 deletions
32
pkg/policies/opa/rego/gcp/google_compute_instance/encryptedwithCsek.rego
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,33 @@ | ||
package accurics | ||
|
||
encryptedwithCsek[api.id] | ||
encryptedwithCsek[retVal] | ||
{ | ||
api := input.google_compute_disk[_] | ||
not api.config.disk_encryption_key == null | ||
api := input.google_compute_disk[_] | ||
not api.config.disk_encryption_key | ||
|
||
association := input.google_compute_attached_disk[_] | ||
diskName := split(association.config.disk, ".")[1] | ||
|
||
api.name == diskName | ||
instanceName := split(association.config.instance, ".")[1] | ||
|
||
instance := input.google_compute_instance[_] | ||
instanceName == instance.name | ||
retVal := instance.id | ||
} | ||
|
||
encryptedwithCsek[retVal] | ||
{ | ||
api := input.google_compute_disk[_] | ||
api.config.disk_encryption_key == null | ||
|
||
association := input.google_compute_attached_disk[_] | ||
diskName := split(association.config.disk, ".")[1] | ||
|
||
api.name == diskName | ||
instanceName := split(association.config.instance, ".")[1] | ||
|
||
instance := input.google_compute_instance[_] | ||
instanceName == instance.name | ||
retVal := instance.id | ||
} |