Skip to content

Commit d1af0d0

Browse files
authored
tgc-revival: add google_scc_v2_organization_notification_config (GoogleCloudPlatform#17324)
1 parent 1b462a3 commit d1af0d0

6 files changed

Lines changed: 13 additions & 6 deletions

mmv1/products/securitycenterv2/OrganizationNotificationConfig.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ timeouts:
3434
insert_minutes: 20
3535
update_minutes: 20
3636
delete_minutes: 20
37+
include_in_tgc_next: true
38+
cai_asset_name_format: 'organizations/{{organization}}/locations/{{location}}/notificationConfigs/{{config_id}}'
3739
custom_code:
3840
custom_import: 'templates/terraform/custom_import/scc_v2_source_self_link_as_name_set_organization.go.tmpl'
3941
examples:

mmv1/third_party/terraform/services/securitycenterv2/resource_scc_v2_folder_big_query_export_config_test.go renamed to mmv1/third_party/terraform/services/securitycenterv2/resource_scc_v2_folder_scc_big_query_export_test.go

File renamed without changes.

mmv1/third_party/terraform/services/securitycenterv2/resource_scc_v2_organization_big_query_export_config_test.go renamed to mmv1/third_party/terraform/services/securitycenterv2/resource_scc_v2_organization_scc_big_query_export_test.go

File renamed without changes.

mmv1/third_party/terraform/services/securitycenterv2/resource_scc_v2_organization_big_query_exports_config_test.go renamed to mmv1/third_party/terraform/services/securitycenterv2/resource_scc_v2_organization_scc_big_query_exports_test.go

File renamed without changes.

mmv1/third_party/terraform/services/securitycenterv2/resource_scc_v2_project_big_query_export_config_test.go renamed to mmv1/third_party/terraform/services/securitycenterv2/resource_scc_v2_project_scc_big_query_export_test.go

File renamed without changes.

mmv1/third_party/tgc_next/test/assert_test_files.go

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ func testSingleResource(t *testing.T, testName string, testData ResourceTestData
291291
// Gets the ancestry cache for tfplan2cai conversion and the default project
292292
func getAncestryCache(assets []caiasset.Asset) (map[string]string, string) {
293293
ancestryCache := make(map[string]string, 0)
294-
defaultProject := ""
294+
resolvedProject := ""
295295

296296
for _, asset := range assets {
297297
ancestors := asset.Ancestors
@@ -308,9 +308,9 @@ func getAncestryCache(assets []caiasset.Asset) (map[string]string, string) {
308308

309309
if _, ok := ancestryCache[ancestors[0]]; !ok {
310310
ancestryCache[ancestors[0]] = path
311-
if defaultProject == "" {
311+
if resolvedProject == "" {
312312
if s, hasPrefix := strings.CutPrefix(ancestors[0], "projects/"); hasPrefix {
313-
defaultProject = s
313+
resolvedProject = s
314314
}
315315
}
316316
}
@@ -324,13 +324,18 @@ func getAncestryCache(assets []caiasset.Asset) (map[string]string, string) {
324324
}
325325
}
326326

327-
if defaultProject == "" {
328-
defaultProject = project
327+
if resolvedProject == "" {
328+
resolvedProject = project
329329
}
330330
}
331331
}
332332
}
333-
return ancestryCache, defaultProject
333+
if resolvedProject == "" {
334+
resolvedProject = defaultProject
335+
}
336+
ancestryCache["projects/"+defaultProject] = "organizations/" + defaultOrganization
337+
338+
return ancestryCache, resolvedProject
334339
}
335340

336341
// Compares HCL and finds all of the keys in map1 that are not in map2

0 commit comments

Comments
 (0)