Giter Site home page Giter Site logo

Comments (4)

kapilt avatar kapilt commented on May 25, 2024

value_type: normalize is intended to support this use case.

from cloud-custodian.

ikraemer-dd avatar ikraemer-dd commented on May 25, 2024

Hi!
My use case is write a policy finding all resources that match a filter, but to exclude a list of known resources. These known exceptions are known by resource names, which should be compared in a case-insensitive way, as per Azure doc.
Hence, my policy looks like:

policies:
  - name: storage-account-lower-case
    description: |
      Find a storage accounts (lower cases)
    resource: azure.storage
    filters:
      - type: value
        key: id
        op: not-in
        value: 
        - /subscriptions/xxx/resourcegroups/yyy/providers/microsoft.storage/storageaccounts/zzz
        - /subscriptions/xxx/resourcegroups/yyy/providers/microsoft.storage/storageaccounts/aaa

I could not find how to make value_type: normalize option work with a list of values. Is there a way?

from cloud-custodian.

kapilt avatar kapilt commented on May 25, 2024

the normalize is done on the resource value, which is a string in this case even when the value in the policy is an array. what issue are you seeing?

from cloud-custodian.

ikraemer-dd avatar ikraemer-dd commented on May 25, 2024

Indeed, i missed this! The following policy addresses exactly my use-case.

policies:
  - name: storage-account-matching-a-list
    resource: azure.storage
    filters:
      - type: value
        key: id
        op: in
        value: 
        - /subscriptions/xxx/resourcegroups/yyy/providers/microsoft.storage/storageaccounts/zzz
        - /subscriptions/xxx/resourcegroups/yyy/providers/microsoft.storage/storageaccounts/aaa
        value_type: normalize

Thank you!

from cloud-custodian.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.