diff --git a/go.mod b/go.mod index f7cac7fb8..6652779c7 100644 --- a/go.mod +++ b/go.mod @@ -11,7 +11,7 @@ require ( github.com/hashicorp/hcl/v2 v2.20.1 github.com/hashicorp/terraform-json v0.22.1 github.com/hashicorp/terraform-plugin-sdk/v2 v2.33.0 - github.com/hashicorp/terraform-provider-google-beta v1.20.1-0.20240913205148-3e8e88cc057b + github.com/hashicorp/terraform-provider-google-beta v1.20.1-0.20240913221533-da8f625bda53 github.com/mitchellh/go-homedir v1.1.0 // indirect github.com/pkg/errors v0.9.1 github.com/stretchr/testify v1.9.0 diff --git a/go.sum b/go.sum index 15b3eb353..eb2b52a0b 100644 --- a/go.sum +++ b/go.sum @@ -190,8 +190,8 @@ github.com/hashicorp/terraform-plugin-sdk/v2 v2.33.0 h1:qHprzXy/As0rxedphECBEQAh github.com/hashicorp/terraform-plugin-sdk/v2 v2.33.0/go.mod h1:H+8tjs9TjV2w57QFVSMBQacf8k/E1XwLXGCARgViC6A= github.com/hashicorp/terraform-plugin-testing v1.5.1 h1:T4aQh9JAhmWo4+t1A7x+rnxAJHCDIYW9kXyo4sVO92c= github.com/hashicorp/terraform-plugin-testing v1.5.1/go.mod h1:dg8clO6K59rZ8w9EshBmDp1CxTIPu3yA4iaDpX1h5u0= -github.com/hashicorp/terraform-provider-google-beta v1.20.1-0.20240913205148-3e8e88cc057b h1:kiglt2OxJgHjMk+EoftEEvxJrSXciI27XkxiXF6H9Xc= -github.com/hashicorp/terraform-provider-google-beta v1.20.1-0.20240913205148-3e8e88cc057b/go.mod h1:KmhH9vkbqTNYp9g+1yBfb4iK9CCbKNnakASns8SHzXU= +github.com/hashicorp/terraform-provider-google-beta v1.20.1-0.20240913221533-da8f625bda53 h1:h32sKnOIFRtwriVxeVYhexYnNVXIYEPHhnD24FAlrJI= +github.com/hashicorp/terraform-provider-google-beta v1.20.1-0.20240913221533-da8f625bda53/go.mod h1:KmhH9vkbqTNYp9g+1yBfb4iK9CCbKNnakASns8SHzXU= github.com/hashicorp/terraform-registry-address v0.2.3 h1:2TAiKJ1A3MAkZlH1YI/aTVcLZRu7JseiXNRHbOAyoTI= github.com/hashicorp/terraform-registry-address v0.2.3/go.mod h1:lFHA76T8jfQteVfT7caREqguFrW3c4MFSPhZB7HHgUM= github.com/hashicorp/terraform-svchost v0.1.1 h1:EZZimZ1GxdqFRinZ1tpJwVxxt49xc/S52uzrw4x0jKQ= diff --git a/tfplan2cai/converters/google/resources/services/securitycenter/securitycenter_folder_scc_big_query_export.go b/tfplan2cai/converters/google/resources/services/securitycenter/securitycenter_folder_scc_big_query_export.go new file mode 100644 index 000000000..2bffd8590 --- /dev/null +++ b/tfplan2cai/converters/google/resources/services/securitycenter/securitycenter_folder_scc_big_query_export.go @@ -0,0 +1,89 @@ +// ---------------------------------------------------------------------------- +// +// *** AUTO GENERATED CODE *** Type: MMv1 *** +// +// ---------------------------------------------------------------------------- +// +// This file is automatically generated by Magic Modules and manual +// changes will be clobbered when the file is regenerated. +// +// Please read more about how to change this file in +// .github/CONTRIBUTING.md. +// +// ---------------------------------------------------------------------------- + +package securitycenter + +import ( + "reflect" + + "github.com/GoogleCloudPlatform/terraform-google-conversion/v5/tfplan2cai/converters/google/resources/cai" + "github.com/hashicorp/terraform-provider-google-beta/google-beta/tpgresource" + transport_tpg "github.com/hashicorp/terraform-provider-google-beta/google-beta/transport" +) + +const SecurityCenterFolderSccBigQueryExportAssetType string = "securitycenter.googleapis.com/FolderSccBigQueryExport" + +func ResourceConverterSecurityCenterFolderSccBigQueryExport() cai.ResourceConverter { + return cai.ResourceConverter{ + AssetType: SecurityCenterFolderSccBigQueryExportAssetType, + Convert: GetSecurityCenterFolderSccBigQueryExportCaiObject, + } +} + +func GetSecurityCenterFolderSccBigQueryExportCaiObject(d tpgresource.TerraformResourceData, config *transport_tpg.Config) ([]cai.Asset, error) { + name, err := cai.AssetName(d, config, "//securitycenter.googleapis.com/folders/{{folder}}/bigQueryExports/{{big_query_export_id}}") + if err != nil { + return []cai.Asset{}, err + } + if obj, err := GetSecurityCenterFolderSccBigQueryExportApiObject(d, config); err == nil { + return []cai.Asset{{ + Name: name, + Type: SecurityCenterFolderSccBigQueryExportAssetType, + Resource: &cai.AssetResource{ + Version: "v1", + DiscoveryDocumentURI: "https://www.googleapis.com/discovery/v1/apis/securitycenter/v1/rest", + DiscoveryName: "FolderSccBigQueryExport", + Data: obj, + }, + }}, nil + } else { + return []cai.Asset{}, err + } +} + +func GetSecurityCenterFolderSccBigQueryExportApiObject(d tpgresource.TerraformResourceData, config *transport_tpg.Config) (map[string]interface{}, error) { + obj := make(map[string]interface{}) + descriptionProp, err := expandSecurityCenterFolderSccBigQueryExportDescription(d.Get("description"), d, config) + if err != nil { + return nil, err + } else if v, ok := d.GetOkExists("description"); !tpgresource.IsEmptyValue(reflect.ValueOf(descriptionProp)) && (ok || !reflect.DeepEqual(v, descriptionProp)) { + obj["description"] = descriptionProp + } + datasetProp, err := expandSecurityCenterFolderSccBigQueryExportDataset(d.Get("dataset"), d, config) + if err != nil { + return nil, err + } else if v, ok := d.GetOkExists("dataset"); !tpgresource.IsEmptyValue(reflect.ValueOf(datasetProp)) && (ok || !reflect.DeepEqual(v, datasetProp)) { + obj["dataset"] = datasetProp + } + filterProp, err := expandSecurityCenterFolderSccBigQueryExportFilter(d.Get("filter"), d, config) + if err != nil { + return nil, err + } else if v, ok := d.GetOkExists("filter"); ok || !reflect.DeepEqual(v, filterProp) { + obj["filter"] = filterProp + } + + return obj, nil +} + +func expandSecurityCenterFolderSccBigQueryExportDescription(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { + return v, nil +} + +func expandSecurityCenterFolderSccBigQueryExportDataset(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { + return v, nil +} + +func expandSecurityCenterFolderSccBigQueryExportFilter(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { + return v, nil +}