diff --git a/x-pack/plugins/infra/server/routes/inventory_metadata/index.ts b/x-pack/plugins/infra/server/routes/inventory_metadata/index.ts index eff335fc2236f9..c2ca93baa26511 100644 --- a/x-pack/plugins/infra/server/routes/inventory_metadata/index.ts +++ b/x-pack/plugins/infra/server/routes/inventory_metadata/index.ts @@ -9,6 +9,7 @@ import Boom from '@hapi/boom'; import { pipe } from 'fp-ts/lib/pipeable'; import { fold } from 'fp-ts/lib/Either'; import { identity } from 'fp-ts/lib/function'; +import { findInventoryModel } from '../../../common/inventory_models'; import { InfraBackendLibs } from '../../lib/infra_types'; import { throwErrors } from '../../../common/runtime_types'; @@ -38,10 +39,24 @@ export const initInventoryMetaRoute = (libs: InfraBackendLibs) => { fold(throwErrors(Boom.badRequest), identity) ); + const model = findInventoryModel(nodeType); + + // Only run this for AWS modules, eventually we might have more. + if (model.requiredModule !== 'aws') { + return response.ok({ + body: { + accounts: [], + projects: [], + regions: [], + }, + }); + } + const { configuration } = await libs.sources.getSourceConfiguration( requestContext.core.savedObjects.client, sourceId ); + const awsMetadata = await getCloudMetadata( framework, requestContext,