crypto_key#

Exec module for managing Cloud Key Management Service crypto keys.

async idem_gcp.exec.gcp.cloudkms.crypto_key.get(hub, ctx, resource_id: str)[source]#

Returns a crypto key by its Idem resource ID.

Parameters:

resource_id (str) – Idem resource ID. projects/{project id}/locations/{location id}/keyRings/{keyRing}/cryptoKeys/{cryptoKey}

Returns:

CryptoKey resource

Examples

{% set project_id = 'project-name' %}
{% set location_id = 'us-east1' %}
{% set key_ring = 'key-ring' %}
{% set crypto_key = 'crypto-key' %}
get-crypto-key:
    exec.run:
        - path: gcp.cloudkms.crypto_key.get
        - kwargs:
            resource_id: projects/{{project_id}}/locations/{{location_id}}/keyRings/{{key_ring}}/cryptoKeys/{{crypto_key}}
async idem_gcp.exec.gcp.cloudkms.crypto_key.list_(hub, ctx, key_ring: str, filter_: (<class 'str'>, 'alias=filter') = None, order_by: str = None) Dict[str, Any][source]#

Retrieves the crypto keys in a key ring.

Parameters:
  • key_ring (str) – key ring resource_id.

  • filter (str, Optional) – Only include resources that match the filter in the response. For more information, see Sorting and filtering list results.

  • order_by (str, Optional) – Specify how the results should be sorted. If not specified, the results will be sorted in the default order. For more information, see Sorting and filtering list results.

Examples

list-locations:
    exec.run:
       - path: gcp.cloudkms.location.list
       - kwargs:
             project: project-name

#!require:list-locations
list-key-rings:
    exec.run:
       - path: gcp.cloudkms.key_ring.list
       - kwargs:
             location: {% for v in hub.idem.arg_bind.resolve('${exec:list-locations}') -%}
                           {{ v['resource_id'] if v.get('display_name') == 'South Carolina' }}
                       {%- endfor %}

#!require:list-key-rings
list-crypto-keys:
    exec.run:
       - path: gcp.cloudkms.crypto_key.list
       - kwargs:
             key_ring: ${exec:list-key-rings:[0]:resource_id}

#!END

list-crypto-keys-filtered:
    exec.run:
       - path: gcp.cloudkms.crypto_key.list
       - kwargs:
             key_ring: projects/project-name/locations/global/keyRings/kr-global-test
             filter: nextRotationTime < 2023-10-02