id: gcp-env

info:
  name: GCP Environment Validation
  author: princechaddha
  severity: info
  description: |
    Checks if Google Cloud CLI (gcloud) is set up and all necessary tools are installed on the environment.
  reference:
    - https://console.cloud.google.com/
  tags: cloud,devops,google,gcp,gcp-cloud-config

self-contained: true
code:
  - engine:
      - sh
      - bash
    source: |
      gcloud config get-value account --format="json"

    matchers:
      - type: word
        words:
          - '@'

    extractors:
      - type: json
        name: account
        json:
          - '.'
        internal: true

      - type: dsl
        dsl:
          - '"Google Cloud CLI is properly configured for account \"" + account + "\"."'
# digest: 4a0a00473045022062ce09ad9923c5f5cf0d8c4019c41920f13268e3788abc3587939c3627905ae60221009bd228cc7e8114257c43f5036ec937fbd7643290d4b2e275413fb18958e0e799:922c64590222798bb761d5b6d8e72950