diff --git a/google/provider.go b/google/provider.go index 890c91b89a2..3b21fa1a7fd 100644 --- a/google/provider.go +++ b/google/provider.go @@ -93,130 +93,127 @@ func Provider() terraform.ResourceProvider { "google_compute_backend_service": dataSourceGoogleComputeBackendService(), }, - ResourcesMap: map[string]*schema.Resource{ - "google_bigquery_dataset": resourceBigQueryDataset(), - "google_bigquery_table": resourceBigQueryTable(), - "google_bigtable_instance": resourceBigtableInstance(), - "google_bigtable_table": resourceBigtableTable(), - "google_cloudfunctions_function": resourceCloudFunctionsFunction(), - "google_cloudiot_registry": resourceCloudIoTRegistry(), - "google_compute_autoscaler": resourceComputeAutoscaler(), - "google_compute_address": resourceComputeAddress(), - "google_compute_backend_bucket": resourceComputeBackendBucket(), - "google_compute_backend_service": resourceComputeBackendService(), - "google_compute_disk": resourceComputeDisk(), - "google_compute_snapshot": resourceComputeSnapshot(), - "google_compute_firewall": resourceComputeFirewall(), - "google_compute_forwarding_rule": resourceComputeForwardingRule(), - "google_compute_global_address": resourceComputeGlobalAddress(), - "google_compute_global_forwarding_rule": resourceComputeGlobalForwardingRule(), - "google_compute_health_check": resourceComputeHealthCheck(), - "google_compute_http_health_check": resourceComputeHttpHealthCheck(), - "google_compute_https_health_check": resourceComputeHttpsHealthCheck(), - "google_compute_image": resourceComputeImage(), - "google_compute_instance": resourceComputeInstance(), - "google_compute_instance_group": resourceComputeInstanceGroup(), - "google_compute_instance_group_manager": resourceComputeInstanceGroupManager(), - "google_compute_instance_template": resourceComputeInstanceTemplate(), - "google_compute_network": resourceComputeNetwork(), - "google_compute_network_peering": resourceComputeNetworkPeering(), - "google_compute_project_metadata": resourceComputeProjectMetadata(), - "google_compute_project_metadata_item": resourceComputeProjectMetadataItem(), - "google_compute_region_autoscaler": resourceComputeRegionAutoscaler(), - "google_compute_region_backend_service": resourceComputeRegionBackendService(), - "google_compute_region_instance_group_manager": resourceComputeRegionInstanceGroupManager(), - "google_compute_route": resourceComputeRoute(), - "google_compute_router": resourceComputeRouter(), - "google_compute_router_interface": resourceComputeRouterInterface(), - "google_compute_router_peer": resourceComputeRouterPeer(), - "google_compute_security_policy": resourceComputeSecurityPolicy(), - "google_compute_shared_vpc_host_project": resourceComputeSharedVpcHostProject(), - "google_compute_shared_vpc_service_project": resourceComputeSharedVpcServiceProject(), - "google_compute_ssl_certificate": resourceComputeSslCertificate(), - "google_compute_ssl_policy": resourceComputeSslPolicy(), - "google_compute_subnetwork": resourceComputeSubnetwork(), - "google_compute_subnetwork_iam_binding": ResourceIamBindingWithImport(IamComputeSubnetworkSchema, NewComputeSubnetworkIamUpdater, ComputeSubnetworkIdParseFunc), - "google_compute_subnetwork_iam_member": ResourceIamMemberWithImport(IamComputeSubnetworkSchema, NewComputeSubnetworkIamUpdater, ComputeSubnetworkIdParseFunc), - "google_compute_subnetwork_iam_policy": ResourceIamPolicyWithImport(IamComputeSubnetworkSchema, NewComputeSubnetworkIamUpdater, ComputeSubnetworkIdParseFunc), - "google_compute_target_http_proxy": resourceComputeTargetHttpProxy(), - "google_compute_target_https_proxy": resourceComputeTargetHttpsProxy(), - "google_compute_target_tcp_proxy": resourceComputeTargetTcpProxy(), - "google_compute_target_ssl_proxy": resourceComputeTargetSslProxy(), - "google_compute_target_pool": resourceComputeTargetPool(), - "google_compute_url_map": resourceComputeUrlMap(), - "google_compute_vpn_gateway": resourceComputeVpnGateway(), - "google_compute_vpn_tunnel": resourceComputeVpnTunnel(), - "google_container_cluster": resourceContainerCluster(), - "google_container_node_pool": resourceContainerNodePool(), - "google_dataflow_job": resourceDataflowJob(), - "google_dataproc_cluster": resourceDataprocCluster(), - "google_dataproc_job": resourceDataprocJob(), - "google_dns_managed_zone": resourceDnsManagedZone(), - "google_dns_record_set": resourceDnsRecordSet(), - "google_endpoints_service": resourceEndpointsService(), - "google_folder": resourceGoogleFolder(), - "google_folder_iam_binding": ResourceIamBindingWithImport(IamFolderSchema, NewFolderIamUpdater, FolderIdParseFunc), - "google_folder_iam_member": ResourceIamMemberWithImport(IamFolderSchema, NewFolderIamUpdater, FolderIdParseFunc), - "google_folder_iam_policy": ResourceIamPolicyWithImport(IamFolderSchema, NewFolderIamUpdater, FolderIdParseFunc), - "google_folder_organization_policy": resourceGoogleFolderOrganizationPolicy(), - "google_logging_billing_account_sink": resourceLoggingBillingAccountSink(), - "google_logging_organization_sink": resourceLoggingOrganizationSink(), - "google_logging_folder_sink": resourceLoggingFolderSink(), - "google_logging_project_sink": resourceLoggingProjectSink(), - "google_kms_key_ring": resourceKmsKeyRing(), - "google_kms_key_ring_iam_binding": ResourceIamBindingWithImport(IamKmsKeyRingSchema, NewKmsKeyRingIamUpdater, KeyRingIdParseFunc), - "google_kms_key_ring_iam_member": ResourceIamMemberWithImport(IamKmsKeyRingSchema, NewKmsKeyRingIamUpdater, KeyRingIdParseFunc), - "google_kms_key_ring_iam_policy": ResourceIamPolicyWithImport(IamKmsKeyRingSchema, NewKmsKeyRingIamUpdater, KeyRingIdParseFunc), - "google_kms_crypto_key": resourceKmsCryptoKey(), - "google_kms_crypto_key_iam_binding": ResourceIamBindingWithImport(IamKmsCryptoKeySchema, NewKmsCryptoKeyIamUpdater, CryptoIdParseFunc), - "google_kms_crypto_key_iam_member": ResourceIamMemberWithImport(IamKmsCryptoKeySchema, NewKmsCryptoKeyIamUpdater, CryptoIdParseFunc), - "google_sourcerepo_repository": resourceSourceRepoRepository(), - "google_spanner_instance": resourceSpannerInstance(), - "google_spanner_database": resourceSpannerDatabase(), - "google_sql_database": resourceSqlDatabase(), - "google_sql_database_instance": resourceSqlDatabaseInstance(), - "google_sql_user": resourceSqlUser(), - "google_organization_iam_binding": ResourceIamBindingWithImport(IamOrganizationSchema, NewOrganizationIamUpdater, OrgIdParseFunc), - "google_organization_iam_custom_role": resourceGoogleOrganizationIamCustomRole(), - "google_organization_iam_member": ResourceIamMemberWithImport(IamOrganizationSchema, NewOrganizationIamUpdater, OrgIdParseFunc), - "google_organization_iam_policy": ResourceIamPolicyWithImport(IamOrganizationSchema, NewOrganizationIamUpdater, OrgIdParseFunc), - "google_organization_policy": resourceGoogleOrganizationPolicy(), - "google_project": resourceGoogleProject(), - "google_project_iam_policy": resourceGoogleProjectIamPolicy(), - "google_project_iam_binding": ResourceIamBindingWithImport(IamProjectSchema, NewProjectIamUpdater, ProjectIdParseFunc), - "google_project_iam_member": ResourceIamMemberWithImport(IamProjectSchema, NewProjectIamUpdater, ProjectIdParseFunc), - "google_project_service": resourceGoogleProjectService(), - "google_project_iam_custom_role": resourceGoogleProjectIamCustomRole(), - "google_project_organization_policy": resourceGoogleProjectOrganizationPolicy(), - "google_project_usage_export_bucket": resourceProjectUsageBucket(), - "google_project_services": resourceGoogleProjectServices(), - "google_pubsub_topic": resourcePubsubTopic(), - "google_pubsub_topic_iam_binding": ResourceIamBindingWithImport(IamPubsubTopicSchema, NewPubsubTopicIamUpdater, PubsubTopicIdParseFunc), - "google_pubsub_topic_iam_member": ResourceIamMemberWithImport(IamPubsubTopicSchema, NewPubsubTopicIamUpdater, PubsubTopicIdParseFunc), - "google_pubsub_topic_iam_policy": ResourceIamPolicyWithImport(IamPubsubTopicSchema, NewPubsubTopicIamUpdater, PubsubTopicIdParseFunc), - "google_pubsub_subscription": resourcePubsubSubscription(), - "google_pubsub_subscription_iam_binding": ResourceIamBindingWithImport(IamPubsubSubscriptionSchema, NewPubsubSubscriptionIamUpdater, PubsubSubscriptionIdParseFunc), - "google_pubsub_subscription_iam_member": ResourceIamMemberWithImport(IamPubsubSubscriptionSchema, NewPubsubSubscriptionIamUpdater, PubsubSubscriptionIdParseFunc), - "google_pubsub_subscription_iam_policy": ResourceIamPolicyWithImport(IamPubsubSubscriptionSchema, NewPubsubSubscriptionIamUpdater, PubsubSubscriptionIdParseFunc), - "google_runtimeconfig_config": resourceRuntimeconfigConfig(), - "google_runtimeconfig_variable": resourceRuntimeconfigVariable(), - "google_service_account": resourceGoogleServiceAccount(), - "google_service_account_iam_binding": ResourceIamBindingWithImport(IamServiceAccountSchema, NewServiceAccountIamUpdater, ServiceAccountIdParseFunc), - "google_service_account_iam_member": ResourceIamMemberWithImport(IamServiceAccountSchema, NewServiceAccountIamUpdater, ServiceAccountIdParseFunc), - "google_service_account_iam_policy": ResourceIamPolicyWithImport(IamServiceAccountSchema, NewServiceAccountIamUpdater, ServiceAccountIdParseFunc), - "google_service_account_key": resourceGoogleServiceAccountKey(), - "google_storage_bucket": resourceStorageBucket(), - "google_storage_bucket_acl": resourceStorageBucketAcl(), - // Legacy roles such as roles/storage.legacyBucketReader are automatically added - // when creating a bucket. For this reason, it is better not to add the authoritative - // google_storage_bucket_iam_policy resource. - "google_storage_bucket_iam_binding": ResourceIamBinding(IamStorageBucketSchema, NewStorageBucketIamUpdater), - "google_storage_bucket_iam_member": ResourceIamMember(IamStorageBucketSchema, NewStorageBucketIamUpdater), - "google_storage_bucket_object": resourceStorageBucketObject(), - "google_storage_object_acl": resourceStorageObjectAcl(), - "google_storage_default_object_acl": resourceStorageDefaultObjectAcl(), - "google_storage_notification": resourceStorageNotification(), - }, + ResourcesMap: mergeResourceMaps( + GeneratedComputeResourcesMap, + map[string]*schema.Resource{ + "google_bigquery_dataset": resourceBigQueryDataset(), + "google_bigquery_table": resourceBigQueryTable(), + "google_bigtable_instance": resourceBigtableInstance(), + "google_bigtable_table": resourceBigtableTable(), + "google_cloudfunctions_function": resourceCloudFunctionsFunction(), + "google_cloudiot_registry": resourceCloudIoTRegistry(), + "google_compute_autoscaler": resourceComputeAutoscaler(), + "google_compute_address": resourceComputeAddress(), + "google_compute_backend_service": resourceComputeBackendService(), + "google_compute_disk": resourceComputeDisk(), + "google_compute_snapshot": resourceComputeSnapshot(), + "google_compute_firewall": resourceComputeFirewall(), + "google_compute_forwarding_rule": resourceComputeForwardingRule(), + "google_compute_global_forwarding_rule": resourceComputeGlobalForwardingRule(), + "google_compute_health_check": resourceComputeHealthCheck(), + "google_compute_image": resourceComputeImage(), + "google_compute_instance": resourceComputeInstance(), + "google_compute_instance_group": resourceComputeInstanceGroup(), + "google_compute_instance_group_manager": resourceComputeInstanceGroupManager(), + "google_compute_instance_template": resourceComputeInstanceTemplate(), + "google_compute_network": resourceComputeNetwork(), + "google_compute_network_peering": resourceComputeNetworkPeering(), + "google_compute_project_metadata": resourceComputeProjectMetadata(), + "google_compute_project_metadata_item": resourceComputeProjectMetadataItem(), + "google_compute_region_autoscaler": resourceComputeRegionAutoscaler(), + "google_compute_region_backend_service": resourceComputeRegionBackendService(), + "google_compute_region_instance_group_manager": resourceComputeRegionInstanceGroupManager(), + "google_compute_route": resourceComputeRoute(), + "google_compute_router": resourceComputeRouter(), + "google_compute_router_interface": resourceComputeRouterInterface(), + "google_compute_router_peer": resourceComputeRouterPeer(), + "google_compute_security_policy": resourceComputeSecurityPolicy(), + "google_compute_shared_vpc_host_project": resourceComputeSharedVpcHostProject(), + "google_compute_shared_vpc_service_project": resourceComputeSharedVpcServiceProject(), + "google_compute_ssl_certificate": resourceComputeSslCertificate(), + "google_compute_ssl_policy": resourceComputeSslPolicy(), + "google_compute_subnetwork": resourceComputeSubnetwork(), + "google_compute_subnetwork_iam_binding": ResourceIamBindingWithImport(IamComputeSubnetworkSchema, NewComputeSubnetworkIamUpdater, ComputeSubnetworkIdParseFunc), + "google_compute_subnetwork_iam_member": ResourceIamMemberWithImport(IamComputeSubnetworkSchema, NewComputeSubnetworkIamUpdater, ComputeSubnetworkIdParseFunc), + "google_compute_subnetwork_iam_policy": ResourceIamPolicyWithImport(IamComputeSubnetworkSchema, NewComputeSubnetworkIamUpdater, ComputeSubnetworkIdParseFunc), + "google_compute_target_https_proxy": resourceComputeTargetHttpsProxy(), + "google_compute_target_tcp_proxy": resourceComputeTargetTcpProxy(), + "google_compute_target_pool": resourceComputeTargetPool(), + "google_compute_url_map": resourceComputeUrlMap(), + "google_compute_vpn_gateway": resourceComputeVpnGateway(), + "google_compute_vpn_tunnel": resourceComputeVpnTunnel(), + "google_container_cluster": resourceContainerCluster(), + "google_container_node_pool": resourceContainerNodePool(), + "google_dataflow_job": resourceDataflowJob(), + "google_dataproc_cluster": resourceDataprocCluster(), + "google_dataproc_job": resourceDataprocJob(), + "google_dns_managed_zone": resourceDnsManagedZone(), + "google_dns_record_set": resourceDnsRecordSet(), + "google_endpoints_service": resourceEndpointsService(), + "google_folder": resourceGoogleFolder(), + "google_folder_iam_binding": ResourceIamBindingWithImport(IamFolderSchema, NewFolderIamUpdater, FolderIdParseFunc), + "google_folder_iam_member": ResourceIamMemberWithImport(IamFolderSchema, NewFolderIamUpdater, FolderIdParseFunc), + "google_folder_iam_policy": ResourceIamPolicyWithImport(IamFolderSchema, NewFolderIamUpdater, FolderIdParseFunc), + "google_folder_organization_policy": resourceGoogleFolderOrganizationPolicy(), + "google_logging_billing_account_sink": resourceLoggingBillingAccountSink(), + "google_logging_organization_sink": resourceLoggingOrganizationSink(), + "google_logging_folder_sink": resourceLoggingFolderSink(), + "google_logging_project_sink": resourceLoggingProjectSink(), + "google_kms_key_ring": resourceKmsKeyRing(), + "google_kms_key_ring_iam_binding": ResourceIamBindingWithImport(IamKmsKeyRingSchema, NewKmsKeyRingIamUpdater, KeyRingIdParseFunc), + "google_kms_key_ring_iam_member": ResourceIamMemberWithImport(IamKmsKeyRingSchema, NewKmsKeyRingIamUpdater, KeyRingIdParseFunc), + "google_kms_key_ring_iam_policy": ResourceIamPolicyWithImport(IamKmsKeyRingSchema, NewKmsKeyRingIamUpdater, KeyRingIdParseFunc), + "google_kms_crypto_key": resourceKmsCryptoKey(), + "google_kms_crypto_key_iam_binding": ResourceIamBindingWithImport(IamKmsCryptoKeySchema, NewKmsCryptoKeyIamUpdater, CryptoIdParseFunc), + "google_kms_crypto_key_iam_member": ResourceIamMemberWithImport(IamKmsCryptoKeySchema, NewKmsCryptoKeyIamUpdater, CryptoIdParseFunc), + "google_sourcerepo_repository": resourceSourceRepoRepository(), + "google_spanner_instance": resourceSpannerInstance(), + "google_spanner_database": resourceSpannerDatabase(), + "google_sql_database": resourceSqlDatabase(), + "google_sql_database_instance": resourceSqlDatabaseInstance(), + "google_sql_user": resourceSqlUser(), + "google_organization_iam_binding": ResourceIamBindingWithImport(IamOrganizationSchema, NewOrganizationIamUpdater, OrgIdParseFunc), + "google_organization_iam_custom_role": resourceGoogleOrganizationIamCustomRole(), + "google_organization_iam_member": ResourceIamMemberWithImport(IamOrganizationSchema, NewOrganizationIamUpdater, OrgIdParseFunc), + "google_organization_iam_policy": ResourceIamPolicyWithImport(IamOrganizationSchema, NewOrganizationIamUpdater, OrgIdParseFunc), + "google_organization_policy": resourceGoogleOrganizationPolicy(), + "google_project": resourceGoogleProject(), + "google_project_iam_policy": resourceGoogleProjectIamPolicy(), + "google_project_iam_binding": ResourceIamBindingWithImport(IamProjectSchema, NewProjectIamUpdater, ProjectIdParseFunc), + "google_project_iam_member": ResourceIamMemberWithImport(IamProjectSchema, NewProjectIamUpdater, ProjectIdParseFunc), + "google_project_service": resourceGoogleProjectService(), + "google_project_iam_custom_role": resourceGoogleProjectIamCustomRole(), + "google_project_organization_policy": resourceGoogleProjectOrganizationPolicy(), + "google_project_usage_export_bucket": resourceProjectUsageBucket(), + "google_project_services": resourceGoogleProjectServices(), + "google_pubsub_topic": resourcePubsubTopic(), + "google_pubsub_topic_iam_binding": ResourceIamBindingWithImport(IamPubsubTopicSchema, NewPubsubTopicIamUpdater, PubsubTopicIdParseFunc), + "google_pubsub_topic_iam_member": ResourceIamMemberWithImport(IamPubsubTopicSchema, NewPubsubTopicIamUpdater, PubsubTopicIdParseFunc), + "google_pubsub_topic_iam_policy": ResourceIamPolicyWithImport(IamPubsubTopicSchema, NewPubsubTopicIamUpdater, PubsubTopicIdParseFunc), + "google_pubsub_subscription": resourcePubsubSubscription(), + "google_pubsub_subscription_iam_binding": ResourceIamBindingWithImport(IamPubsubSubscriptionSchema, NewPubsubSubscriptionIamUpdater, PubsubSubscriptionIdParseFunc), + "google_pubsub_subscription_iam_member": ResourceIamMemberWithImport(IamPubsubSubscriptionSchema, NewPubsubSubscriptionIamUpdater, PubsubSubscriptionIdParseFunc), + "google_pubsub_subscription_iam_policy": ResourceIamPolicyWithImport(IamPubsubSubscriptionSchema, NewPubsubSubscriptionIamUpdater, PubsubSubscriptionIdParseFunc), + "google_runtimeconfig_config": resourceRuntimeconfigConfig(), + "google_runtimeconfig_variable": resourceRuntimeconfigVariable(), + "google_service_account": resourceGoogleServiceAccount(), + "google_service_account_iam_binding": ResourceIamBindingWithImport(IamServiceAccountSchema, NewServiceAccountIamUpdater, ServiceAccountIdParseFunc), + "google_service_account_iam_member": ResourceIamMemberWithImport(IamServiceAccountSchema, NewServiceAccountIamUpdater, ServiceAccountIdParseFunc), + "google_service_account_iam_policy": ResourceIamPolicyWithImport(IamServiceAccountSchema, NewServiceAccountIamUpdater, ServiceAccountIdParseFunc), + "google_service_account_key": resourceGoogleServiceAccountKey(), + "google_storage_bucket": resourceStorageBucket(), + "google_storage_bucket_acl": resourceStorageBucketAcl(), + // Legacy roles such as roles/storage.legacyBucketReader are automatically added + // when creating a bucket. For this reason, it is better not to add the authoritative + // google_storage_bucket_iam_policy resource. + "google_storage_bucket_iam_binding": ResourceIamBinding(IamStorageBucketSchema, NewStorageBucketIamUpdater), + "google_storage_bucket_iam_member": ResourceIamMember(IamStorageBucketSchema, NewStorageBucketIamUpdater), + "google_storage_bucket_object": resourceStorageBucketObject(), + "google_storage_object_acl": resourceStorageObjectAcl(), + "google_storage_default_object_acl": resourceStorageDefaultObjectAcl(), + "google_storage_notification": resourceStorageNotification(), + }, + ), ConfigureFunc: providerConfigure, } diff --git a/google/utils.go b/google/utils.go index 64d43795b3f..19e446c24a6 100644 --- a/google/utils.go +++ b/google/utils.go @@ -298,6 +298,20 @@ func mergeSchemas(a, b map[string]*schema.Schema) map[string]*schema.Schema { return merged } +func mergeResourceMaps(a, b map[string]*schema.Resource) map[string]*schema.Resource { + merged := make(map[string]*schema.Resource) + + for k, v := range a { + merged[k] = v + } + + for k, v := range b { + merged[k] = v + } + + return merged +} + func retry(retryFunc func() error) error { return retryTime(retryFunc, 1) }