Skip to content

googleBinaryAuthorizationAttestor

An attestor that attests to container image artifacts.

To get more information about Attestor, see:

Example Usage - Binary Authorization Attestor Basic

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as google from "./.gen/providers/google";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: google.
For a more precise conversion please use the --provider flag in convert.*/
const googleContainerAnalysisNoteNote =
  new google.containerAnalysisNote.ContainerAnalysisNote(this, "note", {
    attestation_authority: [
      {
        hint: [
          {
            human_readable_name: "Attestor Note",
          },
        ],
      },
    ],
    name: "test-attestor-note",
  });
new google.binaryAuthorizationAttestor.BinaryAuthorizationAttestor(
  this,
  "attestor",
  {
    attestation_authority_note: [
      {
        note_reference: googleContainerAnalysisNoteNote.name,
        public_keys: [
          {
            ascii_armored_pgp_public_key:
              "mQENBFtP0doBCADF+joTiXWKVuP8kJt3fgpBSjT9h8ezMfKA4aXZctYLx5wslWQl\nbB7Iu2ezkECNzoEeU7WxUe8a61pMCh9cisS9H5mB2K2uM4Jnf8tgFeXn3akJDVo0\noR1IC+Dp9mXbRSK3MAvKkOwWlG99sx3uEdvmeBRHBOO+grchLx24EThXFOyP9Fk6\nV39j6xMjw4aggLD15B4V0v9JqBDdJiIYFzszZDL6pJwZrzcP0z8JO4rTZd+f64bD\nMpj52j/pQfA8lZHOaAgb1OrthLdMrBAjoDjArV4Ek7vSbrcgYWcI6BhsQrFoxKdX\n83TZKai55ZCfCLIskwUIzA1NLVwyzCS+fSN/ABEBAAG0KCJUZXN0IEF0dGVzdG9y\nIiA8ZGFuYWhvZmZtYW5AZ29vZ2xlLmNvbT6JAU4EEwEIADgWIQRfWkqHt6hpTA1L\nuY060eeM4dc66AUCW0/R2gIbLwULCQgHAgYVCgkICwIEFgIDAQIeAQIXgAAKCRA6\n0eeM4dc66HdpCAC4ot3b0OyxPb0Ip+WT2U0PbpTBPJklesuwpIrM4Lh0N+1nVRLC\n51WSmVbM8BiAFhLbN9LpdHhds1kUrHF7+wWAjdR8sqAj9otc6HGRM/3qfa2qgh+U\nWTEk/3us/rYSi7T7TkMuutRMIa1IkR13uKiW56csEMnbOQpn9rDqwIr5R8nlZP5h\nMAU9vdm1DIv567meMqTaVZgR3w7bck2P49AO8lO5ERFpVkErtu/98y+rUy9d789l\n+OPuS1NGnxI1YKsNaWJF4uJVuvQuZ1twrhCbGNtVorO2U12+cEq+YtUxj7kmdOC1\nqoIRW6y0+UlAc+MbqfL0ziHDOAmcqz1GnROg\n=6Bvm\n",
          },
        ],
      },
    ],
    name: "test-attestor",
  }
);

Example Usage - Binary Authorization Attestor Kms

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as google from "./.gen/providers/google";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: google.
For a more precise conversion please use the --provider flag in convert.*/
const googleContainerAnalysisNoteNote =
  new google.containerAnalysisNote.ContainerAnalysisNote(this, "note", {
    attestation_authority: [
      {
        hint: [
          {
            human_readable_name: "Attestor Note",
          },
        ],
      },
    ],
    name: "test-attestor-note",
  });
const googleKmsKeyRingKeyring = new google.kmsKeyRing.KmsKeyRing(
  this,
  "keyring",
  {
    location: "global",
    name: "test-attestor-key-ring",
  }
);
const googleKmsCryptoKeyCryptoKey = new google.kmsCryptoKey.KmsCryptoKey(
  this,
  "crypto-key",
  {
    key_ring: googleKmsKeyRingKeyring.id,
    name: "test-attestor-key",
    purpose: "ASYMMETRIC_SIGN",
    version_template: [
      {
        algorithm: "RSA_SIGN_PKCS1_4096_SHA512",
      },
    ],
  }
);
googleKmsCryptoKeyCryptoKey.addOverride("lifecycle", [
  {
    prevent_destroy: true,
  },
]);
const dataGoogleKmsCryptoKeyVersionVersion =
  new google.dataGoogleKmsCryptoKeyVersion.DataGoogleKmsCryptoKeyVersion(
    this,
    "version",
    {
      crypto_key: googleKmsCryptoKeyCryptoKey.id,
    }
  );
new google.binaryAuthorizationAttestor.BinaryAuthorizationAttestor(
  this,
  "attestor",
  {
    attestation_authority_note: [
      {
        note_reference: googleContainerAnalysisNoteNote.name,
        public_keys: [
          {
            id: dataGoogleKmsCryptoKeyVersionVersion.id,
            pkix_public_key: [
              {
                public_key_pem: `\${${dataGoogleKmsCryptoKeyVersionVersion.publicKey.fqn}[0].pem}`,
                signature_algorithm: `\${${dataGoogleKmsCryptoKeyVersionVersion.publicKey.fqn}[0].algorithm}`,
              },
            ],
          },
        ],
      },
    ],
    name: "test-attestor",
  }
);

Argument Reference

The following arguments are supported:

  • name - (Required) The resource name.

  • attestationAuthorityNote - (Required) A Container Analysis ATTESTATION_AUTHORITY Note, created by the user. Structure is documented below.

The attestationAuthorityNote block supports:

  • noteReference - (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.

  • publicKeys - (Optional) 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. Structure is documented below.

  • delegationServiceAccountEmail - (Output) 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.

The publicKeys block supports:

  • comment - (Optional) A descriptive comment. This field may be updated.

  • id - (Optional) 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.

  • asciiArmoredPgpPublicKey - (Optional) ASCII-armored representation of a PGP public key, as the entire output by the command gpgExportArmorFoo@exampleCom (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.

  • pkixPublicKey - (Optional) 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. Structure is documented below.

The pkixPublicKey block supports:

  • publicKeyPem - (Optional) A PEM-encoded public key, as described in https://toolsIetfOrg/html/rfc7468#section13

  • signatureAlgorithm - (Optional) 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).


  • description - (Optional) A descriptive comment. This field may be updated. The field may be displayed in chooser dialogs.

  • project - (Optional) The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

Attributes Reference

In addition to the arguments listed above, the following computed attributes are exported:

  • id - an identifier for the resource with format projects/{{project}}/attestors/{{name}}

Timeouts

This resource provides the following Timeouts configuration options:

  • create - Default is 20 minutes.
  • update - Default is 20 minutes.
  • delete - Default is 20 minutes.

Import

Attestor can be imported using any of these accepted formats:

$ terraform import google_binary_authorization_attestor.default projects/{{project}}/attestors/{{name}}
$ terraform import google_binary_authorization_attestor.default {{project}}/{{name}}
$ terraform import google_binary_authorization_attestor.default {{name}}

User Project Overrides

This resource supports User Project Overrides.