delowan.googlecloud.gcp_kms_crypto_key (1.0.2) — module

Creates a GCP CryptoKey

Authors: Google Inc. (@googlecloudplatform)

preview | supported by community

Install collection

Install with ansible-galaxy collection install delowan.googlecloud:==1.0.2


Add to requirements.yml

  collections:
    - name: delowan.googlecloud
      version: 1.0.2

Description

A `CryptoKey` represents a logical key that can be used for cryptographic operations.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: create a key ring
  google.cloud.gcp_kms_key_ring:
    name: key-key-ring
    location: us-central1
    project: "{{ gcp_project }}"
    auth_kind: "{{ gcp_cred_kind }}"
    service_account_file: "{{ gcp_cred_file }}"
    state: present
  register: keyring
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: create a crypto key
  google.cloud.gcp_kms_crypto_key:
    name: test_object
    key_ring: projects/{{ gcp_project }}/locations/us-central1/keyRings/key-key-ring
    project: test_project
    auth_kind: serviceaccount
    service_account_file: "/tmp/auth.pem"
    state: present

Inputs

    
name:
    description:
    - The resource name for the CryptoKey.
    required: true
    type: str

state:
    choices:
    - present
    - absent
    default: present
    description:
    - Whether the given object should exist in GCP
    type: str

labels:
    description:
    - Labels with user-defined metadata to apply to this resource.
    required: false
    type: dict

scopes:
    description:
    - Array of scopes to be used
    elements: str
    type: list

project:
    description:
    - The Google Cloud Platform project to use.
    type: str

purpose:
    default: ENCRYPT_DECRYPT
    description:
    - Immutable purpose of CryptoKey. See U(https://cloud.google.com/kms/docs/reference/rest/v1/projects.locations.keyRings.cryptoKeys#CryptoKeyPurpose)
      for inputs.
    - 'Some valid choices include: "ENCRYPT_DECRYPT", "ASYMMETRIC_SIGN", "ASYMMETRIC_DECRYPT"'
    required: false
    type: str

env_type:
    description:
    - Specifies which Ansible environment you're running this module within.
    - This should not be set unless you know what you're doing.
    - This only alters the User Agent string for any API requests.
    type: str

key_ring:
    description:
    - The KeyRing that this key belongs to.
    - 'Format: `''projects/{{project}}/locations/{{location}}/keyRings/{{keyRing}}''`.'
    required: true
    type: str

auth_kind:
    choices:
    - application
    - machineaccount
    - serviceaccount
    description:
    - The type of credential used.
    required: true
    type: str

rotation_period:
    description:
    - Every time this period passes, generate a new CryptoKeyVersion and set it as the
      primary.
    - The first rotation will take place after the specified period. The rotation period
      has the format of a decimal number with up to 9 fractional digits, followed by the
      letter `s` (seconds). It must be greater than a day (ie, 86400).
    required: false
    type: str

version_template:
    description:
    - A template describing settings for new crypto key versions.
    required: false
    suboptions:
      algorithm:
        description:
        - The algorithm to use when creating a version based on this template.
        - See the [algorithm reference](U(https://cloud.google.com/kms/docs/reference/rest/v1/CryptoKeyVersionAlgorithm))
          for possible inputs.
        required: true
        type: str
      protection_level:
        description:
        - The protection level to use when creating a version based on this template.
        - 'Some valid choices include: "SOFTWARE", "HSM"'
        required: false
        type: str
    type: dict

service_account_file:
    description:
    - The path of a Service Account JSON file if serviceaccount is selected as type.
    type: path

service_account_email:
    description:
    - An optional service account email address if machineaccount is selected and the
      user does not wish to use the default email.
    type: str

service_account_contents:
    description:
    - The contents of a Service Account JSON file, either in a dictionary or as a JSON
      string that represents it.
    type: jsonarg

skip_initial_version_creation:
    description:
    - If set to true, the request will create a CryptoKey without any CryptoKeyVersions.
      You must use the `google_kms_key_ring_import_job` resource to import the CryptoKeyVersion.
    required: false
    type: bool

Outputs

createTime:
  description:
  - The time that this resource was created on the server.
  - This is in RFC3339 text format.
  returned: success
  type: str
keyRing:
  description:
  - The KeyRing that this key belongs to.
  - 'Format: `''projects/{{project}}/locations/{{location}}/keyRings/{{keyRing}}''`.'
  returned: success
  type: str
labels:
  description:
  - Labels with user-defined metadata to apply to this resource.
  returned: success
  type: dict
name:
  description:
  - The resource name for the CryptoKey.
  returned: success
  type: str
nextRotationTime:
  description:
  - The time when KMS will create a new version of this Crypto Key.
  returned: success
  type: str
purpose:
  description:
  - Immutable purpose of CryptoKey. See U(https://cloud.google.com/kms/docs/reference/rest/v1/projects.locations.keyRings.cryptoKeys#CryptoKeyPurpose)
    for inputs.
  returned: success
  type: str
rotationPeriod:
  description:
  - Every time this period passes, generate a new CryptoKeyVersion and set it as the
    primary.
  - The first rotation will take place after the specified period. The rotation period
    has the format of a decimal number with up to 9 fractional digits, followed by
    the letter `s` (seconds). It must be greater than a day (ie, 86400).
  returned: success
  type: str
skipInitialVersionCreation:
  description:
  - If set to true, the request will create a CryptoKey without any CryptoKeyVersions.
    You must use the `google_kms_key_ring_import_job` resource to import the CryptoKeyVersion.
  returned: success
  type: bool
versionTemplate:
  contains:
    algorithm:
      description:
      - The algorithm to use when creating a version based on this template.
      - See the [algorithm reference](U(https://cloud.google.com/kms/docs/reference/rest/v1/CryptoKeyVersionAlgorithm))
        for possible inputs.
      returned: success
      type: str
    protectionLevel:
      description:
      - The protection level to use when creating a version based on this template.
      returned: success
      type: str
  description:
  - A template describing settings for new crypto key versions.
  returned: success
  type: complex