diff --git a/query/config/config_enabled_all_regions.sql b/query/config/config_enabled_all_regions.sql index 6f9dd133..4cbecacc 100644 --- a/query/config/config_enabled_all_regions.sql +++ b/query/config/config_enabled_all_regions.sql @@ -23,24 +23,30 @@ select and status ->> 'Recording' = 'true' and status ->> 'LastStatus' = 'SUCCESS' then 'ok' + -- Skip any regions that are disabled in the account. + when a.opt_in_status = 'not-opted-in' then 'skip' else 'alarm' end as status, -- Below cases are for citing respective reasons for control state case - when recording_group -> 'IncludeGlobalResourceTypes' = 'true' then a.region || ' IncludeGlobalResourceTypes enabled,' - else a.region || ' IncludeGlobalResourceTypes disabled,' - end || - case - when recording_group -> 'AllSupported' = 'true' then ' AllSupported enabled,' - else ' AllSupported disabled,' - end || - case - when status ->> 'Recording' = 'true' then ' Recording enabled' - else ' Recording disabled' - end || - case - when status ->> 'LastStatus' = 'SUCCESS' then ' and LastStatus is SUCCESS.' - else ' and LastStatus is not SUCCESS.' + when a.opt_in_status = 'not-opted-in' then a.region || ' region is disabled.' + else + case + when recording_group -> 'IncludeGlobalResourceTypes' = 'true' then a.region || ' IncludeGlobalResourceTypes enabled,' + else a.region || ' IncludeGlobalResourceTypes disabled,' + end || + case + when recording_group -> 'AllSupported' = 'true' then ' AllSupported enabled,' + else ' AllSupported disabled,' + end || + case + when status ->> 'Recording' = 'true' then ' Recording enabled' + else ' Recording disabled' + end || + case + when status ->> 'LastStatus' = 'SUCCESS' then ' and LastStatus is SUCCESS.' + else ' and LastStatus is not SUCCESS.' + end end as reason, -- Additional columns a.region,