diff --git a/apps/cnspec/cmd/integrate.go b/apps/cnspec/cmd/integrate.go index 18a39ed8..cd683a51 100644 --- a/apps/cnspec/cmd/integrate.go +++ b/apps/cnspec/cmd/integrate.go @@ -104,12 +104,19 @@ var ( if err != nil { return err } + // TODO verify that the config is a service account config.DisplayUsedConfig() mondooClient, err := getGqlClient(opts) if err != nil { return err } - spaceInfo, err := cnspec_upstream.GetSpace(context.Background(), mondooClient, spacePrefix+space) + // by default, use the MRN from the config + spaceMrn := opts.GetParentMrn() + if space != "" { + // unless it was specified via flag + spaceMrn = spacePrefix + space + } + spaceInfo, err := cnspec_upstream.GetSpace(context.Background(), mondooClient, spaceMrn) if err != nil { log.Fatal().Msgf("unable to verify access to space '%s': %s", space, err) }