Class ProjectMetadata


  • public class ProjectMetadata
    extends com.pulumi.resources.CustomResource
    Authoritatively manages metadata common to all instances for a project in GCE. For more information see [the official documentation](https://cloud.google.com/compute/docs/storing-retrieving-metadata) and [API](https://cloud.google.com/compute/docs/reference/latest/projects/setCommonInstanceMetadata). > **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 ```java package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.gcp.compute.ProjectMetadata; import com.pulumi.gcp.compute.ProjectMetadataArgs; import java.util.List; import java.util.ArrayList; import java.util.Map; import java.io.File; import java.nio.file.Files; import java.nio.file.Paths; public class App { public static void main(String[] args) { Pulumi.run(App::stack); } public static void stack(Context ctx) { var default_ = new ProjectMetadata("default", ProjectMetadataArgs.builder() .metadata(Map.ofEntries( Map.entry("13", "42"), Map.entry("fizz", "buzz"), Map.entry("foo", "bar") )) .build()); } } ``` ### Adding An SSH Key ```java package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.gcp.compute.ProjectMetadata; import com.pulumi.gcp.compute.ProjectMetadataArgs; import java.util.List; import java.util.ArrayList; import java.util.Map; import java.io.File; import java.nio.file.Files; import java.nio.file.Paths; public class App { public static void main(String[] args) { Pulumi.run(App::stack); } public static void stack(Context ctx) { var mySshKey = new ProjectMetadata("mySshKey", ProjectMetadataArgs.builder() .metadata(Map.of("ssh-keys", """ dev:ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILg6UtHDNyMNAh0GjaytsJdrUxjtLy3APXqZfNZhvCeT dev foo:ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILg6UtHDNyMNAh0GjaytsJdrUxjtLy3APXqZfNZhvCeT bar """)) .build()); } } ``` ## Import Project metadata can be imported using the project ID* `{{project_id}}` In Terraform v1.5.0 and later, use an [`import` block](https://developer.hashicorp.com/terraform/language/import) to import project metadata using one of the formats above. For exampletf import { id = "{{project_id}}" to = google_compute_project_metadata.default } ```sh $ pulumi import gcp:compute/projectMetadata:ProjectMetadata When using the [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import), project metadata can be imported using one of the formats above. For example ``` ```sh $ pulumi import gcp:compute/projectMetadata:ProjectMetadata default {{project_id}} ```
    • Nested Class Summary

      • Nested classes/interfaces inherited from class com.pulumi.resources.CustomResource

        com.pulumi.resources.CustomResource.CustomResourceInternal
      • Nested classes/interfaces inherited from class com.pulumi.resources.Resource

        com.pulumi.resources.Resource.LazyField<T extends java.lang.Object>, com.pulumi.resources.Resource.LazyFields, com.pulumi.resources.Resource.ResourceInternal
    • Field Summary

      • Fields inherited from class com.pulumi.resources.Resource

        childResources, remote
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static ProjectMetadata get​(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, ProjectMetadataState state, com.pulumi.resources.CustomResourceOptions options)
      Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
      com.pulumi.core.Output<java.util.Map<java.lang.String,​java.lang.String>> metadata()  
      com.pulumi.core.Output<java.lang.String> project()  
      • Methods inherited from class com.pulumi.resources.CustomResource

        getId, id, idFuture
      • Methods inherited from class com.pulumi.resources.Resource

        getChildResources, getResourceName, getResourceType, getUrn, pulumiChildResources, pulumiResourceName, pulumiResourceType, urn
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ProjectMetadata

        public ProjectMetadata​(java.lang.String name)
        Parameters:
        name - The _unique_ name of the resulting resource.
      • ProjectMetadata

        public ProjectMetadata​(java.lang.String name,
                               ProjectMetadataArgs args)
        Parameters:
        name - The _unique_ name of the resulting resource.
        args - The arguments to use to populate this resource's properties.
      • ProjectMetadata

        public ProjectMetadata​(java.lang.String name,
                               ProjectMetadataArgs args,
                               @Nullable
                               com.pulumi.resources.CustomResourceOptions options)
        Parameters:
        name - The _unique_ name of the resulting resource.
        args - The arguments to use to populate this resource's properties.
        options - A bag of options that control this resource's behavior.
    • Method Detail

      • metadata

        public com.pulumi.core.Output<java.util.Map<java.lang.String,​java.lang.String>> metadata()
        Returns:
        A series of key value pairs. ***
      • project

        public com.pulumi.core.Output<java.lang.String> project()
        Returns:
        The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
      • get

        public static ProjectMetadata get​(java.lang.String name,
                                          com.pulumi.core.Output<java.lang.String> id,
                                          @Nullable
                                          ProjectMetadataState state,
                                          @Nullable
                                          com.pulumi.resources.CustomResourceOptions options)
        Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
        Parameters:
        name - The _unique_ name of the resulting resource.
        id - The _unique_ provider ID of the resource to lookup.
        state -
        options - Optional settings to control the behavior of the CustomResource.