Skip to content

Commit 80d1fc6

Browse files
authored
Update data_loss_prevention_discovery_config to include field support for OtherCloudDiscoveryTarget (#12114)
1 parent e826043 commit 80d1fc6

File tree

3 files changed

+583
-8
lines changed

3 files changed

+583
-8
lines changed

.ci/infra/terraform/main.tf

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,18 @@ resource "google_organization_iam_member" "sa_principal_access_boundary_admin" {
171171
member = google_service_account.sa.member
172172
}
173173

174+
resource "google_organization_iam_member" "dlp_admin" {
175+
org_id = data.google_organization.org.org_id
176+
role = "roles/dlp.admin"
177+
member = google_project_service_identity.dlp_sa.member
178+
}
179+
180+
resource "google_organization_iam_member" "dlp_org_driver" {
181+
org_id = data.google_organization.org.org_id
182+
role = "roles/dlp.orgdriver"
183+
member = google_project_service_identity.dlp_sa.member
184+
}
185+
174186
resource "google_billing_account_iam_member" "sa_master_billing_admin" {
175187
billing_account_id = data.google_billing_account.master_acct.id
176188
role = "roles/billing.admin"
@@ -420,6 +432,14 @@ resource "google_project_service_identity" "parametermanager_sa" {
420432
service = "parametermanager.googleapis.com"
421433
}
422434

435+
resource "google_project_service_identity" "dlp_sa" {
436+
provider = google-beta
437+
depends_on = [module.project-services]
438+
439+
project = google_project.proj.project_id
440+
service = "dlp.googleapis.com"
441+
}
442+
423443
# TestAccComposerEnvironment_fixPyPiPackages
424444
# TestAccComposerEnvironmentComposer2_private
425445
# TestAccComposerEnvironment_withEncryptionConfigComposer1

mmv1/products/dlp/DiscoveryConfig.yaml

Lines changed: 165 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,25 @@ properties:
126126
- name: 'folderId'
127127
type: String
128128
description: The ID for the folder within an organization to scan
129+
- name: 'otherCloudStartingLocation'
130+
type: NestedObject
131+
properties:
132+
- name: 'awsLocation'
133+
type: NestedObject
134+
properties:
135+
- name: 'accountId'
136+
type: String
137+
conflicts:
138+
- other_cloud_starting_location.aws_location.all_assets_inventory_assets
139+
description: 'The AWS account ID that this discovery config applies to.
140+
Within an organization, you can find the AWS account ID inside an AWS account ARN.
141+
Example:
142+
arn:<partition>:organizations::<management-account-id>:account/<organization-id>/<account-id>'
143+
- name: 'allAssetInventoryAssets'
144+
type: Boolean
145+
conflicts:
146+
- other_cloud_starting_location.aws_location.account_id
147+
description: All AWS assets stored in Asset Inventory that didn't match other AWS discovery configs.
129148
- name: 'inspectTemplates'
130149
type: Array
131150
description: Detection logic for profile generation
@@ -291,11 +310,11 @@ properties:
291310
- name: 'otherTables'
292311
type: NestedObject
293312
description: Catch-all. This should always be the last filter in the list because anything above it will apply first.
294-
# The fields below are necessary to include the "otherTables" filter in the payload
313+
# The fields below are necessary to include the "otherTables" filter in the payload
295314
send_empty_value: true
296315
allow_empty_object: true
297316
properties:
298-
# Meant to be an empty object with no properties - see here : https://cloud.google.com/sensitive-data-protection/docs/reference/rest/v2/organizations.locations.discoveryConfigs#allotherbigquerytables
317+
# Meant to be an empty object with no properties - see here : https://cloud.google.com/sensitive-data-protection/docs/reference/rest/v2/organizations.locations.discoveryConfigs#allotherbigquerytables
299318
[]
300319
- name: 'tableReference'
301320
type: NestedObject
@@ -408,11 +427,11 @@ properties:
408427
- name: 'disabled'
409428
type: NestedObject
410429
description: 'Tables that match this filter will not have profiles created.'
411-
# The fields below are necessary to include the "disabled" filter in the payload
430+
# The fields below are necessary to include the "disabled" filter in the payload
412431
send_empty_value: true
413432
allow_empty_object: true
414433
properties:
415-
# Meant to be an empty object with no properties - see here : https://cloud.google.com/sensitive-data-protection/docs/reference/rest/v2/organizations.locations.discoveryConfigs#disabled
434+
# Meant to be an empty object with no properties - see here : https://cloud.google.com/sensitive-data-protection/docs/reference/rest/v2/organizations.locations.discoveryConfigs#disabled
416435
[]
417436
- name: 'cloudSqlTarget'
418437
type: NestedObject
@@ -455,7 +474,7 @@ properties:
455474
send_empty_value: true
456475
allow_empty_object: true
457476
properties:
458-
# Meant to be an empty object with no properties. The fields below are necessary to include the "others" filter in the payload
477+
# Meant to be an empty object with no properties. The fields below are necessary to include the "others" filter in the payload
459478
[]
460479
- name: 'databaseResourceReference'
461480
type: NestedObject
@@ -559,11 +578,11 @@ properties:
559578
- name: 'secretsTarget'
560579
type: NestedObject
561580
description: Discovery target that looks for credentials and secrets stored in cloud resource metadata and reports them as vulnerabilities to Security Command Center. Only one target of this type is allowed.
562-
# The fields below are necessary to include the "secretsDiscoveryTarget" target in the payload
581+
# The fields below are necessary to include the "secretsDiscoveryTarget" target in the payload
563582
send_empty_value: true
564583
allow_empty_object: true
565584
properties:
566-
# Meant to be an empty object with no properties - see here : https://cloud.google.com/sensitive-data-protection/docs/reference/rest/v2/organizations.locations.discoveryConfigs#DiscoveryConfig.SecretsDiscoveryTarget
585+
# Meant to be an empty object with no properties - see here : https://cloud.google.com/sensitive-data-protection/docs/reference/rest/v2/organizations.locations.discoveryConfigs#DiscoveryConfig.SecretsDiscoveryTarget
567586
[]
568587
- name: 'cloudStorageTarget'
569588
type: NestedObject
@@ -614,7 +633,7 @@ properties:
614633
send_empty_value: true
615634
allow_empty_object: true
616635
properties:
617-
# Meant to be an empty object with no properties. The fields below are necessary to include the "others" filter in the payload
636+
# Meant to be an empty object with no properties. The fields below are necessary to include the "others" filter in the payload
618637
[]
619638
- name: 'conditions'
620639
type: NestedObject
@@ -688,6 +707,144 @@ properties:
688707
allow_empty_object: true
689708
properties:
690709
[]
710+
- name: 'otherCloudTarget'
711+
type: NestedObject
712+
description: Other clouds target for discovery. The first target to match a resource will be the one applied.
713+
properties:
714+
- name: 'dataSourceType'
715+
type: NestedObject
716+
description: 'Required. The type of data profiles generated by this discovery target. Supported values are: aws/s3/bucket'
717+
properties:
718+
- name: 'dataSource'
719+
type: String
720+
- name: 'filter'
721+
type: NestedObject
722+
description: 'Required. The resources that the discovery cadence applies to. The
723+
first target with a matching filter will be the one to apply to a resource.'
724+
required: true
725+
properties:
726+
- name: 'collection'
727+
type: NestedObject
728+
description: A collection of resources for this filter to apply to.
729+
properties:
730+
- name: 'includeRegexes'
731+
type: NestedObject
732+
description: A collection of regular expressions to match a resource against.
733+
properties:
734+
- name: 'patterns'
735+
type: Array
736+
description: The group of regular expression patterns to match against one or more resources. Maximum of 100 entries. The sum of all lengths of regular expressions can't exceed 10 KiB.
737+
item_type:
738+
type: NestedObject
739+
properties:
740+
- name: 'amazonS3BucketRegex'
741+
type: NestedObject
742+
description: Regex for Cloud Storage.
743+
properties:
744+
- name: 'awsAccountRegex'
745+
type: NestedObject
746+
description: 'The AWS account regex'
747+
properties:
748+
- name: 'accountIdRegex'
749+
type: String
750+
description: 'Regex to test the AWS account ID against.
751+
If empty, all accounts match.
752+
Example: arn:aws:organizations::123:account/o-b2c3d4/345'
753+
- name: 'bucketNameRegex'
754+
type: String
755+
description: 'Regex to test the bucket name against. If empty, all buckets match.'
756+
- name: 'singleResource'
757+
type: NestedObject
758+
description: The resource to scan. Configs using this filter can only have one target (the target with this single resource reference).
759+
properties:
760+
- name: 'amazonS3Bucket'
761+
type: NestedObject
762+
description: Amazon S3 bucket.
763+
properties:
764+
- name: 'awsAccount'
765+
type: NestedObject
766+
description: The AWS account.
767+
properties:
768+
- name: 'accountId'
769+
type: String
770+
description: AWS account ID.
771+
- name: 'bucketName'
772+
type: String
773+
description: The bucket name.
774+
- name: 'others'
775+
type: NestedObject
776+
description: Match discovery resources not covered by any other filter.
777+
send_empty_value: true
778+
allow_empty_object: true
779+
properties:
780+
# Meant to be an empty object with no properties. The fields below are necessary to include the "others" filter in the payload
781+
[]
782+
- name: 'conditions'
783+
type: NestedObject
784+
description: In addition to matching the filter, these conditions must be true before a profile is generated.
785+
properties:
786+
- name: 'minAge'
787+
type: String
788+
description: Duration format. Minimum age a resource must be before a profile can be generated. Value must be 1 hour or greater. Minimum age is not supported for Azure Blob Storage containers.
789+
- name: 'amazonS3BucketConditions'
790+
type: NestedObject
791+
description: Amazon S3 bucket conditions.
792+
properties:
793+
- name: 'bucketTypes'
794+
type: Array
795+
description: Bucket types that should be profiled. Optional. Defaults to TYPE_ALL_SUPPORTED if unspecified.
796+
item_type:
797+
type: Enum
798+
description: |
799+
This field only has a name and description because of MM
800+
limitations. It should not appear in downstreams.
801+
enum_values:
802+
- 'TYPE_ALL_SUPPORTED'
803+
- 'TYPE_GENERAL_PURPOSE'
804+
- name: 'objectStorageClasses'
805+
type: Array
806+
description: Object classes that should be profiled. Optional. Defaults to ALL_SUPPORTED_CLASSES if unspecified.
807+
item_type:
808+
type: Enum
809+
description: |
810+
This field only has a name and description because of MM
811+
limitations. It should not appear in downstreams.
812+
enum_values:
813+
- 'ALL_SUPPORTED_CLASSES'
814+
- 'STANDARD'
815+
- 'STANDARD_INFREQUENT_ACCESS'
816+
- 'GLACIER_INSTANT_RETRIEVAL'
817+
- 'INTELLIGENT_TIERING'
818+
- name: 'generationCadence'
819+
type: NestedObject
820+
description: How often and when to update profiles. New resources that match both the filter and conditions are scanned as quickly as possible depending on system capacity.
821+
properties:
822+
- name: 'refreshFrequency'
823+
type: Enum
824+
description: Frequency to update profiles regardless of whether the underlying resource has changes. Defaults to never.
825+
enum_values:
826+
- 'UPDATE_FREQUENCY_NEVER'
827+
- 'UPDATE_FREQUENCY_DAILY'
828+
- 'UPDATE_FREQUENCY_MONTHLY'
829+
- name: 'inspectTemplateModifiedCadence'
830+
type: NestedObject
831+
description: Governs when to update data profiles when the inspection rules defined by the `InspectTemplate` change. If not set, changing the template will not cause a data profile to update.
832+
properties:
833+
- name: 'frequency'
834+
type: Enum
835+
description: How frequently data profiles can be updated when the template is modified. Defaults to never.
836+
enum_values:
837+
- 'UPDATE_FREQUENCY_NEVER'
838+
- 'UPDATE_FREQUENCY_DAILY'
839+
- 'UPDATE_FREQUENCY_MONTHLY'
840+
- name: 'disabled'
841+
type: NestedObject
842+
description: Disable profiling for resources that match this filter.
843+
send_empty_value: true
844+
allow_empty_object: true
845+
properties:
846+
[]
847+
691848
- name: 'errors'
692849
type: Array
693850
description: Output only. A stream of errors encountered when the config was activated. Repeated errors may result in the config automatically being paused. Output only field. Will return the last 100 errors. Whenever the config is modified this list will be cleared.

0 commit comments

Comments
 (0)