如何仅针对不合规资源要求云托管报告

How to ask cloudcustodian report only for non complient resources

我们正在尝试使用 cloudcustodian 进行基础架构审计,并为不符合标记策略的资源生成 csv 报告

配置示例:

vars:
  tag-filters: &tag-compliance-filters
      - "tag.team_name": absent
      - "tag.product_name": absent
      - "tag.application_name": absent
      - "tag.service_name": absent
      - "tag.group": absent


policies:
- name: tag-compliance-rds
  resource: aws.rds
  description: |
    Detect resources which does not meet tags compliance 
  filters: 
      - and: *tag-compliance-filters

但在 CSV 报告中我看到了所有资源(甚至是符合此政策的资源)。使用了 c7n-org 实用程序。那么,问题是如何只过滤没有至少一个这些标签的不合规资源?

我看这个post很老了。还在回答

您必须在过滤器中使用 OR。

vars:
  tag-filters: &tag-compliance-filters
      - "tag.team_name": absent
      - "tag.product_name": absent
      - "tag.application_name": absent
      - "tag.service_name": absent
      - "tag.group": absent


policies:
- name: tag-compliance-rds
  resource: aws.rds
  description: |
    Detect resources which does not meet tags compliance 
  filters: 
      - or: *tag-compliance-filters