Create a cloud action - Google Cloud Platform

Prev Next

Create a Google Cloud Platform (GCP) cloud action to automatically discover assets from your Google Cloud Platform environment. This lets Lansweeper collect inventory data across your GCP projects and workloads (such as Compute Engine instances, Cloud SQL databases, and storage resources), so your cloud assets stay visible and up to date in a unified inventory.

Prerequisites

Choose which projects to scan

Before you create the action, decide how Lansweeper selects the GCP projects to scan:

  • Manually select projects: The default mode. Lansweeper scans only the projects you select from the list. New projects aren't scanned until you add them to the action.
  • Automatically discover all projects: Lansweeper scans every project your credentials can read, except the ones you exclude with rules. New projects are scanned the next time the action runs, without editing the action.

You can switch modes later by editing the action.

Create a GCP cloud action

You create the action through a step-by-step wizard.

  1. In your Lansweeper Site, go to Discovery > Actions.
  2. Select Create action.
  3. Select Cloud as the action type, and Google Cloud Platform (GCP) as the cloud source.
  4. On the Action details step, enter a name and description, then continue.
  5. On the Authentication step, select Set up new connection.
  6. In the connection dialog, enter your Workload Identity Pool ID, Workload Identity Provider, Project Number, and Service Account Email.
  7. Select List projects. Lansweeper connects to GCP and the dialog closes.
  8. Choose how Lansweeper selects the projects to scan:
    • Manually select projects: Select the projects from the list.
    • Automatically discover all projects: Optionally, exclude projects with rules.
  9. On the Asset types step, select which types of assets to scan.
  10. On the Filters step, optionally add labels to include or exclude specific resources.
  11. On the Define triggers step, set when the discovery runs.
  12. On the Review step, check your settings and select Save and finish.

Exclude projects from automatic discovery

When you use Automatically discover all projects, you can add up to 5 rules to leave specific projects out.

  1. Select Add exclusion rule.
  2. Under Match on, select Project name or Project ID.
  3. Under Regex pattern, enter a regular expression, for example ^sandbox-. Patterns are case-sensitive and match anywhere in the name or ID unless you anchor them with ^ or $.
  4. Check the Preview list. Excluded projects are grayed out and tagged with the rule that matches them, for example Rule 1.

To remove a rule, select the trash can icon in its row.

What to expect after the action runs

After the trigger runs for the first time, Lansweeper discovers the resources in the GCP projects the action scans and adds them to your asset inventory. Each discovered resource, such as a Compute Engine instance, Cloud SQL database, or storage bucket, becomes an asset with its own asset page showing details, relationships, and tags.

Discovery runs on the schedule you set in the trigger, so the data refreshes with each successful run.

Troubleshoot the GCP cloud action

Where to see scan problems

If a discovered asset is missing data, open the asset and check the Scan issues tab. Permission or scanning problems for that asset appear there.

If the action doesn't return the results you expect, check the following:

  • Connection or authentication fails. Confirm your Workload Identity Pool ID, Workload Identity Provider, Project Number, and Service Account Email are correct. Use the pool and provider IDs, not their names. Check that the Workload Identity Pool, provider, and site ID attribute condition are configured as described in Prepare Google Cloud Platform for Cloud Discovery.
  • No projects or assets are discovered. Confirm the service account has the Viewer, Folder Viewer, and Organization Viewer roles. To scan multiple projects, grant the Viewer role to the service account in each project. If you use automatic discovery, check that no exclusion rule matches the projects you expect to see.