Before architecting solutions involving Cloud Asset Inventory, it helps to understand its consistency model so you can build robust software:
Eventual consistency: Cloud Asset Inventory uses periodic data synchronization. Because of this, newly provisioned or modified resources might not be immediately queryable. Indexing delays are possible; as a result, state changes can take time to propagate across search queries, feeds, and exports.
Potential for data/event loss: When receiving information from other Google Cloud services, there might be temporary drops, lag, or out-of-order deliveries.
The following table includes scenarios for when it's better to use Cloud Asset Inventory or a service's API directly.
| Architectural need | Use Cloud Asset Inventory | Use the service API directly |
|---|---|---|
| Security and compliance | Scheduled compliance audits, IAM policy analysis, and drift reporting. | Real-time inline threat blocking or immediate access revocation. |
| Inventory management | Multi-project batch asset cataloging, BigQuery exports, and cost allocation. | Live source of truth for runtime/data plane application state. |
| Change tracking | Asynchronous notifications for delay-tolerant infrastructure updates through Pub/Sub. | Trigger immediate, synchronized orchestration dependencies. |
When designing services that consume Cloud Asset Inventory data, keep the following guidelines in mind.
Query Google Cloud APIs directly for immediate state
If a critical service requires instant validation (for example, verifying a firewall rule before traffic cutover), call the corresponding service's API instead of Cloud Asset Inventory.
Design resilient, idempotent consumers
Treat Cloud Asset Inventory Pub/Sub feeds as informative signals. Ensure consumers handle delayed or out-of-sequence events gracefully.
Design for asynchronous data serving
Use Cloud Asset Inventory primarily for out-of-band analytics, dashboards, and background reconciliation loops. Build with the understanding that data updates from primary sources of truth might experience synchronization lag.