Google Secret Manager Secret

This page shows how to write Terraform for Secret Manager Secret and write them securely.

google_secret_manager_secret (Terraform)

The Secret in Secret Manager can be configured in Terraform with the resource name google_secret_manager_secret. The following sections describe 5 examples of how to use the resource and its parameters.

Example Usage from GitHub

main.tf#L106
resource "google_secret_manager_secret" "manual_mystudies_email_address" {
  provider = google-beta

  secret_id = "manual-mystudies-email-address"
  project   = module.project.project_id

main.tf#L106
resource "google_secret_manager_secret" "manual_mystudies_email_address" {
  provider = google-beta

  secret_id = "manual-mystudies-email-address"
  project   = module.project.project_id

main.tf#L106
resource "google_secret_manager_secret" "manual_mystudies_email_address" {
  provider = google-beta

  secret_id = "manual-mystudies-email-address"
  project   = module.project.project_id

main.tf#L106
resource "google_secret_manager_secret" "manual_mystudies_email_address" {
  provider = google-beta

  secret_id = "manual-mystudies-email-address"
  project   = module.project.project_id

main.tf#L106
resource "google_secret_manager_secret" "manual_mystudies_email_address" {
  provider = google-beta

  secret_id = "manual-mystudies-email-address"
  project   = module.project.project_id

Review your Terraform file for Google best practices

Shisho Cloud, our free checker to make sure your Terraform configuration follows best practices, is available (beta).

Parameters

The time at which the Secret was created.

  • id optional computed - string
  • labels optional - map from string to string

The labels assigned to this Secret. Label keys must be between 1 and 63 characters long, have a UTF-8 encoding of maximum 128 bytes, and must conform to the following PCRE regular expression: [p[Ll]p[Lo]][p[Ll]p[Lo]p[N]_-][0,62] Label values must be between 0 and 63 characters long, have a UTF-8 encoding of maximum 128 bytes, and must conform to the following PCRE regular expression: [p[Ll]p[Lo]p[N]_-][0,63] No more than 64 labels can be assigned to a given resource. An object containing a list of "key": value pairs. Example: [ "name": "wrench", "mass": "1.3kg", "count": "3" ].

  • name optional computed - string

The resource name of the Secret. Format: 'projects/[[project]]/secrets/[[secret_id]]'

This must be unique within the project.

Explanation in Terraform Registry

A Secret is a logical secret whose value and versions can be accessed. To get more information about Secret, see:

Frequently asked questions

What is Google Secret Manager Secret?

Google Secret Manager Secret is a resource for Secret Manager of Google Cloud Platform. Settings can be wrote in Terraform.

Where can I find the example code for the Google Secret Manager Secret?

For Terraform, the nseblu/elo-mystudies, GoogleCloudPlatform/fda-mystudies and Simsulation/budstudies source code examples are useful. See the Terraform Example section for further details.

security-icon

Automate config file reviews on your commits

Fix issues in your infrastructure as code with auto-generated patches.