GoogleCloudPlatform / GoogleCloudPlatform/config-validator
Allow support for referential constraints
- Dominant language
- Go
- Stars
- 48
- Forks
- 37
- PR merge metrics
- No merged PRs in 30d
Description
## Summary
I have a customer for whom referential constraints would drive outsize business value, enabling them to adopt Forseti Config Validator and Terraform Validator to implement detective and protective controls to safeguard their GCP organization.
## Use Case
The specific use case identified is:
- Ensuring that all Disks created within a GCP organization have an attached Resource Policy (snapshot schedule) with a particularly configured snapshot period and retention cycle. e.g.: "I want to ensure that all Disks in GCP are snapshotted daily with 30 day retention"
At present, we can pull sufficient information from CAI to determine that there is *some* ResourcePolicy attached to a Disk:
```
{
"asset_type": "compute.googleapis.com/Disk",
...
"resource": {
"version": "v1",
"discovery_document_uri": "https://www.googleapis.com/discovery/v1/apis/compute/v1/rest",
"discovery_name": "Disk",
...
"data": {
...
"resourcePolicies": [
"https://www.googleapis.com/compute/v1/projects/.../regions/us-east4/resourcePolicies/snapshot-disks"
],
...
},
"location": "us-east4-a"
},
...
}
```
And subsequently pulling the `ResourcePolicy` CAI data yields information about the snapshot schedule:
```
{
"asset_type": "compute.googleapis.com/ResourcePolicy",
...
"resource": {
"version": "v1",
"discovery_document_uri": "https://www.googleapis.com/discovery/v1/apis/compute/v1/rest",
"discovery_name": "ResourcePolicy",
...
"data": {
...
"snapshotSchedulePolicy": {
"retentionPolicy": {
"maxRetentionDays": 7,
"onSourceDiskDelete": "KEEP_AUTO_SNAPSHOTS"
},
"schedule": {
"dailySchedule": {
"daysInCycle": 1,
"duration": "PT14400S",
"startTime": "00:00"
}
}
},
"status": "READY"
},
"location": "us-east4"
},
...
}
```
The ability to build policies that consider both of these CAI asset data objects at once would be valuable, and extensible to other security control implementations.
Contributor guide
Assessment
This issue has not been assessed yet.