Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

be-any-of Pattern Issue #113

Open
y-matsutomo opened this issue Oct 25, 2021 · 1 comment
Open

be-any-of Pattern Issue #113

y-matsutomo opened this issue Oct 25, 2021 · 1 comment
Labels
type: bug Something isn't working

Comments

@y-matsutomo
Copy link
Contributor

Description of the bug

be-any-of constraint in HCL does not recognize the strings properly.

Steps to Reproduce

target code

resource "google_container_cluster" "bad_example" {
  logging_service = "none"
}

rule

version: '1'
rules:
  - id: 'example'
    title: example
    language: hcl
    patterns:
      - pattern: |
          resource  "google_container_cluster" :[NAME] {
            example_service = :[SETTINGS]
          }
        constraints:
          - target: SETTINGS
            should: be-any-of 
            strings:
              - "none"
              - "example.com"
    rewrite: |
      resource "google_container_cluster" :[NAME] {
        example_service = "example-service"
      }

Expected Behaviour

The pattern should match but it does not.

Additional Materials

N/A

@y-matsutomo y-matsutomo added the type: bug Something isn't working label Oct 25, 2021
@y-matsutomo y-matsutomo changed the title be-any-of Pattern Issue be-any-of Pattern Issue Oct 25, 2021
@marina-ki
Copy link

It works well by writing as follows:

            strings:
              - '"none"'
              - '"example.com"'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants