google_container_analysis_occurrence

An occurrence is an instance of a Note, or type of analysis that can be done for a resource.

To get more information about Occurrence, see:

Example Usage - Container Analysis Occurrence Kms

resource "google_binary_authorization_attestor" "attestor" {
  name = "attestor"
  attestation_authority_note {
    note_reference = google_container_analysis_note.note.name
    public_keys {
      id = data.google_kms_crypto_key_version.version.id
      pkix_public_key {
        public_key_pem      = data.google_kms_crypto_key_version.version.public_key[0].pem
        signature_algorithm = data.google_kms_crypto_key_version.version.public_key[0].algorithm
      }
    }
  }
}

resource "google_container_analysis_note" "note" {
  name = "attestation-note"
  attestation_authority {
    hint {
      human_readable_name = "Attestor Note"
    }
  }
}

data "google_kms_key_ring" "keyring" {
  name = "my-key-ring"
  location = "global"
}

data "google_kms_crypto_key" "crypto-key" {
  name     = "my-key"
  key_ring = data.google_kms_key_ring.keyring.id
}

data "google_kms_crypto_key_version" "version" {
  crypto_key = data.google_kms_crypto_key.crypto-key.id
}

resource "google_container_analysis_occurrence" "occurrence" {
  resource_uri = "gcr.io/my-project/my-image"
  note_name = google_container_analysis_note.note.id

  // See "Creating Attestations" Guide for expected
  // payload and signature formats.
  attestation {
    serialized_payload = filebase64("path/to/my/payload.json")
    signatures {
      public_key_id = data.google_kms_crypto_key_version.version.id
      serialized_payload = filebase64("path/to/my/payload.json.sig")
    }
  }
}

Argument Reference

The following arguments are supported:

The attestation block supports:

The signatures block supports:


Attributes Reference

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

Timeouts

This resource provides the following Timeouts configuration options:

Import

Occurrence can be imported using any of these accepted formats:

In Terraform v1.5.0 and later, use an import block to import Occurrence using one of the formats above. For example:

import {
  id = "projects/{{project}}/occurrences/{{name}}"
  to = google_container_analysis_occurrence.default
}

When using the terraform import command, Occurrence can be imported using one of the formats above. For example:

$ terraform import google_container_analysis_occurrence.default projects/{{project}}/occurrences/{{name}}
$ terraform import google_container_analysis_occurrence.default {{project}}/{{name}}
$ terraform import google_container_analysis_occurrence.default {{name}}

User Project Overrides

This resource supports User Project Overrides.