Skip to content

googleCloudAssetResourcesSearchAll

Retrieve all the resources within a given accessible CRM scope (project/folder/organization). See the REST API for more details.

\~> Warning: This resource is in beta, and should be used with the terraform-provider-google-beta provider. See Provider Versions for more details on beta resources.

Example Usage - searching for all projects in an org

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as google from "./.gen/providers/google";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: google.
For a more precise conversion please use the --provider flag in convert.*/
new google.dataGoogleCloudAssetResourcesSearchAll.DataGoogleCloudAssetResourcesSearchAll(
  this,
  "projects",
  {
    asset_types: ["cloudresourcemanager.googleapis.com/Project"],
    provider: "${google-beta}",
    scope: "organizations/0123456789",
  }
);

Example Usage - searching for all projects with CloudBuild API enabled

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as google from "./.gen/providers/google";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: google.
For a more precise conversion please use the --provider flag in convert.*/
new google.dataGoogleCloudAssetResourcesSearchAll.DataGoogleCloudAssetResourcesSearchAll(
  this,
  "cloud_build_projects",
  {
    asset_types: ["serviceusage.googleapis.com/Service"],
    provider: "${google-beta}",
    query: "displayName:cloudbuild.googleapis.com AND state:ENABLED",
    scope: "organizations/0123456789",
  }
);

Example Usage - searching for all Service Accounts in a project

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as google from "./.gen/providers/google";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: google.
For a more precise conversion please use the --provider flag in convert.*/
new google.dataGoogleCloudAssetResourcesSearchAll.DataGoogleCloudAssetResourcesSearchAll(
  this,
  "project_service_accounts",
  {
    asset_types: ["iam.googleapis.com/ServiceAccount"],
    provider: "${google-beta}",
    scope: "projects/my-project-id",
  }
);

Argument Reference

The following arguments are supported:

  • scope - (Required) A scope can be a project, a folder, or an organization. The allowed value must be: organization number (such as "organizations/123"), folder number (such as "folders/1234"), project number (such as "projects/12345") or project id (such as "projects/abc")
  • assetTypes - (Optional) A list of asset types that this request searches for. If empty, it will search all the supported asset types.
  • query - (Optional) The query statement. See how to construct a query for more information. If not specified or empty, it will search all the resources within the specified scope and assetTypes.

Attributes Reference

The following attributes are exported:

  • results - A list of search results based on provided inputs. Structure is defined below.

The results block supports:

  • name - The full resource name. See Resource Names for more information.
  • assetType - The type of this resource.
  • project - The project that this resource belongs to, in the form of projects/{projectNumber}.
  • displayName - The display name of this resource.
  • description - One or more paragraphs of text description of this resource. Maximum length could be up to 1M bytes.
  • additionalAttributes - Additional searchable attributes of this resource. Informational only. The exact set of attributes is subject to change. For example: project id, DNS name etc.
  • location - Location can be global, regional like usEast1, or zonal like usWest1B.
  • labels - Labels associated with this resource.
  • networkTags - Network tags associated with this resource.