From 13d8863d54ee2b8434b156365147f5a1afe8efc7 Mon Sep 17 00:00:00 2001 From: Zhenhua Li Date: Thu, 3 Oct 2024 10:42:50 -0700 Subject: [PATCH] Move tgc handwritten resource converters to specific service packages (#11864) --- mmv1/products/firebase/Project.yaml | 2 + mmv1/provider/terraform_tgc.go | 153 +++++++------- .../templates/tgc/resource_converters.go.tmpl | 192 ------------------ mmv1/third_party/tgc/cai/string_helpers.go | 9 + .../tgc/resource_converters.go.tmpl | 91 +++++---- .../tgc/{ => services/apikeys}/apikeys_key.go | 10 +- .../appengine}/appengine_application.go | 6 +- .../appengine}/appengine_standard_version.go | 4 +- .../bigquery}/bigquery_dataset_iam.go | 0 .../{ => services/bigquery}/bigquery_table.go | 4 +- .../bigtable}/bigtable_cluster.go | 4 +- .../bigtable}/bigtable_instance.go | 4 +- .../cloudfunctions_cloud_function.go | 4 +- .../cloudfunctions_function.go | 2 +- .../composer}/composer_environment.go | 4 +- .../tgc/{ => services/compute}/commitment.go | 10 +- .../compute}/compute_instance.go.tmpl | 0 .../compute}/compute_instance_group.go | 8 +- .../compute}/compute_security_policy.go | 4 +- .../compute}/compute_target_pool.go | 4 +- .../tgc/{ => services/container}/container.go | 6 +- .../tgc/{ => services/dataflow}/job.go | 6 +- .../dataproc}/dataproc_cluster.go | 4 +- .../firebase}/firebase_project.go | 8 +- .../{ => services/kms}/kms_crypto_key_iam.go | 8 +- .../{ => services/kms}/kms_key_ring_iam.go | 8 +- .../logging_billing_account_bucket_config.go | 4 +- .../logging}/logging_folder_bucket_config.go | 4 +- .../logging_organization_bucket_config.go | 4 +- .../logging}/logging_project_bucket_config.go | 4 +- .../monitoring}/monitoring_slo_helper.go | 0 .../pubsub}/pubsub_subscription_iam.go | 0 .../{ => services/resourcemanager}/folder.go | 4 +- .../resourcemanager}/folder_iam.go | 0 .../folder_organization_policy.go | 4 +- .../resourcemanager}/org_policy_policy.go | 16 +- .../resourcemanager}/organization_iam.go | 0 .../organization_iam_custom_role.go | 4 +- .../resourcemanager}/organization_policy.go | 4 +- .../{ => services/resourcemanager}/project.go | 6 +- .../resourcemanager}/project_iam.go | 0 .../project_iam_custom_role.go | 4 +- .../project_organization_policy.go | 4 +- .../resourcemanager}/project_service.go | 4 +- .../resourcemanager}/project_service_test.go | 2 +- .../resourcemanager}/service_account.go | 4 +- .../resourcemanager}/service_account_key.go | 4 +- .../spanner}/spanner_database_iam.go | 0 .../spanner}/spanner_instance_iam.go | 0 .../sql}/sql_database_instance.go | 4 +- .../storage}/iam_storage_bucket.go | 2 +- .../{ => services/storage}/storage_bucket.go | 4 +- .../storage}/storage_bucket_iam.go | 8 +- 53 files changed, 230 insertions(+), 419 deletions(-) delete mode 100644 mmv1/templates/tgc/resource_converters.go.tmpl create mode 100644 mmv1/third_party/tgc/cai/string_helpers.go rename mmv1/third_party/tgc/{ => services/apikeys}/apikeys_key.go (98%) rename mmv1/third_party/tgc/{ => services/appengine}/appengine_application.go (96%) rename mmv1/third_party/tgc/{ => services/appengine}/appengine_standard_version.go (99%) rename mmv1/third_party/tgc/{ => services/bigquery}/bigquery_dataset_iam.go (100%) rename mmv1/third_party/tgc/{ => services/bigquery}/bigquery_table.go (99%) rename mmv1/third_party/tgc/{ => services/bigtable}/bigtable_cluster.go (97%) rename mmv1/third_party/tgc/{ => services/bigtable}/bigtable_instance.go (97%) rename mmv1/third_party/tgc/{ => services/cloudfunctions}/cloudfunctions_cloud_function.go (99%) rename mmv1/third_party/tgc/{ => services/cloudfunctions}/cloudfunctions_function.go (99%) rename mmv1/third_party/tgc/{ => services/composer}/composer_environment.go (99%) rename mmv1/third_party/tgc/{ => services/compute}/commitment.go (99%) rename mmv1/third_party/tgc/{ => services/compute}/compute_instance.go.tmpl (100%) rename mmv1/third_party/tgc/{ => services/compute}/compute_instance_group.go (98%) rename mmv1/third_party/tgc/{ => services/compute}/compute_security_policy.go (99%) rename mmv1/third_party/tgc/{ => services/compute}/compute_target_pool.go (98%) rename mmv1/third_party/tgc/{ => services/container}/container.go (99%) rename mmv1/third_party/tgc/{ => services/dataflow}/job.go (99%) rename mmv1/third_party/tgc/{ => services/dataproc}/dataproc_cluster.go (99%) rename mmv1/third_party/tgc/{ => services/firebase}/firebase_project.go (97%) rename mmv1/third_party/tgc/{ => services/kms}/kms_crypto_key_iam.go (95%) rename mmv1/third_party/tgc/{ => services/kms}/kms_key_ring_iam.go (95%) rename mmv1/third_party/tgc/{ => services/logging}/logging_billing_account_bucket_config.go (98%) rename mmv1/third_party/tgc/{ => services/logging}/logging_folder_bucket_config.go (98%) rename mmv1/third_party/tgc/{ => services/logging}/logging_organization_bucket_config.go (98%) rename mmv1/third_party/tgc/{ => services/logging}/logging_project_bucket_config.go (98%) rename mmv1/third_party/tgc/{ => services/monitoring}/monitoring_slo_helper.go (100%) rename mmv1/third_party/tgc/{ => services/pubsub}/pubsub_subscription_iam.go (100%) rename mmv1/third_party/tgc/{ => services/resourcemanager}/folder.go (95%) rename mmv1/third_party/tgc/{ => services/resourcemanager}/folder_iam.go (100%) rename mmv1/third_party/tgc/{ => services/resourcemanager}/folder_organization_policy.go (95%) rename mmv1/third_party/tgc/{ => services/resourcemanager}/org_policy_policy.go (91%) rename mmv1/third_party/tgc/{ => services/resourcemanager}/organization_iam.go (100%) rename mmv1/third_party/tgc/{ => services/resourcemanager}/organization_iam_custom_role.go (97%) rename mmv1/third_party/tgc/{ => services/resourcemanager}/organization_policy.go (95%) rename mmv1/third_party/tgc/{ => services/resourcemanager}/project.go (96%) rename mmv1/third_party/tgc/{ => services/resourcemanager}/project_iam.go (100%) rename mmv1/third_party/tgc/{ => services/resourcemanager}/project_iam_custom_role.go (97%) rename mmv1/third_party/tgc/{ => services/resourcemanager}/project_organization_policy.go (97%) rename mmv1/third_party/tgc/{ => services/resourcemanager}/project_service.go (96%) rename mmv1/third_party/tgc/{ => services/resourcemanager}/project_service_test.go (99%) rename mmv1/third_party/tgc/{ => services/resourcemanager}/service_account.go (98%) rename mmv1/third_party/tgc/{ => services/resourcemanager}/service_account_key.go (99%) rename mmv1/third_party/tgc/{ => services/spanner}/spanner_database_iam.go (100%) rename mmv1/third_party/tgc/{ => services/spanner}/spanner_instance_iam.go (100%) rename mmv1/third_party/tgc/{ => services/sql}/sql_database_instance.go (99%) rename mmv1/third_party/tgc/{ => services/storage}/iam_storage_bucket.go (99%) rename mmv1/third_party/tgc/{ => services/storage}/storage_bucket.go (99%) rename mmv1/third_party/tgc/{ => services/storage}/storage_bucket_iam.go (94%) diff --git a/mmv1/products/firebase/Project.yaml b/mmv1/products/firebase/Project.yaml index 8f68defa2b55..e4dfc44fc188 100644 --- a/mmv1/products/firebase/Project.yaml +++ b/mmv1/products/firebase/Project.yaml @@ -58,6 +58,8 @@ custom_code: constants: 'templates/terraform/constants/firebase_project.go.tmpl' pre_create: 'templates/terraform/pre_create/firebase_project.go.tmpl' exclude_sweeper: true +# The generated resource converter is not used. Instead, a handwritten converter is used. +exclude_tgc: true examples: - name: 'firebase_project_basic' primary_resource_id: 'default' diff --git a/mmv1/provider/terraform_tgc.go b/mmv1/provider/terraform_tgc.go index d3e45ef44d32..392db06b21e2 100644 --- a/mmv1/provider/terraform_tgc.go +++ b/mmv1/provider/terraform_tgc.go @@ -207,7 +207,7 @@ func (tgc TerraformGoogleConversion) CompileCommonFiles(outputFolder string, pro "converters/google/resources/services/kms/iam_kms_key_ring.go": "third_party/terraform/services/kms/iam_kms_key_ring.go.tmpl", "converters/google/resources/services/kms/iam_kms_crypto_key.go": "third_party/terraform/services/kms/iam_kms_crypto_key.go.tmpl", "converters/google/resources/services/compute/metadata.go": "third_party/terraform/services/compute/metadata.go.tmpl", - "converters/google/resources/services/compute/compute_instance.go": "third_party/tgc/compute_instance.go.tmpl", + "converters/google/resources/services/compute/compute_instance.go": "third_party/tgc/services/compute/compute_instance.go.tmpl", } tgc.CompileFileList(outputFolder, resourceConverters, *templateData, products) } @@ -352,81 +352,82 @@ func (tgc TerraformGoogleConversion) CopyCommonFiles(outputFolder string, genera tgc.CopyFileList(outputFolder, retrieveTestSourceCodeWithLocation(".go")) resourceConverters := map[string]string{ - "converters/google/resources/cai/constants.go": "third_party/tgc/cai/constants.go", - "converters/google/resources/constants.go": "third_party/tgc/constants.go", - "converters/google/resources/cai.go": "third_party/tgc/cai.go", - "converters/google/resources/cai/cai.go": "third_party/tgc/cai/cai.go", - "converters/google/resources/cai/cai_test.go": "third_party/tgc/cai/cai_test.go", - "converters/google/resources/org_policy_policy.go": "third_party/tgc/org_policy_policy.go", - "converters/google/resources/getconfig.go": "third_party/tgc/getconfig.go", - "converters/google/resources/folder.go": "third_party/tgc/folder.go", - "converters/google/resources/getconfig_test.go": "third_party/tgc/getconfig_test.go", - "converters/google/resources/cai/json_map.go": "third_party/tgc/cai/json_map.go", - "converters/google/resources/project.go": "third_party/tgc/project.go", - "converters/google/resources/sql_database_instance.go": "third_party/tgc/sql_database_instance.go", - "converters/google/resources/storage_bucket.go": "third_party/tgc/storage_bucket.go", - "converters/google/resources/cloudfunctions_function.go": "third_party/tgc/cloudfunctions_function.go", - "converters/google/resources/cloudfunctions_cloud_function.go": "third_party/tgc/cloudfunctions_cloud_function.go", - "converters/google/resources/bigquery_table.go": "third_party/tgc/bigquery_table.go", - "converters/google/resources/bigtable_cluster.go": "third_party/tgc/bigtable_cluster.go", - "converters/google/resources/bigtable_instance.go": "third_party/tgc/bigtable_instance.go", - "converters/google/resources/cai/iam_helpers.go": "third_party/tgc/cai/iam_helpers.go", - "converters/google/resources/cai/iam_helpers_test.go": "third_party/tgc/cai/iam_helpers_test.go", - "converters/google/resources/services/resourcemanager/organization_iam.go": "third_party/tgc/organization_iam.go", - "converters/google/resources/services/resourcemanager/project_iam.go": "third_party/tgc/project_iam.go", - "converters/google/resources/project_organization_policy.go": "third_party/tgc/project_organization_policy.go", - "converters/google/resources/folder_organization_policy.go": "third_party/tgc/folder_organization_policy.go", - "converters/google/resources/services/resourcemanager/folder_iam.go": "third_party/tgc/folder_iam.go", - "converters/google/resources/container.go": "third_party/tgc/container.go", - "converters/google/resources/project_service.go": "third_party/tgc/project_service.go", - "converters/google/resources/services/monitoring/monitoring_slo_helper.go": "third_party/tgc/monitoring_slo_helper.go", - "converters/google/resources/service_account.go": "third_party/tgc/service_account.go", - "converters/google/resources/services/compute/image.go": "third_party/terraform/services/compute/image.go", - "converters/google/resources/services/compute/disk_type.go": "third_party/terraform/services/compute/disk_type.go", - "converters/google/resources/services/kms/kms_utils.go": "third_party/terraform/services/kms/kms_utils.go", - "converters/google/resources/services/sourcerepo/source_repo_utils.go": "third_party/terraform/services/sourcerepo/source_repo_utils.go", - "converters/google/resources/services/pubsub/pubsub_utils.go": "third_party/terraform/services/pubsub/pubsub_utils.go", - "converters/google/resources/services/resourcemanager/iam_organization.go": "third_party/terraform/services/resourcemanager/iam_organization.go", - "converters/google/resources/services/resourcemanager/iam_folder.go": "third_party/terraform/services/resourcemanager/iam_folder.go", - "converters/google/resources/services/resourcemanager/iam_project.go": "third_party/terraform/services/resourcemanager/iam_project.go", - "converters/google/resources/services/privateca/privateca_utils.go": "third_party/terraform/services/privateca/privateca_utils.go", - "converters/google/resources/services/bigquery/iam_bigquery_dataset.go": "third_party/terraform/services/bigquery/iam_bigquery_dataset.go", - "converters/google/resources/services/bigquery/bigquery_dataset_iam.go": "third_party/tgc/bigquery_dataset_iam.go", - "converters/google/resources/compute_security_policy.go": "third_party/tgc/compute_security_policy.go", - "converters/google/resources/kms_key_ring_iam.go": "third_party/tgc/kms_key_ring_iam.go", - "converters/google/resources/kms_crypto_key_iam.go": "third_party/tgc/kms_crypto_key_iam.go", - "converters/google/resources/project_iam_custom_role.go": "third_party/tgc/project_iam_custom_role.go", - "converters/google/resources/organization_iam_custom_role.go": "third_party/tgc/organization_iam_custom_role.go", - "converters/google/resources/services/pubsub/iam_pubsub_subscription.go": "third_party/terraform/services/pubsub/iam_pubsub_subscription.go", - "converters/google/resources/services/pubsub/pubsub_subscription_iam.go": "third_party/tgc/pubsub_subscription_iam.go", - "converters/google/resources/services/spanner/iam_spanner_database.go": "third_party/terraform/services/spanner/iam_spanner_database.go", - "converters/google/resources/services/spanner/spanner_database_iam.go": "third_party/tgc/spanner_database_iam.go", - "converters/google/resources/services/spanner/iam_spanner_instance.go": "third_party/terraform/services/spanner/iam_spanner_instance.go", - "converters/google/resources/services/spanner/spanner_instance_iam.go": "third_party/tgc/spanner_instance_iam.go", - "converters/google/resources/storage_bucket_iam.go": "third_party/tgc/storage_bucket_iam.go", - "converters/google/resources/organization_policy.go": "third_party/tgc/organization_policy.go", - "converters/google/resources/iam_storage_bucket.go": "third_party/tgc/iam_storage_bucket.go", - "ancestrymanager/ancestrymanager.go": "third_party/tgc/ancestrymanager/ancestrymanager.go", - "ancestrymanager/ancestrymanager_test.go": "third_party/tgc/ancestrymanager/ancestrymanager_test.go", - "ancestrymanager/ancestryutil.go": "third_party/tgc/ancestrymanager/ancestryutil.go", - "ancestrymanager/ancestryutil_test.go": "third_party/tgc/ancestrymanager/ancestryutil_test.go", - "converters/google/convert.go": "third_party/tgc/convert.go", - "converters/google/convert_test.go": "third_party/tgc/convert_test.go", - "converters/google/resources/compute_instance_group.go": "third_party/tgc/compute_instance_group.go", - "converters/google/resources/job.go": "third_party/tgc/job.go", - "converters/google/resources/service_account_key.go": "third_party/tgc/service_account_key.go", - "converters/google/resources/compute_target_pool.go": "third_party/tgc/compute_target_pool.go", - "converters/google/resources/dataproc_cluster.go": "third_party/tgc/dataproc_cluster.go", - "converters/google/resources/composer_environment.go": "third_party/tgc/composer_environment.go", - "converters/google/resources/commitment.go": "third_party/tgc/commitment.go", - "converters/google/resources/firebase_project.go": "third_party/tgc/firebase_project.go", - "converters/google/resources/appengine_application.go": "third_party/tgc/appengine_application.go", - "converters/google/resources/apikeys_key.go": "third_party/tgc/apikeys_key.go", - "converters/google/resources/logging_folder_bucket_config.go": "third_party/tgc/logging_folder_bucket_config.go", - "converters/google/resources/logging_organization_bucket_config.go": "third_party/tgc/logging_organization_bucket_config.go", - "converters/google/resources/logging_project_bucket_config.go": "third_party/tgc/logging_project_bucket_config.go", - "converters/google/resources/logging_billing_account_bucket_config.go": "third_party/tgc/logging_billing_account_bucket_config.go", - "converters/google/resources/appengine_standard_version.go": "third_party/tgc/appengine_standard_version.go", + "converters/google/resources/cai/constants.go": "third_party/tgc/cai/constants.go", + "converters/google/resources/constants.go": "third_party/tgc/constants.go", + "converters/google/resources/cai.go": "third_party/tgc/cai.go", + "converters/google/resources/cai/cai.go": "third_party/tgc/cai/cai.go", + "converters/google/resources/cai/cai_test.go": "third_party/tgc/cai/cai_test.go", + "converters/google/resources/services/resourcemanager/org_policy_policy.go": "third_party/tgc/services/resourcemanager/org_policy_policy.go", + "converters/google/resources/getconfig.go": "third_party/tgc/getconfig.go", + "converters/google/resources/services/resourcemanager/folder.go": "third_party/tgc/services/resourcemanager/folder.go", + "converters/google/resources/getconfig_test.go": "third_party/tgc/getconfig_test.go", + "converters/google/resources/cai/json_map.go": "third_party/tgc/cai/json_map.go", + "converters/google/resources/cai/string_helpers.go": "third_party/tgc/cai/string_helpers.go", + "converters/google/resources/services/resourcemanager/project.go": "third_party/tgc/services/resourcemanager/project.go", + "converters/google/resources/services/sql/sql_database_instance.go": "third_party/tgc/services/sql/sql_database_instance.go", + "converters/google/resources/services/storage/storage_bucket.go": "third_party/tgc/services/storage/storage_bucket.go", + "converters/google/resources/services/cloudfunctions/cloudfunctions_function.go": "third_party/tgc/services/cloudfunctions/cloudfunctions_function.go", + "converters/google/resources/services/cloudfunctions/cloudfunctions_cloud_function.go": "third_party/tgc/services/cloudfunctions/cloudfunctions_cloud_function.go", + "converters/google/resources/services/bigquery/bigquery_table.go": "third_party/tgc/services/bigquery/bigquery_table.go", + "converters/google/resources/services/bigtable/bigtable_cluster.go": "third_party/tgc/services/bigtable/bigtable_cluster.go", + "converters/google/resources/services/bigtable/bigtable_instance.go": "third_party/tgc/services/bigtable/bigtable_instance.go", + "converters/google/resources/cai/iam_helpers.go": "third_party/tgc/cai/iam_helpers.go", + "converters/google/resources/cai/iam_helpers_test.go": "third_party/tgc/cai/iam_helpers_test.go", + "converters/google/resources/services/resourcemanager/organization_iam.go": "third_party/tgc/services/resourcemanager/organization_iam.go", + "converters/google/resources/services/resourcemanager/project_iam.go": "third_party/tgc/services/resourcemanager/project_iam.go", + "converters/google/resources/services/resourcemanager/project_organization_policy.go": "third_party/tgc/services/resourcemanager/project_organization_policy.go", + "converters/google/resources/services/resourcemanager/folder_organization_policy.go": "third_party/tgc/services/resourcemanager/folder_organization_policy.go", + "converters/google/resources/services/resourcemanager/folder_iam.go": "third_party/tgc/services/resourcemanager/folder_iam.go", + "converters/google/resources/services/container/container.go": "third_party/tgc/services/container/container.go", + "converters/google/resources/services/resourcemanager/project_service.go": "third_party/tgc/services/resourcemanager/project_service.go", + "converters/google/resources/services/monitoring/monitoring_slo_helper.go": "third_party/tgc/services/monitoring/monitoring_slo_helper.go", + "converters/google/resources/services/resourcemanager/service_account.go": "third_party/tgc/services/resourcemanager/service_account.go", + "converters/google/resources/services/compute/image.go": "third_party/terraform/services/compute/image.go", + "converters/google/resources/services/compute/disk_type.go": "third_party/terraform/services/compute/disk_type.go", + "converters/google/resources/services/kms/kms_utils.go": "third_party/terraform/services/kms/kms_utils.go", + "converters/google/resources/services/sourcerepo/source_repo_utils.go": "third_party/terraform/services/sourcerepo/source_repo_utils.go", + "converters/google/resources/services/pubsub/pubsub_utils.go": "third_party/terraform/services/pubsub/pubsub_utils.go", + "converters/google/resources/services/resourcemanager/iam_organization.go": "third_party/terraform/services/resourcemanager/iam_organization.go", + "converters/google/resources/services/resourcemanager/iam_folder.go": "third_party/terraform/services/resourcemanager/iam_folder.go", + "converters/google/resources/services/resourcemanager/iam_project.go": "third_party/terraform/services/resourcemanager/iam_project.go", + "converters/google/resources/services/privateca/privateca_utils.go": "third_party/terraform/services/privateca/privateca_utils.go", + "converters/google/resources/services/bigquery/iam_bigquery_dataset.go": "third_party/terraform/services/bigquery/iam_bigquery_dataset.go", + "converters/google/resources/services/bigquery/bigquery_dataset_iam.go": "third_party/tgc/services/bigquery/bigquery_dataset_iam.go", + "converters/google/resources/services/compute/compute_security_policy.go": "third_party/tgc/services/compute/compute_security_policy.go", + "converters/google/resources/services/kms/kms_key_ring_iam.go": "third_party/tgc/services/kms/kms_key_ring_iam.go", + "converters/google/resources/services/kms/kms_crypto_key_iam.go": "third_party/tgc/services/kms/kms_crypto_key_iam.go", + "converters/google/resources/services/resourcemanager/project_iam_custom_role.go": "third_party/tgc/services/resourcemanager/project_iam_custom_role.go", + "converters/google/resources/services/resourcemanager/organization_iam_custom_role.go": "third_party/tgc/services/resourcemanager/organization_iam_custom_role.go", + "converters/google/resources/services/pubsub/iam_pubsub_subscription.go": "third_party/terraform/services/pubsub/iam_pubsub_subscription.go", + "converters/google/resources/services/pubsub/pubsub_subscription_iam.go": "third_party/tgc/services/pubsub/pubsub_subscription_iam.go", + "converters/google/resources/services/spanner/iam_spanner_database.go": "third_party/terraform/services/spanner/iam_spanner_database.go", + "converters/google/resources/services/spanner/spanner_database_iam.go": "third_party/tgc/services/spanner/spanner_database_iam.go", + "converters/google/resources/services/spanner/iam_spanner_instance.go": "third_party/terraform/services/spanner/iam_spanner_instance.go", + "converters/google/resources/services/spanner/spanner_instance_iam.go": "third_party/tgc/services/spanner/spanner_instance_iam.go", + "converters/google/resources/services/storage/storage_bucket_iam.go": "third_party/tgc/services/storage/storage_bucket_iam.go", + "converters/google/resources/services/resourcemanager/organization_policy.go": "third_party/tgc/services/resourcemanager/organization_policy.go", + "converters/google/resources/services/storage/iam_storage_bucket.go": "third_party/tgc/services/storage/iam_storage_bucket.go", + "ancestrymanager/ancestrymanager.go": "third_party/tgc/ancestrymanager/ancestrymanager.go", + "ancestrymanager/ancestrymanager_test.go": "third_party/tgc/ancestrymanager/ancestrymanager_test.go", + "ancestrymanager/ancestryutil.go": "third_party/tgc/ancestrymanager/ancestryutil.go", + "ancestrymanager/ancestryutil_test.go": "third_party/tgc/ancestrymanager/ancestryutil_test.go", + "converters/google/convert.go": "third_party/tgc/convert.go", + "converters/google/convert_test.go": "third_party/tgc/convert_test.go", + "converters/google/resources/services/compute/compute_instance_group.go": "third_party/tgc/services/compute/compute_instance_group.go", + "converters/google/resources/services/dataflow/job.go": "third_party/tgc/services/dataflow/job.go", + "converters/google/resources/services/resourcemanager/service_account_key.go": "third_party/tgc/services/resourcemanager/service_account_key.go", + "converters/google/resources/services/compute/compute_target_pool.go": "third_party/tgc/services/compute/compute_target_pool.go", + "converters/google/resources/services/dataproc/dataproc_cluster.go": "third_party/tgc/services/dataproc/dataproc_cluster.go", + "converters/google/resources/services/composer/composer_environment.go": "third_party/tgc/services/composer/composer_environment.go", + "converters/google/resources/services/compute/commitment.go": "third_party/tgc/services/compute/commitment.go", + "converters/google/resources/services/firebase/firebase_project.go": "third_party/tgc/services/firebase/firebase_project.go", + "converters/google/resources/services/appengine/appengine_application.go": "third_party/tgc/services/appengine/appengine_application.go", + "converters/google/resources/services/apikeys/apikeys_key.go": "third_party/tgc/services/apikeys/apikeys_key.go", + "converters/google/resources/services/logging/logging_folder_bucket_config.go": "third_party/tgc/services/logging/logging_folder_bucket_config.go", + "converters/google/resources/services/logging/logging_organization_bucket_config.go": "third_party/tgc/services/logging/logging_organization_bucket_config.go", + "converters/google/resources/services/logging/logging_project_bucket_config.go": "third_party/tgc/services/logging/logging_project_bucket_config.go", + "converters/google/resources/services/logging/logging_billing_account_bucket_config.go": "third_party/tgc/services/logging/logging_billing_account_bucket_config.go", + "converters/google/resources/services/appengine/appengine_standard_version.go": "third_party/tgc/services/appengine/appengine_standard_version.go", } tgc.CopyFileList(outputFolder, resourceConverters) } diff --git a/mmv1/templates/tgc/resource_converters.go.tmpl b/mmv1/templates/tgc/resource_converters.go.tmpl deleted file mode 100644 index 8c8e5baf6beb..000000000000 --- a/mmv1/templates/tgc/resource_converters.go.tmpl +++ /dev/null @@ -1,192 +0,0 @@ -{{/* The license inside this block applies to this file - Copyright 2024 Google LLC. All Rights Reserved. - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. */ -}} -// ---------------------------------------------------------------------------- -// -// *** 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 google - -import ( - "sort" - "github.com/GoogleCloudPlatform/terraform-google-conversion/v5/tfplan2cai/converters/google/resources/services/compute" - "github.com/GoogleCloudPlatform/terraform-google-conversion/v5/tfplan2cai/converters/google/resources/services/resourcemanager" - "github.com/GoogleCloudPlatform/terraform-google-conversion/v5/tfplan2cai/converters/google/resources/services/spanner" - "github.com/hashicorp/terraform-provider-google-beta/google-beta/tpgresource" -) - - -// ResourceConverter returns a map of terraform resource types (i.e. `google_project`) -// to a slice of ResourceConverters. -// -// Modelling of relationships: -// terraform resources to CAI assets as []cai.ResourceConverter: -// 1:1 = [ResourceConverter{Convert: convertAbc}] (len=1) -// 1:N = [ResourceConverter{Convert: convertAbc}, ...] (len=N) -// N:1 = [ResourceConverter{Convert: convertAbc, merge: mergeAbc}] (len=1) -func ResourceConverters() map[string][]cai.ResourceConverter { - return map[string][]cai.ResourceConverter{ - "google_artifact_registry_repository": {artifactregistry.ResourceConverterArtifactRegistryRepository()}, - "google_app_engine_application": {resourceConverterAppEngineApplication()}, - "google_alloydb_cluster": {alloydb.ResourceConverterAlloydbCluster()}, - "google_alloydb_instance": {alloydb.ResourceConverterAlloydbInstance()}, - "google_apikeys_key": {resourceConverterApikeysKey()}, - "google_compute_address": {compute.ResourceConverterComputeAddress()}, - "google_compute_autoscaler": {compute.ResourceConverterComputeAutoscaler()}, - "google_compute_firewall": {compute.ResourceConverterComputeFirewall()}, - "google_compute_disk": {compute.ResourceConverterComputeDisk()}, - "google_compute_forwarding_rule": {compute.ResourceConverterComputeForwardingRule()}, - "google_gke_hub_membership": {gkehub.ResourceConverterGKEHubMembership()}, - "google_compute_global_address": {compute.ResourceConverterComputeGlobalAddress()}, - "google_compute_global_forwarding_rule": {compute.ResourceConverterComputeGlobalForwardingRule()}, - "google_compute_health_check": {compute.ResourceConverterComputeHealthCheck()}, - "google_compute_instance": {compute.ResourceConverterComputeInstance()}, - "google_compute_instance_group": {resourceConverterComputeInstanceGroup()}, - "google_compute_network": {compute.ResourceConverterComputeNetwork()}, - "google_compute_node_template": {compute.ResourceConverterComputeNodeTemplate()}, - "google_compute_route": {compute.ResourceConverterComputeRoute()}, - "google_compute_router": {compute.ResourceConverterComputeRouter()}, - "google_compute_vpn_tunnel": {compute.ResourceConverterComputeVpnTunnel()}, - "google_compute_resource_policy": {compute.ResourceConverterComputeResourcePolicy()}, - "google_compute_security_policy": {resourceConverterComputeSecurityPolicy()}, - "google_compute_snapshot": {compute.ResourceConverterComputeSnapshot()}, - "google_compute_subnetwork": {compute.ResourceConverterComputeSubnetwork()}, - "google_compute_ssl_policy": {compute.ResourceConverterComputeSslPolicy()}, - "google_compute_ssl_certificate": {compute.ResourceConverterComputeSslCertificate()}, - "google_compute_url_map": {compute.ResourceConverterComputeUrlMap()}, - "google_compute_target_http_proxy": {compute.ResourceConverterComputeTargetHttpProxy()}, - "google_compute_target_https_proxy": {compute.ResourceConverterComputeTargetHttpsProxy()}, - "google_compute_target_ssl_proxy": {compute.ResourceConverterComputeTargetSslProxy()}, - "google_compute_target_pool": {resourceConverterComputeTargetPool()}, - "google_composer_environment": {resourceConverterComposerEnvironment()}, - "google_compute_region_commitment": {resourceConverterCommitment()}, - "google_dataflow_job": {resourceDataflowJob()}, - "google_dataproc_autoscaling_policy": {dataproc.ResourceConverterDataprocAutoscalingPolicy()}, - "google_dataproc_cluster": {resourceConverterDataprocCluster()}, - "google_dns_managed_zone": {dns.ResourceConverterDNSManagedZone()}, - "google_dns_policy": {dns.ResourceConverterDNSPolicy()}, - "google_kms_key_ring_import_job": {kms.ResourceConverterKMSKeyRingImportJob()}, - "google_gke_hub_feature": {gkehub2.ResourceConverterGKEHub2Feature()}, - "google_storage_bucket": {resourceConverterStorageBucket()}, - "google_sql_database_instance": {resourceConverterSQLDatabaseInstance()}, - "google_sql_database": {sql.ResourceConverterSQLDatabase()}, - "google_container_cluster": {resourceConverterContainerCluster()}, - "google_container_node_pool": {resourceConverterContainerNodePool()}, - "google_bigquery_dataset": {bigquery.ResourceConverterBigQueryDataset()}, - "google_bigquery_dataset_iam_policy": {bigquery.ResourceConverterBigqueryDatasetIamPolicy()}, - "google_bigquery_dataset_iam_binding": {bigquery.ResourceConverterBigqueryDatasetIamBinding()}, - "google_bigquery_dataset_iam_member": {bigquery.ResourceConverterBigqueryDatasetIamMember()}, - "google_bigquery_table": {resourceConverterBigQueryTable()}, - "google_datastream_connection_profile": {datastream.ResourceConverterDatastreamConnectionProfile()}, - "google_datastream_private_connection": {datastream.ResourceConverterDatastreamPrivateConnection()}, - "google_datastream_stream": {datastream.ResourceConverterDatastreamStream()}, - "google_firebase_project": {resourceConverterFirebaseProject()}, - "google_org_policy_policy": {resourceConverterOrgPolicyPolicy()}, - "google_redis_instance": {redis.ResourceConverterRedisInstance()}, - "google_spanner_database": {spanner.ResourceConverterSpannerDatabase()}, - "google_spanner_database_iam_policy": {spanner.ResourceConverterSpannerDatabaseIamPolicy()}, - "google_spanner_database_iam_binding": {spanner.ResourceConverterSpannerDatabaseIamBinding()}, - "google_spanner_database_iam_member": {spanner.ResourceConverterSpannerDatabaseIamMember()}, - "google_spanner_instance": {spanner.ResourceConverterSpannerInstance()}, - "google_spanner_instance_iam_policy": {spanner.ResourceConverterSpannerInstanceIamPolicy()}, - "google_spanner_instance_iam_binding": {spanner.ResourceConverterSpannerInstanceIamBinding()}, - "google_spanner_instance_iam_member": {spanner.ResourceConverterSpannerInstanceIamMember()}, - "google_project_service": {resourceConverterServiceUsage()}, - "google_secret_manager_secret_version": {secretmanager.ResourceConverterSecretManagerSecretVersion()}, - "google_pubsub_lite_reservation": {pubsublite.ResourceConverterPubsubLiteReservation()}, - "google_pubsub_lite_subscription": {pubsublite.ResourceConverterPubsubLiteSubscription()}, - "google_pubsub_lite_topic": {pubsublite.ResourceConverterPubsubLiteTopic()}, - "google_pubsub_schema": {pubsub.ResourceConverterPubsubSchema()}, - "google_pubsub_subscription": {pubsub.ResourceConverterPubsubSubscription()}, - "google_pubsub_subscription_iam_policy": {pubsub.ResourceConverterPubsubSubscriptionIamPolicy()}, - "google_pubsub_subscription_iam_binding": {pubsub.ResourceConverterPubsubSubscriptionIamBinding()}, - "google_pubsub_subscription_iam_member": {pubsub.ResourceConverterPubsubSubscriptionIamMember()}, - "google_storage_bucket_iam_policy": {resourceConverterStorageBucketIamPolicy()}, - "google_storage_bucket_iam_binding": {resourceConverterStorageBucketIamBinding()}, - "google_storage_bucket_iam_member": {resourceConverterStorageBucketIamMember()}, - "google_compute_node_group": {compute.ResourceConverterComputeNodeGroup()}, - "google_logging_folder_bucket_config": {resourceConverterLogFolderBucket()}, - "google_app_engine_standard_app_version": {resourceAppEngineStandardAppVersion()}, - "google_logging_organization_bucket_config": {resourceConverterLogOrganizationBucket()}, - "google_logging_project_bucket_config": {resourceConverterLogProjectBucket()}, - "google_logging_billing_account_bucket_config": {resourceConverterLogBillingAccountBucket()}, - "google_cloud_tasks_queue": {cloudtasks.ResourceConverterCloudTasksQueue()}, - "google_pubsub_topic": {pubsub.ResourceConverterPubsubTopic()}, - "google_kms_crypto_key": {kms.ResourceConverterKMSCryptoKey()}, - "google_kms_key_ring": {kms.ResourceConverterKMSKeyRing()}, - "google_filestore_instance": {filestore.ResourceConverterFilestoreInstance()}, - "google_access_context_manager_service_perimeter": {accesscontextmanager.ResourceConverterAccessContextManagerServicePerimeter()}, - "google_access_context_manager_access_policy": {accesscontextmanager.ResourceConverterAccessContextManagerAccessPolicy()}, - "google_cloud_run_service": {cloudrun.ResourceConverterCloudRunService()}, - "google_cloud_run_domain_mapping": {cloudrun.ResourceConverterCloudRunDomainMapping()}, - "google_cloud_run_v2_job": {cloudrunv2.ResourceConverterCloudRunV2Job()}, - "google_cloudfunctions_function": {resourceConverterCloudFunctionsCloudFunction()}, - "google_monitoring_notification_channel": {monitoring.ResourceConverterMonitoringNotificationChannel()}, - "google_monitoring_alert_policy": {monitoring.ResourceConverterMonitoringAlertPolicy()}, - "google_vertex_ai_dataset": {vertexai.ResourceConverterVertexAIDataset()}, - {{- range $object := $.ResourcesForVersion }} - {{- if $object.ResourceName }} - "{{ $object.TerraformName }}": {{ $object.ResourceName }}(), - {{- end }} - {{- if $object.IamClassName }} - "{{ $object.TerraformName }}_iam_binding": tpgiamresource.ResourceIamBinding({{ $object.IamClassName }}IamSchema, {{ $object.IamClassName }}IamUpdaterProducer, {{ $object.IamClassName }}IdParseFunc), - "{{ $object.TerraformName }}_iam_member": tpgiamresource.ResourceIamMember({{ $object.IamClassName }}IamSchema, {{ $object.IamClassName }}IamUpdaterProducer, {{ $object.IamClassName }}IdParseFunc), - "{{ $object.TerraformName }}_iam_policy": tpgiamresource.ResourceIamPolicy({{ $object.IamClassName }}IamSchema, {{ $object.IamClassName }}IamUpdaterProducer, {{ $object.IamClassName }}IdParseFunc), - {{- end }} - {{- end }} - "google_project": { - resourceConverterProject(), - resourceConverterProjectBillingInfo(), - }, - "google_bigtable_instance": { - resourceConverterBigtableInstance(), - resourceConverterBigtableCluster(), - }, - "google_organization_iam_policy": {resourcemanager.ResourceConverterOrganizationIamPolicy()}, - "google_organization_iam_binding": {resourcemanager.ResourceConverterOrganizationIamBinding()}, - "google_organization_iam_member": {resourcemanager.ResourceConverterOrganizationIamMember()}, - "google_organization_policy": {resourceConverterOrganizationPolicy()}, - "google_project_organization_policy": {resourceConverterProjectOrgPolicy()}, - "google_folder": {resourceConverterFolder()}, - "google_folder_iam_policy": {resourcemanager.ResourceConverterFolderIamPolicy()}, - "google_folder_iam_binding": {resourcemanager.ResourceConverterFolderIamBinding()}, - "google_folder_iam_member": {resourcemanager.ResourceConverterFolderIamMember()}, - "google_folder_organization_policy": {resourceConverterFolderOrgPolicy()}, - "google_kms_crypto_key_iam_policy": {resourceConverterKmsCryptoKeyIamPolicy()}, - "google_kms_crypto_key_iam_binding": {resourceConverterKmsCryptoKeyIamBinding()}, - "google_kms_crypto_key_iam_member": {resourceConverterKmsCryptoKeyIamMember()}, - "google_kms_key_ring_iam_policy": {resourceConverterKmsKeyRingIamPolicy()}, - "google_kms_key_ring_iam_binding": {resourceConverterKmsKeyRingIamBinding()}, - "google_kms_key_ring_iam_member": {resourceConverterKmsKeyRingIamMember()}, - "google_project_iam_policy": {resourcemanager.ResourceConverterProjectIamPolicy()}, - "google_project_iam_binding": {resourcemanager.ResourceConverterProjectIamBinding()}, - "google_project_iam_member": {resourcemanager.ResourceConverterProjectIamMember()}, - "google_project_iam_custom_role": {resourceConverterProjectIAMCustomRole()}, - "google_organization_iam_custom_role": {resourceConverterOrganizationIAMCustomRole()}, - "google_vpc_access_connector": {vpcaccess.ResourceConverterVPCAccessConnector()}, - "google_logging_metric": {logging.ResourceConverterLoggingMetric()}, - "google_service_account": {resourceConverterServiceAccount()}, - "google_service_account_key": {resourceConverterServiceAccountKey()}, - - } -} diff --git a/mmv1/third_party/tgc/cai/string_helpers.go b/mmv1/third_party/tgc/cai/string_helpers.go new file mode 100644 index 000000000000..33395886a3bc --- /dev/null +++ b/mmv1/third_party/tgc/cai/string_helpers.go @@ -0,0 +1,9 @@ +package cai + +func ConvertInterfaceToStringArray(values []interface{}) []string { + stringArray := make([]string, len(values)) + for i, v := range values { + stringArray[i] = v.(string) + } + return stringArray +} diff --git a/mmv1/third_party/tgc/resource_converters.go.tmpl b/mmv1/third_party/tgc/resource_converters.go.tmpl index 1acd324f3d8a..08d1dee5bae6 100644 --- a/mmv1/third_party/tgc/resource_converters.go.tmpl +++ b/mmv1/third_party/tgc/resource_converters.go.tmpl @@ -29,6 +29,8 @@ package google import ( "sort" + "github.com/GoogleCloudPlatform/terraform-google-conversion/v5/tfplan2cai/converters/google/resources/services/appengine" + "github.com/GoogleCloudPlatform/terraform-google-conversion/v5/tfplan2cai/converters/google/resources/services/container" "github.com/GoogleCloudPlatform/terraform-google-conversion/v5/tfplan2cai/converters/google/resources/services/compute" "github.com/GoogleCloudPlatform/terraform-google-conversion/v5/tfplan2cai/converters/google/resources/services/kms" "github.com/GoogleCloudPlatform/terraform-google-conversion/v5/tfplan2cai/converters/google/resources/services/resourcemanager" @@ -36,6 +38,7 @@ import ( "github.com/GoogleCloudPlatform/terraform-google-conversion/v5/tfplan2cai/converters/google/resources/services/secretmanagerregional" "github.com/GoogleCloudPlatform/terraform-google-conversion/v5/tfplan2cai/converters/google/resources/services/securesourcemanager" "github.com/GoogleCloudPlatform/terraform-google-conversion/v5/tfplan2cai/converters/google/resources/services/securitycenterv2" + "github.com/GoogleCloudPlatform/terraform-google-conversion/v5/tfplan2cai/converters/google/resources/services/storage" "github.com/hashicorp/terraform-provider-google-beta/google-beta/tpgresource" ) @@ -51,10 +54,10 @@ import ( func ResourceConverters() map[string][]cai.ResourceConverter { return map[string][]cai.ResourceConverter{ "google_artifact_registry_repository": {artifactregistry.ResourceConverterArtifactRegistryRepository()}, - "google_app_engine_application": {resourceConverterAppEngineApplication()}, + "google_app_engine_application": {appengine.ResourceConverterAppEngineApplication()}, "google_alloydb_cluster": {alloydb.ResourceConverterAlloydbCluster()}, "google_alloydb_instance": {alloydb.ResourceConverterAlloydbInstance()}, - "google_apikeys_key": {resourceConverterApikeysKey()}, + "google_apikeys_key": {apikeys.ResourceConverterApikeysKey()}, "google_compute_address": {compute.ResourceConverterComputeAddress()}, "google_compute_autoscaler": {compute.ResourceConverterComputeAutoscaler()}, "google_compute_firewall": {compute.ResourceConverterComputeFirewall()}, @@ -65,14 +68,14 @@ func ResourceConverters() map[string][]cai.ResourceConverter { "google_compute_global_forwarding_rule": {compute.ResourceConverterComputeGlobalForwardingRule()}, "google_compute_health_check": {compute.ResourceConverterComputeHealthCheck()}, "google_compute_instance": {compute.ResourceConverterComputeInstance()}, - "google_compute_instance_group": {resourceConverterComputeInstanceGroup()}, + "google_compute_instance_group": {compute.ResourceConverterComputeInstanceGroup()}, "google_compute_network": {compute.ResourceConverterComputeNetwork()}, "google_compute_node_template": {compute.ResourceConverterComputeNodeTemplate()}, "google_compute_route": {compute.ResourceConverterComputeRoute()}, "google_compute_router": {compute.ResourceConverterComputeRouter()}, "google_compute_vpn_tunnel": {compute.ResourceConverterComputeVpnTunnel()}, "google_compute_resource_policy": {compute.ResourceConverterComputeResourcePolicy()}, - "google_compute_security_policy": {resourceConverterComputeSecurityPolicy()}, + "google_compute_security_policy": {compute.ResourceConverterComputeSecurityPolicy()}, "google_compute_snapshot": {compute.ResourceConverterComputeSnapshot()}, "google_compute_subnetwork": {compute.ResourceConverterComputeSubnetwork()}, "google_compute_ssl_policy": {compute.ResourceConverterComputeSslPolicy()}, @@ -81,31 +84,31 @@ func ResourceConverters() map[string][]cai.ResourceConverter { "google_compute_target_http_proxy": {compute.ResourceConverterComputeTargetHttpProxy()}, "google_compute_target_https_proxy": {compute.ResourceConverterComputeTargetHttpsProxy()}, "google_compute_target_ssl_proxy": {compute.ResourceConverterComputeTargetSslProxy()}, - "google_compute_target_pool": {resourceConverterComputeTargetPool()}, - "google_composer_environment": {resourceConverterComposerEnvironment()}, - "google_compute_region_commitment": {resourceConverterCommitment()}, - "google_dataflow_job": {resourceDataflowJob()}, + "google_compute_target_pool": {compute.ResourceConverterComputeTargetPool()}, + "google_composer_environment": {composer.ResourceConverterComposerEnvironment()}, + "google_compute_region_commitment": {compute.ResourceConverterCommitment()}, + "google_dataflow_job": {dataflow.ResourceDataflowJob()}, "google_dataproc_autoscaling_policy": {dataproc.ResourceConverterDataprocAutoscalingPolicy()}, - "google_dataproc_cluster": {resourceConverterDataprocCluster()}, + "google_dataproc_cluster": {dataproc.ResourceConverterDataprocCluster()}, "google_dns_managed_zone": {dns.ResourceConverterDNSManagedZone()}, "google_dns_policy": {dns.ResourceConverterDNSPolicy()}, "google_kms_key_ring_import_job": {kms.ResourceConverterKMSKeyRingImportJob()}, "google_gke_hub_feature": {gkehub2.ResourceConverterGKEHub2Feature()}, - "google_storage_bucket": {resourceConverterStorageBucket()}, - "google_sql_database_instance": {resourceConverterSQLDatabaseInstance()}, + "google_storage_bucket": {storage.ResourceConverterStorageBucket()}, + "google_sql_database_instance": {sql.ResourceConverterSQLDatabaseInstance()}, "google_sql_database": {sql.ResourceConverterSQLDatabase()}, - "google_container_cluster": {resourceConverterContainerCluster()}, - "google_container_node_pool": {resourceConverterContainerNodePool()}, + "google_container_cluster": {container.ResourceConverterContainerCluster()}, + "google_container_node_pool": {container.ResourceConverterContainerNodePool()}, "google_bigquery_dataset": {bigquery.ResourceConverterBigQueryDataset()}, "google_bigquery_dataset_iam_policy": {bigquery.ResourceConverterBigqueryDatasetIamPolicy()}, "google_bigquery_dataset_iam_binding": {bigquery.ResourceConverterBigqueryDatasetIamBinding()}, "google_bigquery_dataset_iam_member": {bigquery.ResourceConverterBigqueryDatasetIamMember()}, - "google_bigquery_table": {resourceConverterBigQueryTable()}, + "google_bigquery_table": {bigquery.ResourceConverterBigQueryTable()}, "google_datastream_connection_profile": {datastream.ResourceConverterDatastreamConnectionProfile()}, "google_datastream_private_connection": {datastream.ResourceConverterDatastreamPrivateConnection()}, "google_datastream_stream": {datastream.ResourceConverterDatastreamStream()}, - "google_firebase_project": {resourceConverterFirebaseProject()}, - "google_org_policy_policy": {resourceConverterOrgPolicyPolicy()}, + "google_firebase_project": {firebase.ResourceConverterFirebaseProject()}, + "google_org_policy_policy": {resourcemanager.ResourceConverterOrgPolicyPolicy()}, "google_redis_instance": {redis.ResourceConverterRedisInstance()}, "google_spanner_database": {spanner.ResourceConverterSpannerDatabase()}, "google_spanner_database_iam_policy": {spanner.ResourceConverterSpannerDatabaseIamPolicy()}, @@ -115,7 +118,7 @@ func ResourceConverters() map[string][]cai.ResourceConverter { "google_spanner_instance_iam_policy": {spanner.ResourceConverterSpannerInstanceIamPolicy()}, "google_spanner_instance_iam_binding": {spanner.ResourceConverterSpannerInstanceIamBinding()}, "google_spanner_instance_iam_member": {spanner.ResourceConverterSpannerInstanceIamMember()}, - "google_project_service": {resourceConverterServiceUsage()}, + "google_project_service": {resourcemanager.ResourceConverterServiceUsage()}, "google_secret_manager_secret_version": {secretmanager.ResourceConverterSecretManagerSecretVersion()}, "google_pubsub_lite_reservation": {pubsublite.ResourceConverterPubsubLiteReservation()}, "google_pubsub_lite_subscription": {pubsublite.ResourceConverterPubsubLiteSubscription()}, @@ -125,15 +128,15 @@ func ResourceConverters() map[string][]cai.ResourceConverter { "google_pubsub_subscription_iam_policy": {pubsub.ResourceConverterPubsubSubscriptionIamPolicy()}, "google_pubsub_subscription_iam_binding": {pubsub.ResourceConverterPubsubSubscriptionIamBinding()}, "google_pubsub_subscription_iam_member": {pubsub.ResourceConverterPubsubSubscriptionIamMember()}, - "google_storage_bucket_iam_policy": {resourceConverterStorageBucketIamPolicy()}, - "google_storage_bucket_iam_binding": {resourceConverterStorageBucketIamBinding()}, - "google_storage_bucket_iam_member": {resourceConverterStorageBucketIamMember()}, + "google_storage_bucket_iam_policy": {storage.ResourceConverterStorageBucketIamPolicy()}, + "google_storage_bucket_iam_binding": {storage.ResourceConverterStorageBucketIamBinding()}, + "google_storage_bucket_iam_member": {storage.ResourceConverterStorageBucketIamMember()}, "google_compute_node_group": {compute.ResourceConverterComputeNodeGroup()}, - "google_logging_folder_bucket_config": {resourceConverterLogFolderBucket()}, - "google_app_engine_standard_app_version": {resourceAppEngineStandardAppVersion()}, - "google_logging_organization_bucket_config": {resourceConverterLogOrganizationBucket()}, - "google_logging_project_bucket_config": {resourceConverterLogProjectBucket()}, - "google_logging_billing_account_bucket_config": {resourceConverterLogBillingAccountBucket()}, + "google_logging_folder_bucket_config": {logging.ResourceConverterLogFolderBucket()}, + "google_app_engine_standard_app_version": {appengine.ResourceAppEngineStandardAppVersion()}, + "google_logging_organization_bucket_config": {logging.ResourceConverterLogOrganizationBucket()}, + "google_logging_project_bucket_config": {logging.ResourceConverterLogProjectBucket()}, + "google_logging_billing_account_bucket_config": {logging.ResourceConverterLogBillingAccountBucket()}, "google_cloud_tasks_queue": {cloudtasks.ResourceConverterCloudTasksQueue()}, "google_pubsub_topic": {pubsub.ResourceConverterPubsubTopic()}, "google_kms_crypto_key": {kms.ResourceConverterKMSCryptoKey()}, @@ -144,7 +147,7 @@ func ResourceConverters() map[string][]cai.ResourceConverter { "google_cloud_run_service": {cloudrun.ResourceConverterCloudRunService()}, "google_cloud_run_domain_mapping": {cloudrun.ResourceConverterCloudRunDomainMapping()}, "google_cloud_run_v2_job": {cloudrunv2.ResourceConverterCloudRunV2Job()}, - "google_cloudfunctions_function": {resourceConverterCloudFunctionsCloudFunction()}, + "google_cloudfunctions_function": {cloudfunctions.ResourceConverterCloudFunctionsCloudFunction()}, "google_monitoring_notification_channel": {monitoring.ResourceConverterMonitoringNotificationChannel()}, "google_monitoring_alert_policy": {monitoring.ResourceConverterMonitoringAlertPolicy()}, "google_vertex_ai_dataset": {vertexai.ResourceConverterVertexAIDataset()}, @@ -156,38 +159,38 @@ func ResourceConverters() map[string][]cai.ResourceConverter { {{- end }} {{- end }} "google_project": { - resourceConverterProject(), - resourceConverterProjectBillingInfo(), + resourcemanager.ResourceConverterProject(), + resourcemanager.ResourceConverterProjectBillingInfo(), }, "google_bigtable_instance": { - resourceConverterBigtableInstance(), - resourceConverterBigtableCluster(), + bigtable.ResourceConverterBigtableInstance(), + bigtable.ResourceConverterBigtableCluster(), }, "google_organization_iam_policy": {resourcemanager.ResourceConverterOrganizationIamPolicy()}, "google_organization_iam_binding": {resourcemanager.ResourceConverterOrganizationIamBinding()}, "google_organization_iam_member": {resourcemanager.ResourceConverterOrganizationIamMember()}, - "google_organization_policy": {resourceConverterOrganizationPolicy()}, - "google_project_organization_policy": {resourceConverterProjectOrgPolicy()}, - "google_folder": {resourceConverterFolder()}, + "google_organization_policy": {resourcemanager.ResourceConverterOrganizationPolicy()}, + "google_project_organization_policy": {resourcemanager.ResourceConverterProjectOrgPolicy()}, + "google_folder": {resourcemanager.ResourceConverterFolder()}, "google_folder_iam_policy": {resourcemanager.ResourceConverterFolderIamPolicy()}, "google_folder_iam_binding": {resourcemanager.ResourceConverterFolderIamBinding()}, "google_folder_iam_member": {resourcemanager.ResourceConverterFolderIamMember()}, - "google_folder_organization_policy": {resourceConverterFolderOrgPolicy()}, - "google_kms_crypto_key_iam_policy": {resourceConverterKmsCryptoKeyIamPolicy()}, - "google_kms_crypto_key_iam_binding": {resourceConverterKmsCryptoKeyIamBinding()}, - "google_kms_crypto_key_iam_member": {resourceConverterKmsCryptoKeyIamMember()}, - "google_kms_key_ring_iam_policy": {resourceConverterKmsKeyRingIamPolicy()}, - "google_kms_key_ring_iam_binding": {resourceConverterKmsKeyRingIamBinding()}, - "google_kms_key_ring_iam_member": {resourceConverterKmsKeyRingIamMember()}, + "google_folder_organization_policy": {resourcemanager.ResourceConverterFolderOrgPolicy()}, + "google_kms_crypto_key_iam_policy": {kms.ResourceConverterKmsCryptoKeyIamPolicy()}, + "google_kms_crypto_key_iam_binding": {kms.ResourceConverterKmsCryptoKeyIamBinding()}, + "google_kms_crypto_key_iam_member": {kms.ResourceConverterKmsCryptoKeyIamMember()}, + "google_kms_key_ring_iam_policy": {kms.ResourceConverterKmsKeyRingIamPolicy()}, + "google_kms_key_ring_iam_binding": {kms.ResourceConverterKmsKeyRingIamBinding()}, + "google_kms_key_ring_iam_member": {kms.ResourceConverterKmsKeyRingIamMember()}, "google_project_iam_policy": {resourcemanager.ResourceConverterProjectIamPolicy()}, "google_project_iam_binding": {resourcemanager.ResourceConverterProjectIamBinding()}, "google_project_iam_member": {resourcemanager.ResourceConverterProjectIamMember()}, - "google_project_iam_custom_role": {resourceConverterProjectIAMCustomRole()}, - "google_organization_iam_custom_role": {resourceConverterOrganizationIAMCustomRole()}, + "google_project_iam_custom_role": {resourcemanager.ResourceConverterProjectIAMCustomRole()}, + "google_organization_iam_custom_role": {resourcemanager.ResourceConverterOrganizationIAMCustomRole()}, "google_vpc_access_connector": {vpcaccess.ResourceConverterVPCAccessConnector()}, "google_logging_metric": {logging.ResourceConverterLoggingMetric()}, - "google_service_account": {resourceConverterServiceAccount()}, - "google_service_account_key": {resourceConverterServiceAccountKey()}, + "google_service_account": {resourcemanager.ResourceConverterServiceAccount()}, + "google_service_account_key": {resourcemanager.ResourceConverterServiceAccountKey()}, } } diff --git a/mmv1/third_party/tgc/apikeys_key.go b/mmv1/third_party/tgc/services/apikeys/apikeys_key.go similarity index 98% rename from mmv1/third_party/tgc/apikeys_key.go rename to mmv1/third_party/tgc/services/apikeys/apikeys_key.go index 33fbb101640d..3dad5789dceb 100644 --- a/mmv1/third_party/tgc/apikeys_key.go +++ b/mmv1/third_party/tgc/services/apikeys/apikeys_key.go @@ -1,4 +1,4 @@ -package google +package apikeys import ( "reflect" @@ -10,7 +10,7 @@ import ( const ApikeysKeyAssetType string = "apikeys.googleapis.com/Key" -func resourceConverterApikeysKey() cai.ResourceConverter { +func ResourceConverterApikeysKey() cai.ResourceConverter { return cai.ResourceConverter{ AssetType: ApikeysKeyAssetType, Convert: GetApikeysKeyCaiObject, @@ -125,7 +125,7 @@ func expandApikeysKeyDeleteTime(v interface{}, d tpgresource.TerraformResourceDa } func expandApikeysKeyRestrictions(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { - + l := v.([]interface{}) if len(l) == 0 || l[0] == nil { return nil, nil @@ -203,7 +203,6 @@ func expandApikeysKeySha1Fingerprint(v interface{}, d tpgresource.TerraformResou return v, nil } - func expandApikeysKeyApiTargets(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { l := v.([]interface{}) if len(l) == 0 || l[0] == nil { @@ -235,10 +234,9 @@ func expandApikeysKeyService(v interface{}, d tpgresource.TerraformResourceData, } func expandApikeysKeyMethods(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { - return convertInterfaceToStringArray(v.([]interface{})), nil + return cai.ConvertInterfaceToStringArray(v.([]interface{})), nil } - func expandApikeysKeyDEtag(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { return v, nil } diff --git a/mmv1/third_party/tgc/appengine_application.go b/mmv1/third_party/tgc/services/appengine/appengine_application.go similarity index 96% rename from mmv1/third_party/tgc/appengine_application.go rename to mmv1/third_party/tgc/services/appengine/appengine_application.go index c64f8db8cc98..bdd9ee2c35cb 100644 --- a/mmv1/third_party/tgc/appengine_application.go +++ b/mmv1/third_party/tgc/services/appengine/appengine_application.go @@ -1,4 +1,4 @@ -package google +package appengine import ( "reflect" @@ -10,7 +10,7 @@ import ( const AppEngineApplicationAssetType string = "appengine.googleapis.com/Application" -func resourceConverterAppEngineApplication() cai.ResourceConverter { +func ResourceConverterAppEngineApplication() cai.ResourceConverter { return cai.ResourceConverter{ AssetType: AppEngineApplicationAssetType, Convert: GetAppEngineApplicationCaiObject, @@ -55,7 +55,6 @@ func GetAppEngineApplicationApiObject(d tpgresource.TerraformResourceData, confi obj["location_id"] = locationIdProp } - return obj, nil } @@ -63,7 +62,6 @@ func expandAppEngineApplicationId(v interface{}, d tpgresource.TerraformResource return v, nil } - func expandAppEngineApplicationLocationId(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { return v, nil } diff --git a/mmv1/third_party/tgc/appengine_standard_version.go b/mmv1/third_party/tgc/services/appengine/appengine_standard_version.go similarity index 99% rename from mmv1/third_party/tgc/appengine_standard_version.go rename to mmv1/third_party/tgc/services/appengine/appengine_standard_version.go index a86bfb70e97d..7d9a23685a47 100644 --- a/mmv1/third_party/tgc/appengine_standard_version.go +++ b/mmv1/third_party/tgc/services/appengine/appengine_standard_version.go @@ -1,4 +1,4 @@ -package google +package appengine import ( "reflect" @@ -12,7 +12,7 @@ import ( const AppEngineVersionAssetType string = "appengine.googleapis.com/Version" -func resourceAppEngineStandardAppVersion() cai.ResourceConverter { +func ResourceAppEngineStandardAppVersion() cai.ResourceConverter { return cai.ResourceConverter{ AssetType: AppEngineVersionAssetType, Convert: GetAppEngineVersionCaiObject, diff --git a/mmv1/third_party/tgc/bigquery_dataset_iam.go b/mmv1/third_party/tgc/services/bigquery/bigquery_dataset_iam.go similarity index 100% rename from mmv1/third_party/tgc/bigquery_dataset_iam.go rename to mmv1/third_party/tgc/services/bigquery/bigquery_dataset_iam.go diff --git a/mmv1/third_party/tgc/bigquery_table.go b/mmv1/third_party/tgc/services/bigquery/bigquery_table.go similarity index 99% rename from mmv1/third_party/tgc/bigquery_table.go rename to mmv1/third_party/tgc/services/bigquery/bigquery_table.go index 20ede57cc956..a37f4a1ccf34 100644 --- a/mmv1/third_party/tgc/bigquery_table.go +++ b/mmv1/third_party/tgc/services/bigquery/bigquery_table.go @@ -1,4 +1,4 @@ -package google +package bigquery import ( "reflect" @@ -10,7 +10,7 @@ import ( const BigQueryTableAssetType string = "bigquery.googleapis.com/Table" -func resourceConverterBigQueryTable() cai.ResourceConverter { +func ResourceConverterBigQueryTable() cai.ResourceConverter { return cai.ResourceConverter{ AssetType: BigQueryTableAssetType, Convert: GetBigQueryTableCaiObject, diff --git a/mmv1/third_party/tgc/bigtable_cluster.go b/mmv1/third_party/tgc/services/bigtable/bigtable_cluster.go similarity index 97% rename from mmv1/third_party/tgc/bigtable_cluster.go rename to mmv1/third_party/tgc/services/bigtable/bigtable_cluster.go index 99ce6e523b4b..9f31297843cf 100644 --- a/mmv1/third_party/tgc/bigtable_cluster.go +++ b/mmv1/third_party/tgc/services/bigtable/bigtable_cluster.go @@ -1,4 +1,4 @@ -package google +package bigtable import ( "reflect" @@ -8,7 +8,7 @@ import ( transport_tpg "github.com/hashicorp/terraform-provider-google-beta/google-beta/transport" ) -func resourceConverterBigtableCluster() cai.ResourceConverter { +func ResourceConverterBigtableCluster() cai.ResourceConverter { return cai.ResourceConverter{ AssetType: "bigtableadmin.googleapis.com/Cluster", Convert: GetBigtableClusterCaiObject, diff --git a/mmv1/third_party/tgc/bigtable_instance.go b/mmv1/third_party/tgc/services/bigtable/bigtable_instance.go similarity index 97% rename from mmv1/third_party/tgc/bigtable_instance.go rename to mmv1/third_party/tgc/services/bigtable/bigtable_instance.go index 6403eb378c23..fc63bb53984a 100644 --- a/mmv1/third_party/tgc/bigtable_instance.go +++ b/mmv1/third_party/tgc/services/bigtable/bigtable_instance.go @@ -1,4 +1,4 @@ -package google +package bigtable import ( "reflect" @@ -8,7 +8,7 @@ import ( transport_tpg "github.com/hashicorp/terraform-provider-google-beta/google-beta/transport" ) -func resourceConverterBigtableInstance() cai.ResourceConverter { +func ResourceConverterBigtableInstance() cai.ResourceConverter { return cai.ResourceConverter{ AssetType: "bigtableadmin.googleapis.com/Instance", Convert: GetBigtableInstanceCaiObject, diff --git a/mmv1/third_party/tgc/cloudfunctions_cloud_function.go b/mmv1/third_party/tgc/services/cloudfunctions/cloudfunctions_cloud_function.go similarity index 99% rename from mmv1/third_party/tgc/cloudfunctions_cloud_function.go rename to mmv1/third_party/tgc/services/cloudfunctions/cloudfunctions_cloud_function.go index 7e5fb205cfc8..c54d8ed57bbc 100644 --- a/mmv1/third_party/tgc/cloudfunctions_cloud_function.go +++ b/mmv1/third_party/tgc/services/cloudfunctions/cloudfunctions_cloud_function.go @@ -1,4 +1,4 @@ -package google +package cloudfunctions import ( "reflect" @@ -10,7 +10,7 @@ import ( const CloudFunctionsCloudFunctionAssetType string = "cloudfunctions.googleapis.com/CloudFunction" -func resourceConverterCloudFunctionsCloudFunction() cai.ResourceConverter { +func ResourceConverterCloudFunctionsCloudFunction() cai.ResourceConverter { return cai.ResourceConverter{ AssetType: CloudFunctionsCloudFunctionAssetType, Convert: GetCloudFunctionsCloudFunctionCaiObject, diff --git a/mmv1/third_party/tgc/cloudfunctions_function.go b/mmv1/third_party/tgc/services/cloudfunctions/cloudfunctions_function.go similarity index 99% rename from mmv1/third_party/tgc/cloudfunctions_function.go rename to mmv1/third_party/tgc/services/cloudfunctions/cloudfunctions_function.go index 1f1d917d2739..2ffb16e1d08f 100644 --- a/mmv1/third_party/tgc/cloudfunctions_function.go +++ b/mmv1/third_party/tgc/services/cloudfunctions/cloudfunctions_function.go @@ -1,4 +1,4 @@ -package google +package cloudfunctions import ( "reflect" diff --git a/mmv1/third_party/tgc/composer_environment.go b/mmv1/third_party/tgc/services/composer/composer_environment.go similarity index 99% rename from mmv1/third_party/tgc/composer_environment.go rename to mmv1/third_party/tgc/services/composer/composer_environment.go index fff555854d56..16963eefa237 100644 --- a/mmv1/third_party/tgc/composer_environment.go +++ b/mmv1/third_party/tgc/services/composer/composer_environment.go @@ -1,4 +1,4 @@ -package google +package composer import ( "reflect" @@ -11,7 +11,7 @@ import ( const ComposerEnvironmentAssetType string = "composer.googleapis.com/Environment" -func resourceConverterComposerEnvironment() cai.ResourceConverter { +func ResourceConverterComposerEnvironment() cai.ResourceConverter { return cai.ResourceConverter{ AssetType: ComposerEnvironmentAssetType, Convert: GetComposerEnvironmentCaiObject, diff --git a/mmv1/third_party/tgc/commitment.go b/mmv1/third_party/tgc/services/compute/commitment.go similarity index 99% rename from mmv1/third_party/tgc/commitment.go rename to mmv1/third_party/tgc/services/compute/commitment.go index 26bb7d47de5d..a7dc1bff682c 100644 --- a/mmv1/third_party/tgc/commitment.go +++ b/mmv1/third_party/tgc/services/compute/commitment.go @@ -1,4 +1,4 @@ -package google +package compute import ( "reflect" @@ -10,7 +10,7 @@ import ( const commitmentAssetType string = "compute.googleapis.com/Commitment" -func resourceConverterCommitment() cai.ResourceConverter { +func ResourceConverterCommitment() cai.ResourceConverter { return cai.ResourceConverter{ AssetType: commitmentAssetType, Convert: GetCommitmentCaiObject, @@ -152,14 +152,14 @@ func GetCommitmentApiObject(d tpgresource.TerraformResourceData, config *transpo } else if v, ok := d.GetOkExists("start_timestamp"); !tpgresource.IsEmptyValue(reflect.ValueOf(statusMessageProp)) && (ok || !reflect.DeepEqual(v, statusMessageProp)) { obj["startTimestamp"] = startTimestampProp } - + endTimestampProp, err := expandCommitmentEndTimestamp(d.Get("end_timestamp"), d, config) if err != nil { return nil, err } else if v, ok := d.GetOkExists("end_timestamp"); !tpgresource.IsEmptyValue(reflect.ValueOf(endTimestampProp)) && (ok || !reflect.DeepEqual(v, endTimestampProp)) { obj["endTimestamp"] = endTimestampProp } - + selfLinkProp, err := expandCommitmentSelfLink(d.Get("self_link"), d, config) if err != nil { return nil, err @@ -323,4 +323,4 @@ func expandCommitmentPlan(v interface{}, d tpgresource.TerraformResourceData, co func expandCommitmentName(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { return v, nil -} \ No newline at end of file +} diff --git a/mmv1/third_party/tgc/compute_instance.go.tmpl b/mmv1/third_party/tgc/services/compute/compute_instance.go.tmpl similarity index 100% rename from mmv1/third_party/tgc/compute_instance.go.tmpl rename to mmv1/third_party/tgc/services/compute/compute_instance.go.tmpl diff --git a/mmv1/third_party/tgc/compute_instance_group.go b/mmv1/third_party/tgc/services/compute/compute_instance_group.go similarity index 98% rename from mmv1/third_party/tgc/compute_instance_group.go rename to mmv1/third_party/tgc/services/compute/compute_instance_group.go index a7916bc32832..5d6896143ccd 100644 --- a/mmv1/third_party/tgc/compute_instance_group.go +++ b/mmv1/third_party/tgc/services/compute/compute_instance_group.go @@ -1,4 +1,4 @@ -package google +package compute import ( "reflect" @@ -10,7 +10,7 @@ import ( const ComputeInstanceGroupAssetType string = "compute.googleapis.com/InstanceGroup" -func resourceConverterComputeInstanceGroup() cai.ResourceConverter { +func ResourceConverterComputeInstanceGroup() cai.ResourceConverter { return cai.ResourceConverter{ AssetType: ComputeInstanceGroupAssetType, Convert: GetComputeInstanceGroupCaiObject, @@ -80,7 +80,7 @@ func GetComputeInstanceGroupApiObject(d tpgresource.TerraformResourceData, confi } url = url + zoneProp.(string) - obj["zone"] = url + obj["zone"] = url } selfLinkProp, err := expandComputeInstanceGroupSelfLink(d.Get("self_link"), d, config) if err != nil { @@ -152,4 +152,4 @@ func expandComputeInstanceGroupRegion(v interface{}, d tpgresource.TerraformReso func expandComputeInstanceGroupSubnetwork(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { return v, nil -} \ No newline at end of file +} diff --git a/mmv1/third_party/tgc/compute_security_policy.go b/mmv1/third_party/tgc/services/compute/compute_security_policy.go similarity index 99% rename from mmv1/third_party/tgc/compute_security_policy.go rename to mmv1/third_party/tgc/services/compute/compute_security_policy.go index 7107d175c41f..f9a1829cf2c0 100644 --- a/mmv1/third_party/tgc/compute_security_policy.go +++ b/mmv1/third_party/tgc/services/compute/compute_security_policy.go @@ -1,4 +1,4 @@ -package google +package compute import ( "reflect" @@ -11,7 +11,7 @@ import ( const ComputeSecurityPolicyAssetType string = "compute.googleapis.com/SecurityPolicy" -func resourceConverterComputeSecurityPolicy() cai.ResourceConverter { +func ResourceConverterComputeSecurityPolicy() cai.ResourceConverter { return cai.ResourceConverter{ AssetType: ComputeSecurityPolicyAssetType, Convert: GetComputeSecurityPolicyCaiObject, diff --git a/mmv1/third_party/tgc/compute_target_pool.go b/mmv1/third_party/tgc/services/compute/compute_target_pool.go similarity index 98% rename from mmv1/third_party/tgc/compute_target_pool.go rename to mmv1/third_party/tgc/services/compute/compute_target_pool.go index 60a5e28b8a8a..0174c0015586 100644 --- a/mmv1/third_party/tgc/compute_target_pool.go +++ b/mmv1/third_party/tgc/services/compute/compute_target_pool.go @@ -1,4 +1,4 @@ -package google +package compute import ( "reflect" @@ -11,7 +11,7 @@ import ( const ComputeTargetPoolAssetType string = "compute.googleapis.com/TargetPool" -func resourceConverterComputeTargetPool() cai.ResourceConverter { +func ResourceConverterComputeTargetPool() cai.ResourceConverter { return cai.ResourceConverter{ AssetType: ComputeTargetPoolAssetType, Convert: GetComputeTargetPoolCaiObject, diff --git a/mmv1/third_party/tgc/container.go b/mmv1/third_party/tgc/services/container/container.go similarity index 99% rename from mmv1/third_party/tgc/container.go rename to mmv1/third_party/tgc/services/container/container.go index 4c7caa378740..6da99c3da38f 100644 --- a/mmv1/third_party/tgc/container.go +++ b/mmv1/third_party/tgc/services/container/container.go @@ -4,7 +4,7 @@ // see https://github.com/GoogleCloudPlatform/magic-modules/pull/2485#issuecomment-545680059 // for the discussion. -package google +package container import ( "fmt" @@ -19,14 +19,14 @@ import ( const ContainerClusterAssetType string = "container.googleapis.com/Cluster" const ContainerNodePoolAssetType string = "container.googleapis.com/NodePool" -func resourceConverterContainerCluster() cai.ResourceConverter { +func ResourceConverterContainerCluster() cai.ResourceConverter { return cai.ResourceConverter{ AssetType: ContainerClusterAssetType, Convert: GetContainerClusterCaiObject, } } -func resourceConverterContainerNodePool() cai.ResourceConverter { +func ResourceConverterContainerNodePool() cai.ResourceConverter { return cai.ResourceConverter{ AssetType: ContainerNodePoolAssetType, Convert: GetContainerNodePoolCaiObject, diff --git a/mmv1/third_party/tgc/job.go b/mmv1/third_party/tgc/services/dataflow/job.go similarity index 99% rename from mmv1/third_party/tgc/job.go rename to mmv1/third_party/tgc/services/dataflow/job.go index 94cac92463cd..4675769fbbc9 100644 --- a/mmv1/third_party/tgc/job.go +++ b/mmv1/third_party/tgc/services/dataflow/job.go @@ -1,4 +1,4 @@ -package google +package dataflow import ( "reflect" @@ -10,7 +10,7 @@ import ( const DataflowJobAssetType string = "dataflow.googleapis.com/Job" -func resourceDataflowJob() cai.ResourceConverter { +func ResourceDataflowJob() cai.ResourceConverter { return cai.ResourceConverter{ AssetType: DataflowJobAssetType, Convert: GetDataflowJobCaiObject, @@ -302,4 +302,4 @@ func expandDataflowRuntimeUpdatableParams(v interface{}, d tpgresource.Terraform func expandDataflowSatisfiesPzi(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { return v, nil -} \ No newline at end of file +} diff --git a/mmv1/third_party/tgc/dataproc_cluster.go b/mmv1/third_party/tgc/services/dataproc/dataproc_cluster.go similarity index 99% rename from mmv1/third_party/tgc/dataproc_cluster.go rename to mmv1/third_party/tgc/services/dataproc/dataproc_cluster.go index e33b8134617a..5cd634a35ed0 100644 --- a/mmv1/third_party/tgc/dataproc_cluster.go +++ b/mmv1/third_party/tgc/services/dataproc/dataproc_cluster.go @@ -1,4 +1,4 @@ -package google +package dataproc import ( "reflect" @@ -11,7 +11,7 @@ import ( const DataprocClusterAssetType string = "dataproc.googleapis.com/Cluster" -func resourceConverterDataprocCluster() cai.ResourceConverter { +func ResourceConverterDataprocCluster() cai.ResourceConverter { return cai.ResourceConverter{ AssetType: DataprocClusterAssetType, Convert: GetDataprocClusterCaiObject, diff --git a/mmv1/third_party/tgc/firebase_project.go b/mmv1/third_party/tgc/services/firebase/firebase_project.go similarity index 97% rename from mmv1/third_party/tgc/firebase_project.go rename to mmv1/third_party/tgc/services/firebase/firebase_project.go index 28b469278020..7e553f6f0e93 100644 --- a/mmv1/third_party/tgc/firebase_project.go +++ b/mmv1/third_party/tgc/services/firebase/firebase_project.go @@ -1,4 +1,4 @@ -package google +package firebase import ( "reflect" @@ -10,7 +10,7 @@ import ( const firebaseProjectAssetType string = "firebase.googleapis.com/FirebaseProject" -func resourceConverterFirebaseProject() cai.ResourceConverter { +func ResourceConverterFirebaseProject() cai.ResourceConverter { return cai.ResourceConverter{ AssetType: firebaseProjectAssetType, Convert: GetFirebaseProjectCaiObject, @@ -40,7 +40,7 @@ func GetFirebaseProjectCaiObject(d tpgresource.TerraformResourceData, config *tr func GetFirebaseProjectApiObject(d tpgresource.TerraformResourceData, config *transport_tpg.Config) (map[string]interface{}, error) { obj := make(map[string]interface{}) - + nameProp, err := expandFirebaseProjectName(d.Get("name"), d, config) if err != nil { return nil, err @@ -102,4 +102,4 @@ func expandFirebaseProjectProjectId(v interface{}, d tpgresource.TerraformResour func expandFirebaseProjectName(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) { return v, nil -} \ No newline at end of file +} diff --git a/mmv1/third_party/tgc/kms_crypto_key_iam.go b/mmv1/third_party/tgc/services/kms/kms_crypto_key_iam.go similarity index 95% rename from mmv1/third_party/tgc/kms_crypto_key_iam.go rename to mmv1/third_party/tgc/services/kms/kms_crypto_key_iam.go index 201cef86cfc5..2690a120e94d 100644 --- a/mmv1/third_party/tgc/kms_crypto_key_iam.go +++ b/mmv1/third_party/tgc/services/kms/kms_crypto_key_iam.go @@ -1,4 +1,4 @@ -package google +package kms import ( "fmt" @@ -10,7 +10,7 @@ import ( transport_tpg "github.com/hashicorp/terraform-provider-google-beta/google-beta/transport" ) -func resourceConverterKmsCryptoKeyIamPolicy() cai.ResourceConverter { +func ResourceConverterKmsCryptoKeyIamPolicy() cai.ResourceConverter { return cai.ResourceConverter{ AssetType: "cloudkms.googleapis.com/CryptoKey", Convert: GetKmsCryptoKeyIamPolicyCaiObject, @@ -18,7 +18,7 @@ func resourceConverterKmsCryptoKeyIamPolicy() cai.ResourceConverter { } } -func resourceConverterKmsCryptoKeyIamBinding() cai.ResourceConverter { +func ResourceConverterKmsCryptoKeyIamBinding() cai.ResourceConverter { return cai.ResourceConverter{ AssetType: "cloudkms.googleapis.com/CryptoKey", Convert: GetKmsCryptoKeyIamBindingCaiObject, @@ -28,7 +28,7 @@ func resourceConverterKmsCryptoKeyIamBinding() cai.ResourceConverter { } } -func resourceConverterKmsCryptoKeyIamMember() cai.ResourceConverter { +func ResourceConverterKmsCryptoKeyIamMember() cai.ResourceConverter { return cai.ResourceConverter{ AssetType: "cloudkms.googleapis.com/CryptoKey", Convert: GetKmsCryptoKeyIamMemberCaiObject, diff --git a/mmv1/third_party/tgc/kms_key_ring_iam.go b/mmv1/third_party/tgc/services/kms/kms_key_ring_iam.go similarity index 95% rename from mmv1/third_party/tgc/kms_key_ring_iam.go rename to mmv1/third_party/tgc/services/kms/kms_key_ring_iam.go index 57404f81445c..6197ed499a99 100644 --- a/mmv1/third_party/tgc/kms_key_ring_iam.go +++ b/mmv1/third_party/tgc/services/kms/kms_key_ring_iam.go @@ -1,4 +1,4 @@ -package google +package kms import ( "fmt" @@ -10,7 +10,7 @@ import ( transport_tpg "github.com/hashicorp/terraform-provider-google-beta/google-beta/transport" ) -func resourceConverterKmsKeyRingIamPolicy() cai.ResourceConverter { +func ResourceConverterKmsKeyRingIamPolicy() cai.ResourceConverter { return cai.ResourceConverter{ AssetType: "cloudkms.googleapis.com/KeyRing", Convert: GetKmsKeyRingIamPolicyCaiObject, @@ -18,7 +18,7 @@ func resourceConverterKmsKeyRingIamPolicy() cai.ResourceConverter { } } -func resourceConverterKmsKeyRingIamBinding() cai.ResourceConverter { +func ResourceConverterKmsKeyRingIamBinding() cai.ResourceConverter { return cai.ResourceConverter{ AssetType: "cloudkms.googleapis.com/KeyRing", Convert: GetKmsKeyRingIamBindingCaiObject, @@ -28,7 +28,7 @@ func resourceConverterKmsKeyRingIamBinding() cai.ResourceConverter { } } -func resourceConverterKmsKeyRingIamMember() cai.ResourceConverter { +func ResourceConverterKmsKeyRingIamMember() cai.ResourceConverter { return cai.ResourceConverter{ AssetType: "cloudkms.googleapis.com/KeyRing", Convert: GetKmsKeyRingIamMemberCaiObject, diff --git a/mmv1/third_party/tgc/logging_billing_account_bucket_config.go b/mmv1/third_party/tgc/services/logging/logging_billing_account_bucket_config.go similarity index 98% rename from mmv1/third_party/tgc/logging_billing_account_bucket_config.go rename to mmv1/third_party/tgc/services/logging/logging_billing_account_bucket_config.go index 741e11a59bb5..6a1dae39b162 100644 --- a/mmv1/third_party/tgc/logging_billing_account_bucket_config.go +++ b/mmv1/third_party/tgc/services/logging/logging_billing_account_bucket_config.go @@ -1,4 +1,4 @@ -package google +package logging import ( "reflect" @@ -12,7 +12,7 @@ import ( const logBillingAccountBucketAssetType string = "logging.googleapis.com/LogBucket" -func resourceConverterLogBillingAccountBucket() cai.ResourceConverter { +func ResourceConverterLogBillingAccountBucket() cai.ResourceConverter { return cai.ResourceConverter{ AssetType: logBillingAccountBucketAssetType, Convert: GetLogBillingAccountBucketCaiObject, diff --git a/mmv1/third_party/tgc/logging_folder_bucket_config.go b/mmv1/third_party/tgc/services/logging/logging_folder_bucket_config.go similarity index 98% rename from mmv1/third_party/tgc/logging_folder_bucket_config.go rename to mmv1/third_party/tgc/services/logging/logging_folder_bucket_config.go index 564fc2555c9c..b2c0e2703069 100644 --- a/mmv1/third_party/tgc/logging_folder_bucket_config.go +++ b/mmv1/third_party/tgc/services/logging/logging_folder_bucket_config.go @@ -1,4 +1,4 @@ -package google +package logging import ( "reflect" @@ -12,7 +12,7 @@ import ( const logFolderBucketAssetType string = "logging.googleapis.com/LogBucket" -func resourceConverterLogFolderBucket() cai.ResourceConverter { +func ResourceConverterLogFolderBucket() cai.ResourceConverter { return cai.ResourceConverter{ AssetType: logFolderBucketAssetType, Convert: GetLogFolderBucketCaiObject, diff --git a/mmv1/third_party/tgc/logging_organization_bucket_config.go b/mmv1/third_party/tgc/services/logging/logging_organization_bucket_config.go similarity index 98% rename from mmv1/third_party/tgc/logging_organization_bucket_config.go rename to mmv1/third_party/tgc/services/logging/logging_organization_bucket_config.go index c617d961665d..a4de258d99fe 100644 --- a/mmv1/third_party/tgc/logging_organization_bucket_config.go +++ b/mmv1/third_party/tgc/services/logging/logging_organization_bucket_config.go @@ -1,4 +1,4 @@ -package google +package logging import ( "reflect" @@ -12,7 +12,7 @@ import ( const logOrganizationBucketAssetType string = "logging.googleapis.com/LogBucket" -func resourceConverterLogOrganizationBucket() cai.ResourceConverter { +func ResourceConverterLogOrganizationBucket() cai.ResourceConverter { return cai.ResourceConverter{ AssetType: logOrganizationBucketAssetType, Convert: GetLogOrganizationBucketCaiObject, diff --git a/mmv1/third_party/tgc/logging_project_bucket_config.go b/mmv1/third_party/tgc/services/logging/logging_project_bucket_config.go similarity index 98% rename from mmv1/third_party/tgc/logging_project_bucket_config.go rename to mmv1/third_party/tgc/services/logging/logging_project_bucket_config.go index 77e96884a679..6db9b4fee0d7 100644 --- a/mmv1/third_party/tgc/logging_project_bucket_config.go +++ b/mmv1/third_party/tgc/services/logging/logging_project_bucket_config.go @@ -1,4 +1,4 @@ -package google +package logging import ( "reflect" @@ -12,7 +12,7 @@ import ( const logProjectBucketAssetType string = "logging.googleapis.com/LogBucket" -func resourceConverterLogProjectBucket() cai.ResourceConverter { +func ResourceConverterLogProjectBucket() cai.ResourceConverter { return cai.ResourceConverter{ AssetType: logProjectBucketAssetType, Convert: GetLogProjectBucketCaiObject, diff --git a/mmv1/third_party/tgc/monitoring_slo_helper.go b/mmv1/third_party/tgc/services/monitoring/monitoring_slo_helper.go similarity index 100% rename from mmv1/third_party/tgc/monitoring_slo_helper.go rename to mmv1/third_party/tgc/services/monitoring/monitoring_slo_helper.go diff --git a/mmv1/third_party/tgc/pubsub_subscription_iam.go b/mmv1/third_party/tgc/services/pubsub/pubsub_subscription_iam.go similarity index 100% rename from mmv1/third_party/tgc/pubsub_subscription_iam.go rename to mmv1/third_party/tgc/services/pubsub/pubsub_subscription_iam.go diff --git a/mmv1/third_party/tgc/folder.go b/mmv1/third_party/tgc/services/resourcemanager/folder.go similarity index 95% rename from mmv1/third_party/tgc/folder.go rename to mmv1/third_party/tgc/services/resourcemanager/folder.go index cdcf1b5644ba..3dd43c056b6f 100644 --- a/mmv1/third_party/tgc/folder.go +++ b/mmv1/third_party/tgc/services/resourcemanager/folder.go @@ -1,4 +1,4 @@ -package google +package resourcemanager import ( "time" @@ -8,7 +8,7 @@ import ( transport_tpg "github.com/hashicorp/terraform-provider-google-beta/google-beta/transport" ) -func resourceConverterFolder() cai.ResourceConverter { +func ResourceConverterFolder() cai.ResourceConverter { return cai.ResourceConverter{ AssetType: "cloudresourcemanager.googleapis.com/Folder", Convert: GetFolderCaiObject, diff --git a/mmv1/third_party/tgc/folder_iam.go b/mmv1/third_party/tgc/services/resourcemanager/folder_iam.go similarity index 100% rename from mmv1/third_party/tgc/folder_iam.go rename to mmv1/third_party/tgc/services/resourcemanager/folder_iam.go diff --git a/mmv1/third_party/tgc/folder_organization_policy.go b/mmv1/third_party/tgc/services/resourcemanager/folder_organization_policy.go similarity index 95% rename from mmv1/third_party/tgc/folder_organization_policy.go rename to mmv1/third_party/tgc/services/resourcemanager/folder_organization_policy.go index 275743e35f47..16a50cefe6b4 100644 --- a/mmv1/third_party/tgc/folder_organization_policy.go +++ b/mmv1/third_party/tgc/services/resourcemanager/folder_organization_policy.go @@ -1,4 +1,4 @@ -package google +package resourcemanager import ( "github.com/GoogleCloudPlatform/terraform-google-conversion/v5/tfplan2cai/converters/google/resources/cai" @@ -6,7 +6,7 @@ import ( transport_tpg "github.com/hashicorp/terraform-provider-google-beta/google-beta/transport" ) -func resourceConverterFolderOrgPolicy() cai.ResourceConverter { +func ResourceConverterFolderOrgPolicy() cai.ResourceConverter { return cai.ResourceConverter{ AssetType: "cloudresourcemanager.googleapis.com/Folder", Convert: GetFolderOrgPolicyCaiObject, diff --git a/mmv1/third_party/tgc/org_policy_policy.go b/mmv1/third_party/tgc/services/resourcemanager/org_policy_policy.go similarity index 91% rename from mmv1/third_party/tgc/org_policy_policy.go rename to mmv1/third_party/tgc/services/resourcemanager/org_policy_policy.go index bf14d9a52050..26773f65a4b0 100644 --- a/mmv1/third_party/tgc/org_policy_policy.go +++ b/mmv1/third_party/tgc/services/resourcemanager/org_policy_policy.go @@ -1,4 +1,4 @@ -package google +package resourcemanager import ( "fmt" @@ -9,7 +9,7 @@ import ( transport_tpg "github.com/hashicorp/terraform-provider-google-beta/google-beta/transport" ) -func resourceConverterOrgPolicyPolicy() cai.ResourceConverter { +func ResourceConverterOrgPolicyPolicy() cai.ResourceConverter { return cai.ResourceConverter{ Convert: GetV2OrgPoliciesCaiObject, MergeCreateUpdate: MergeV2OrgPolicies, @@ -150,8 +150,8 @@ func expandValuesPolicyRule(configured []interface{}) (*cai.StringValues, error) } valuesMap := configured[0].(map[string]interface{}) return &cai.StringValues{ - AllowedValues: convertInterfaceToStringArray(valuesMap["allowed_values"].([]interface{})), - DeniedValues: convertInterfaceToStringArray(valuesMap["denied_values"].([]interface{})), + AllowedValues: cai.ConvertInterfaceToStringArray(valuesMap["allowed_values"].([]interface{})), + DeniedValues: cai.ConvertInterfaceToStringArray(valuesMap["denied_values"].([]interface{})), }, nil } @@ -177,11 +177,3 @@ func convertStringToBool(val string) (bool, error) { return false, fmt.Errorf("Invalid value for a boolean field: %s", val) } - -func convertInterfaceToStringArray(values []interface{}) []string { - stringArray := make([]string, len(values)) - for i, v := range values { - stringArray[i] = v.(string) - } - return stringArray -} diff --git a/mmv1/third_party/tgc/organization_iam.go b/mmv1/third_party/tgc/services/resourcemanager/organization_iam.go similarity index 100% rename from mmv1/third_party/tgc/organization_iam.go rename to mmv1/third_party/tgc/services/resourcemanager/organization_iam.go diff --git a/mmv1/third_party/tgc/organization_iam_custom_role.go b/mmv1/third_party/tgc/services/resourcemanager/organization_iam_custom_role.go similarity index 97% rename from mmv1/third_party/tgc/organization_iam_custom_role.go rename to mmv1/third_party/tgc/services/resourcemanager/organization_iam_custom_role.go index 439975955708..65bab3d118f7 100644 --- a/mmv1/third_party/tgc/organization_iam_custom_role.go +++ b/mmv1/third_party/tgc/services/resourcemanager/organization_iam_custom_role.go @@ -1,4 +1,4 @@ -package google +package resourcemanager import ( "reflect" @@ -11,7 +11,7 @@ import ( const OrganizationIAMCustomRoleAssetType string = "iam.googleapis.com/Role" -func resourceConverterOrganizationIAMCustomRole() cai.ResourceConverter { +func ResourceConverterOrganizationIAMCustomRole() cai.ResourceConverter { return cai.ResourceConverter{ AssetType: OrganizationIAMCustomRoleAssetType, Convert: GetOrganizationIAMCustomRoleCaiObject, diff --git a/mmv1/third_party/tgc/organization_policy.go b/mmv1/third_party/tgc/services/resourcemanager/organization_policy.go similarity index 95% rename from mmv1/third_party/tgc/organization_policy.go rename to mmv1/third_party/tgc/services/resourcemanager/organization_policy.go index 123689001755..0d894cc1367d 100644 --- a/mmv1/third_party/tgc/organization_policy.go +++ b/mmv1/third_party/tgc/services/resourcemanager/organization_policy.go @@ -1,4 +1,4 @@ -package google +package resourcemanager import ( "github.com/GoogleCloudPlatform/terraform-google-conversion/v5/tfplan2cai/converters/google/resources/cai" @@ -6,7 +6,7 @@ import ( transport_tpg "github.com/hashicorp/terraform-provider-google-beta/google-beta/transport" ) -func resourceConverterOrganizationPolicy() cai.ResourceConverter { +func ResourceConverterOrganizationPolicy() cai.ResourceConverter { return cai.ResourceConverter{ AssetType: "cloudresourcemanager.googleapis.com/Organization", Convert: GetOrganizationPolicyCaiObject, diff --git a/mmv1/third_party/tgc/project.go b/mmv1/third_party/tgc/services/resourcemanager/project.go similarity index 96% rename from mmv1/third_party/tgc/project.go rename to mmv1/third_party/tgc/services/resourcemanager/project.go index 9f33a8a95d8d..c43fc4426bd6 100644 --- a/mmv1/third_party/tgc/project.go +++ b/mmv1/third_party/tgc/services/resourcemanager/project.go @@ -1,4 +1,4 @@ -package google +package resourcemanager import ( "fmt" @@ -11,7 +11,7 @@ import ( "google.golang.org/api/cloudresourcemanager/v1" ) -func resourceConverterProject() cai.ResourceConverter { +func ResourceConverterProject() cai.ResourceConverter { return cai.ResourceConverter{ AssetType: "cloudresourcemanager.googleapis.com/Project", Convert: GetProjectCaiObject, @@ -19,7 +19,7 @@ func resourceConverterProject() cai.ResourceConverter { } } -func resourceConverterProjectBillingInfo() cai.ResourceConverter { +func ResourceConverterProjectBillingInfo() cai.ResourceConverter { return cai.ResourceConverter{ AssetType: "cloudbilling.googleapis.com/ProjectBillingInfo", Convert: GetProjectBillingInfoCaiObject, diff --git a/mmv1/third_party/tgc/project_iam.go b/mmv1/third_party/tgc/services/resourcemanager/project_iam.go similarity index 100% rename from mmv1/third_party/tgc/project_iam.go rename to mmv1/third_party/tgc/services/resourcemanager/project_iam.go diff --git a/mmv1/third_party/tgc/project_iam_custom_role.go b/mmv1/third_party/tgc/services/resourcemanager/project_iam_custom_role.go similarity index 97% rename from mmv1/third_party/tgc/project_iam_custom_role.go rename to mmv1/third_party/tgc/services/resourcemanager/project_iam_custom_role.go index e16bbcc15dc7..21188a195512 100644 --- a/mmv1/third_party/tgc/project_iam_custom_role.go +++ b/mmv1/third_party/tgc/services/resourcemanager/project_iam_custom_role.go @@ -1,4 +1,4 @@ -package google +package resourcemanager import ( "reflect" @@ -11,7 +11,7 @@ import ( const ProjectIAMCustomRoleAssetType string = "iam.googleapis.com/Role" -func resourceConverterProjectIAMCustomRole() cai.ResourceConverter { +func ResourceConverterProjectIAMCustomRole() cai.ResourceConverter { return cai.ResourceConverter{ AssetType: ProjectIAMCustomRoleAssetType, Convert: GetProjectIAMCustomRoleCaiObject, diff --git a/mmv1/third_party/tgc/project_organization_policy.go b/mmv1/third_party/tgc/services/resourcemanager/project_organization_policy.go similarity index 97% rename from mmv1/third_party/tgc/project_organization_policy.go rename to mmv1/third_party/tgc/services/resourcemanager/project_organization_policy.go index 16a9b73f7568..a9f14545f7da 100644 --- a/mmv1/third_party/tgc/project_organization_policy.go +++ b/mmv1/third_party/tgc/services/resourcemanager/project_organization_policy.go @@ -1,4 +1,4 @@ -package google +package resourcemanager import ( "fmt" @@ -10,7 +10,7 @@ import ( transport_tpg "github.com/hashicorp/terraform-provider-google-beta/google-beta/transport" ) -func resourceConverterProjectOrgPolicy() cai.ResourceConverter { +func ResourceConverterProjectOrgPolicy() cai.ResourceConverter { return cai.ResourceConverter{ AssetType: "cloudresourcemanager.googleapis.com/Project", Convert: GetProjectOrgPolicyCaiObject, diff --git a/mmv1/third_party/tgc/project_service.go b/mmv1/third_party/tgc/services/resourcemanager/project_service.go similarity index 96% rename from mmv1/third_party/tgc/project_service.go rename to mmv1/third_party/tgc/services/resourcemanager/project_service.go index 50eeae0ba462..8babed065d8f 100644 --- a/mmv1/third_party/tgc/project_service.go +++ b/mmv1/third_party/tgc/services/resourcemanager/project_service.go @@ -1,4 +1,4 @@ -package google +package resourcemanager import ( "fmt" @@ -11,7 +11,7 @@ import ( const ServiceUsageAssetType string = "serviceusage.googleapis.com/Service" -func resourceConverterServiceUsage() cai.ResourceConverter { +func ResourceConverterServiceUsage() cai.ResourceConverter { return cai.ResourceConverter{ AssetType: ServiceUsageAssetType, Convert: GetServiceUsageCaiObject, diff --git a/mmv1/third_party/tgc/project_service_test.go b/mmv1/third_party/tgc/services/resourcemanager/project_service_test.go similarity index 99% rename from mmv1/third_party/tgc/project_service_test.go rename to mmv1/third_party/tgc/services/resourcemanager/project_service_test.go index 0b4e9957ae53..4b87b25f78eb 100644 --- a/mmv1/third_party/tgc/project_service_test.go +++ b/mmv1/third_party/tgc/services/resourcemanager/project_service_test.go @@ -1,4 +1,4 @@ -package google +package resourcemanager import ( "testing" diff --git a/mmv1/third_party/tgc/service_account.go b/mmv1/third_party/tgc/services/resourcemanager/service_account.go similarity index 98% rename from mmv1/third_party/tgc/service_account.go rename to mmv1/third_party/tgc/services/resourcemanager/service_account.go index b9cc14038515..d3f7509ee184 100644 --- a/mmv1/third_party/tgc/service_account.go +++ b/mmv1/third_party/tgc/services/resourcemanager/service_account.go @@ -1,4 +1,4 @@ -package google +package resourcemanager import ( "fmt" @@ -11,7 +11,7 @@ import ( const ServiceAccountAssetType string = "iam.googleapis.com/ServiceAccount" -func resourceConverterServiceAccount() cai.ResourceConverter { +func ResourceConverterServiceAccount() cai.ResourceConverter { return cai.ResourceConverter{ AssetType: ServiceAccountAssetType, Convert: GetServiceAccountCaiObject, diff --git a/mmv1/third_party/tgc/service_account_key.go b/mmv1/third_party/tgc/services/resourcemanager/service_account_key.go similarity index 99% rename from mmv1/third_party/tgc/service_account_key.go rename to mmv1/third_party/tgc/services/resourcemanager/service_account_key.go index c62b3b14f8a3..7835ea49dcc0 100644 --- a/mmv1/third_party/tgc/service_account_key.go +++ b/mmv1/third_party/tgc/services/resourcemanager/service_account_key.go @@ -1,4 +1,4 @@ -package google +package resourcemanager import ( "reflect" @@ -10,7 +10,7 @@ import ( const ServiceAccountKeyAssetType string = "iam.googleapis.com/ServiceAccountKey" -func resourceConverterServiceAccountKey() cai.ResourceConverter { +func ResourceConverterServiceAccountKey() cai.ResourceConverter { return cai.ResourceConverter{ AssetType: ServiceAccountKeyAssetType, Convert: GetServiceAccountKeyCaiObject, diff --git a/mmv1/third_party/tgc/spanner_database_iam.go b/mmv1/third_party/tgc/services/spanner/spanner_database_iam.go similarity index 100% rename from mmv1/third_party/tgc/spanner_database_iam.go rename to mmv1/third_party/tgc/services/spanner/spanner_database_iam.go diff --git a/mmv1/third_party/tgc/spanner_instance_iam.go b/mmv1/third_party/tgc/services/spanner/spanner_instance_iam.go similarity index 100% rename from mmv1/third_party/tgc/spanner_instance_iam.go rename to mmv1/third_party/tgc/services/spanner/spanner_instance_iam.go diff --git a/mmv1/third_party/tgc/sql_database_instance.go b/mmv1/third_party/tgc/services/sql/sql_database_instance.go similarity index 99% rename from mmv1/third_party/tgc/sql_database_instance.go rename to mmv1/third_party/tgc/services/sql/sql_database_instance.go index 3903b31f2c98..baeccda26768 100644 --- a/mmv1/third_party/tgc/sql_database_instance.go +++ b/mmv1/third_party/tgc/services/sql/sql_database_instance.go @@ -6,7 +6,7 @@ // third_party/terraform/resources/resource_sql_database_instance.go.erb.go // // ---------------------------------------------------------------------------- -package google +package sql import ( "regexp" @@ -22,7 +22,7 @@ import ( const SQLDatabaseInstanceAssetType string = "sqladmin.googleapis.com/Instance" -func resourceConverterSQLDatabaseInstance() cai.ResourceConverter { +func ResourceConverterSQLDatabaseInstance() cai.ResourceConverter { return cai.ResourceConverter{ AssetType: SQLDatabaseInstanceAssetType, Convert: GetSQLDatabaseInstanceCaiObject, diff --git a/mmv1/third_party/tgc/iam_storage_bucket.go b/mmv1/third_party/tgc/services/storage/iam_storage_bucket.go similarity index 99% rename from mmv1/third_party/tgc/iam_storage_bucket.go rename to mmv1/third_party/tgc/services/storage/iam_storage_bucket.go index 44b1ce92a569..57258ff0466d 100644 --- a/mmv1/third_party/tgc/iam_storage_bucket.go +++ b/mmv1/third_party/tgc/services/storage/iam_storage_bucket.go @@ -1,4 +1,4 @@ -package google +package storage import ( "fmt" diff --git a/mmv1/third_party/tgc/storage_bucket.go b/mmv1/third_party/tgc/services/storage/storage_bucket.go similarity index 99% rename from mmv1/third_party/tgc/storage_bucket.go rename to mmv1/third_party/tgc/services/storage/storage_bucket.go index 1bacf205a812..3bd3f4ae4b53 100644 --- a/mmv1/third_party/tgc/storage_bucket.go +++ b/mmv1/third_party/tgc/services/storage/storage_bucket.go @@ -6,7 +6,7 @@ // third_party/terraform/resources/resource_storage_bucket.go // // ---------------------------------------------------------------------------- -package google +package storage import ( "fmt" @@ -21,7 +21,7 @@ import ( const StorageBucketAssetType string = "storage.googleapis.com/Bucket" -func resourceConverterStorageBucket() cai.ResourceConverter { +func ResourceConverterStorageBucket() cai.ResourceConverter { return cai.ResourceConverter{ AssetType: StorageBucketAssetType, Convert: GetStorageBucketCaiObject, diff --git a/mmv1/third_party/tgc/storage_bucket_iam.go b/mmv1/third_party/tgc/services/storage/storage_bucket_iam.go similarity index 94% rename from mmv1/third_party/tgc/storage_bucket_iam.go rename to mmv1/third_party/tgc/services/storage/storage_bucket_iam.go index f88e54c5d908..6ced5b8c67d9 100644 --- a/mmv1/third_party/tgc/storage_bucket_iam.go +++ b/mmv1/third_party/tgc/services/storage/storage_bucket_iam.go @@ -1,4 +1,4 @@ -package google +package storage import ( "fmt" @@ -11,7 +11,7 @@ import ( // Provide a separate asset type constant so we don't have to worry about name conflicts between IAM and non-IAM converter files const StorageBucketIAMAssetType string = "storage.googleapis.com/Bucket" -func resourceConverterStorageBucketIamPolicy() cai.ResourceConverter { +func ResourceConverterStorageBucketIamPolicy() cai.ResourceConverter { return cai.ResourceConverter{ AssetType: StorageBucketIAMAssetType, Convert: GetStorageBucketIamPolicyCaiObject, @@ -19,7 +19,7 @@ func resourceConverterStorageBucketIamPolicy() cai.ResourceConverter { } } -func resourceConverterStorageBucketIamBinding() cai.ResourceConverter { +func ResourceConverterStorageBucketIamBinding() cai.ResourceConverter { return cai.ResourceConverter{ AssetType: StorageBucketIAMAssetType, Convert: GetStorageBucketIamBindingCaiObject, @@ -29,7 +29,7 @@ func resourceConverterStorageBucketIamBinding() cai.ResourceConverter { } } -func resourceConverterStorageBucketIamMember() cai.ResourceConverter { +func ResourceConverterStorageBucketIamMember() cai.ResourceConverter { return cai.ResourceConverter{ AssetType: StorageBucketIAMAssetType, Convert: GetStorageBucketIamMemberCaiObject,