Skip to content

googleComputeProjectMetadata

Authoritatively manages metadata common to all instances for a project in GCE. For more information see the official documentation and API.

\~> Note: This resource manages all project-level metadata including project-level ssh keys. Keys unset in config but set on the server will be removed. If you want to manage only single key/value pairs within the project metadata rather than the entire set, then use google_compute_project_metadata_item.

Example Usage

/*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.*/
new google.computeProjectMetadata.ComputeProjectMetadata(this, "default", {
  metadata: [
    {
      13: "42",
      fizz: "buzz",
      foo: "bar",
    },
  ],
});

Example Usage - Adding an SSH Key

/*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.*/
new google.computeProjectMetadata.ComputeProjectMetadata(this, "my_ssh_key", {
  metadata: [
    {
      "ssh-keys":
        "      dev:ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILg6UtHDNyMNAh0GjaytsJdrUxjtLy3APXqZfNZhvCeT dev\n      foo:ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILg6UtHDNyMNAh0GjaytsJdrUxjtLy3APXqZfNZhvCeT bar\n",
    },
  ],
});

Argument Reference

The following arguments are supported:

  • metadata - (Required) A series of key value pairs.

  • 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 {{project}}

Timeouts

This resource provides the following Timeouts configuration options: configuration options:

  • create - Default is 4 minutes (also used for update).
  • delete - Default is 4 minutes.

Import

This resource can be imported using the project ID:

terraformImportGoogleComputeProjectMetadataFooMyProjectId