Google Cloud
  • 10 Apr 2024
  • 1 Minute to read
  • Contributors
  • Dark
    Light
  This documentation version is deprecated, please click here for the latest version.

Google Cloud

  • Dark
    Light

Article summary

The Google Cloud command line interface, or gcloud CLI, allows you to create and manage Google Cloud resources and services directly on the command line. With this component of the Cloud CLI extension, you can interact with Google Cloud directly from LimaCharlie.

This extension makes use of Google Cloud's native CLI tool, which can be found here.

Example

The following example stops the specified GCP compute instance.

- action: extension request
  extension action: run
  extension name: ext-cloud-cli
  extension request:
    cloud: '{{ "gcloud" }}' 
    command_tokens:
      - compute
      - instances
      - stop
      - '{{ .routing.hostname }}'
    credentials: '{{ "hive://secret/secret-name" }}'

Credentials

To utilize Google Cloud CLI capabilities, you will need:

  • A GCP service account JSON key. More information on service account keys can be found here.

  • Create a secret in the secrets manager in the following format:

    {
        "type": "",
        "project_id": "",
        "private_key_id": "",
        "private_key": "",
        "client_email": "",
        "client_id": "",
        "auth_uri": "",
        "token_uri": "",
        "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
        "client_x509_cert_url": "",
        "universe_domain": "googleapis.com"
    }
    

Was this article helpful?

What's Next