google.cloud.gcp_binaryauthorization_attestor module – Manages a BinaryAuthorization.Attestor resource

Note

This module is part of the google.cloud collection (version 1.15.0).

You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install google.cloud. You need further requirements to be able to use this module, see Requirements for details.

To use it in a playbook, specify: google.cloud.gcp_binaryauthorization_attestor.

Synopsis

  • An attestor that attests to container image artifacts.

Requirements

The below requirements are needed on the host that executes this module.

  • python >= 3.8

  • requests >= 2.18.4

  • google-auth >= 2.25.1

Parameters

Parameter

Comments

access_token

string

The access token used to authenticate.

attestation_authority_note

dictionary / required

A Container Analysis ATTESTATION_AUTHORITY Note, created by the user.

delegation_service_account_email

string

This field will contain the service account email address that this Attestor will use as the principal when querying Container Analysis.

Attestor administrators must grant this service account the IAM role needed to read attestations from the noteReference in Container Analysis (containeranalysis.notes.occurrences.viewer).

This email address is fixed for the lifetime of the Attestor, but callers should not make any other assumptions about the service account email; future versions may use an email based on a different naming pattern.

note_reference

string / required

The resource name of a ATTESTATION_AUTHORITY Note, created by the user.

If the Note is in a different project from the Attestor, it should be specified in the format `projects/*/notes/*` (or the legacy `providers/*/notes/*`).

This field may not be updated.

An attestation by this attestor is stored as a Container Analysis ATTESTATION_AUTHORITY Occurrence that names a container image and that links to this Note.

This property is immutable, to change it, you must delete and recreate the resource.

public_keys

list / elements=dictionary

Public keys that verify attestations signed by this attestor.

This field may be updated.

If this field is non-empty, one of the specified public keys must verify that an attestation was signed by this attestor for the image specified in the admission request.

If this field is empty, this attestor always returns that no valid attestations exist.

ascii_armored_pgp_public_key

string

ASCII-armored representation of a PGP public key, as the entire output by the command `gpg --export --armor foo@example.com` (either LF or CRLF line endings).

When using this field, id should be left blank.

The BinAuthz API handlers will calculate the ID and fill it in automatically.

BinAuthz computes this ID as the OpenPGP RFC4880 V4 fingerprint, represented as upper-case hex.

If id is provided by the caller, it will be overwritten by the API-calculated ID.

comment

string

A descriptive comment.

This field may be updated.

id

string

The ID of this public key.

Signatures verified by BinAuthz must include the ID of the public key that can be used to verify them, and that ID must match the contents of this field exactly.

Additional restrictions on this field can be imposed based on which public key type is encapsulated.

See the documentation on publicKey cases below for details.

pkix_public_key

dictionary

A raw PKIX SubjectPublicKeyInfo format public key.

NOTE: id may be explicitly provided by the caller when using this type of public key, but it MUST be a valid RFC3986 URI.

If id is left blank, a default one will be computed based on the digest of the DER encoding of the public key.

public_key_pem

string

A PEM-encoded public key, as described in `https://tools.ietf.org/html/rfc7468#section-13`.

signature_algorithm

string

The signature algorithm used to verify a message against a signature using this key.

These signature algorithm must match the structure and any object identifiers encoded in publicKeyPem (i.e.

this algorithm must match that of the public key).

auth_kind

string / required

The type of credential used.

Choices:

  • "accesstoken"

  • "application"

  • "machineaccount"

  • "serviceaccount"

description

string

A descriptive comment.

This field may be updated.

The field may be displayed in chooser dialogs.

env_type

string

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.

name

string / required

The resource name.

This property is immutable, to change it, you must delete and recreate the resource.

project

string

The Google Cloud Platform project to use.

scopes

list / elements=string

Array of scopes to be used.

service_account_contents

jsonarg

The contents of a Service Account JSON file,

either in a dictionary or as a JSON string that represents it.

service_account_email

string

An optional service account email address if machineaccount is

selected and the user does not wish to use the default email.

service_account_file

path

The path of a Service Account JSON file if serviceaccount

is selected as type.

state

string

Whether the resource should exist.

Choices:

  • "present" ← (default)

  • "absent"

Notes

Note

Examples

- name: Read armored public key file
  ansible.builtin.slurp:
    path: /path/to/public-key.asc
  register: _public_key

- name: Create Attestor
  google.cloud.gcp_binaryauthorization_attestor:
    name: test-attestor
    state: present
    attestation_authority_note:
      note_reference: projects/my-project/notes/my-note
      public_keys:
        - ascii_armored_pgp_public_key: "{{ _public_key.content | b64decode }}"

################################################################################

- name: Delete Attestor
  google.cloud.gcp_binaryauthorization_attestor:
    name: test-attestor
    state: absent
    attestation_authority_note:
      note_reference: projects/my-project/notes/my-note

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key

Description

changed

boolean

Whether the resource was changed.

Returned: always

description

string

A descriptive comment.

This field may be updated.

The field may be displayed in chooser dialogs.

Returned: when set

name

string

The resource name.

This property is immutable, to change it, you must delete and recreate the resource.

Returned: always

state

string

The current state of the resource.

Returned: always

userOwnedGrafeasNote

dictionary

A Container Analysis ATTESTATION_AUTHORITY Note, created by the user.

Returned: always

delegationServiceAccountEmail

string

This field will contain the service account email address that this Attestor will use as the principal when querying Container Analysis.

Attestor administrators must grant this service account the IAM role needed to read attestations from the noteReference in Container Analysis (containeranalysis.notes.occurrences.viewer).

This email address is fixed for the lifetime of the Attestor, but callers should not make any other assumptions about the service account email; future versions may use an email based on a different naming pattern.

Returned: success

noteReference

string

The resource name of a ATTESTATION_AUTHORITY Note, created by the user.

If the Note is in a different project from the Attestor, it should be specified in the format `projects/*/notes/*` (or the legacy `providers/*/notes/*`).

This field may not be updated.

An attestation by this attestor is stored as a Container Analysis ATTESTATION_AUTHORITY Occurrence that names a container image and that links to this Note.

This property is immutable, to change it, you must delete and recreate the resource.

Returned: always

publicKeys

list / elements=dictionary

Public keys that verify attestations signed by this attestor.

This field may be updated.

If this field is non-empty, one of the specified public keys must verify that an attestation was signed by this attestor for the image specified in the admission request.

If this field is empty, this attestor always returns that no valid attestations exist.

Returned: when set

asciiArmoredPgpPublicKey

string

ASCII-armored representation of a PGP public key, as the entire output by the command `gpg --export --armor foo@example.com` (either LF or CRLF line endings).

When using this field, id should be left blank.

The BinAuthz API handlers will calculate the ID and fill it in automatically.

BinAuthz computes this ID as the OpenPGP RFC4880 V4 fingerprint, represented as upper-case hex.

If id is provided by the caller, it will be overwritten by the API-calculated ID.

Returned: when set

comment

string

A descriptive comment.

This field may be updated.

Returned: when set

id

string

The ID of this public key.

Signatures verified by BinAuthz must include the ID of the public key that can be used to verify them, and that ID must match the contents of this field exactly.

Additional restrictions on this field can be imposed based on which public key type is encapsulated.

See the documentation on publicKey cases below for details.

Returned: when set

pkixPublicKey

dictionary

A raw PKIX SubjectPublicKeyInfo format public key.

NOTE: id may be explicitly provided by the caller when using this type of public key, but it MUST be a valid RFC3986 URI.

If id is left blank, a default one will be computed based on the digest of the DER encoding of the public key.

Returned: when set

publicKeyPem

string

A PEM-encoded public key, as described in `https://tools.ietf.org/html/rfc7468#section-13`.

Returned: when set

signatureAlgorithm

string

The signature algorithm used to verify a message against a signature using this key.

These signature algorithm must match the structure and any object identifiers encoded in publicKeyPem (i.e.

this algorithm must match that of the public key).

Returned: when set

Authors

  • Google Inc. (@googlecloudplatform)