1. Packages
  2. Google Cloud (GCP) Classic
  3. API Docs
  4. compute
  5. ProjectMetadataItem
Google Cloud Classic v7.29.0 published on Wednesday, Jun 26, 2024 by Pulumi

gcp.compute.ProjectMetadataItem

Explore with Pulumi AI

gcp logo
Google Cloud Classic v7.29.0 published on Wednesday, Jun 26, 2024 by Pulumi

    Manages a single key/value pair on metadata common to all instances for a project in GCE. Using gcp.compute.ProjectMetadataItem lets you manage a single key/value setting in the provider rather than the entire project metadata map.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as gcp from "@pulumi/gcp";
    
    const _default = new gcp.compute.ProjectMetadataItem("default", {
        key: "my_metadata",
        value: "my_value",
    });
    
    import pulumi
    import pulumi_gcp as gcp
    
    default = gcp.compute.ProjectMetadataItem("default",
        key="my_metadata",
        value="my_value")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := compute.NewProjectMetadataItem(ctx, "default", &compute.ProjectMetadataItemArgs{
    			Key:   pulumi.String("my_metadata"),
    			Value: pulumi.String("my_value"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Gcp = Pulumi.Gcp;
    
    return await Deployment.RunAsync(() => 
    {
        var @default = new Gcp.Compute.ProjectMetadataItem("default", new()
        {
            Key = "my_metadata",
            Value = "my_value",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.gcp.compute.ProjectMetadataItem;
    import com.pulumi.gcp.compute.ProjectMetadataItemArgs;
    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 ProjectMetadataItem("default", ProjectMetadataItemArgs.builder()
                .key("my_metadata")
                .value("my_value")
                .build());
    
        }
    }
    
    resources:
      default:
        type: gcp:compute:ProjectMetadataItem
        properties:
          key: my_metadata
          value: my_value
    

    Create ProjectMetadataItem Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new ProjectMetadataItem(name: string, args: ProjectMetadataItemArgs, opts?: CustomResourceOptions);
    @overload
    def ProjectMetadataItem(resource_name: str,
                            args: ProjectMetadataItemArgs,
                            opts: Optional[ResourceOptions] = None)
    
    @overload
    def ProjectMetadataItem(resource_name: str,
                            opts: Optional[ResourceOptions] = None,
                            key: Optional[str] = None,
                            value: Optional[str] = None,
                            project: Optional[str] = None)
    func NewProjectMetadataItem(ctx *Context, name string, args ProjectMetadataItemArgs, opts ...ResourceOption) (*ProjectMetadataItem, error)
    public ProjectMetadataItem(string name, ProjectMetadataItemArgs args, CustomResourceOptions? opts = null)
    public ProjectMetadataItem(String name, ProjectMetadataItemArgs args)
    public ProjectMetadataItem(String name, ProjectMetadataItemArgs args, CustomResourceOptions options)
    
    type: gcp:compute:ProjectMetadataItem
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args ProjectMetadataItemArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args ProjectMetadataItemArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args ProjectMetadataItemArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ProjectMetadataItemArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ProjectMetadataItemArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var projectMetadataItemResource = new Gcp.Compute.ProjectMetadataItem("projectMetadataItemResource", new()
    {
        Key = "string",
        Value = "string",
        Project = "string",
    });
    
    example, err := compute.NewProjectMetadataItem(ctx, "projectMetadataItemResource", &compute.ProjectMetadataItemArgs{
    	Key:     pulumi.String("string"),
    	Value:   pulumi.String("string"),
    	Project: pulumi.String("string"),
    })
    
    var projectMetadataItemResource = new ProjectMetadataItem("projectMetadataItemResource", ProjectMetadataItemArgs.builder()
        .key("string")
        .value("string")
        .project("string")
        .build());
    
    project_metadata_item_resource = gcp.compute.ProjectMetadataItem("projectMetadataItemResource",
        key="string",
        value="string",
        project="string")
    
    const projectMetadataItemResource = new gcp.compute.ProjectMetadataItem("projectMetadataItemResource", {
        key: "string",
        value: "string",
        project: "string",
    });
    
    type: gcp:compute:ProjectMetadataItem
    properties:
        key: string
        project: string
        value: string
    

    ProjectMetadataItem Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    The ProjectMetadataItem resource accepts the following input properties:

    Key string
    The metadata key to set.
    Value string
    The value to set for the given metadata key.


    Project string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    Key string
    The metadata key to set.
    Value string
    The value to set for the given metadata key.


    Project string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    key String
    The metadata key to set.
    value String
    The value to set for the given metadata key.


    project String
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    key string
    The metadata key to set.
    value string
    The value to set for the given metadata key.


    project string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    key str
    The metadata key to set.
    value str
    The value to set for the given metadata key.


    project str
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    key String
    The metadata key to set.
    value String
    The value to set for the given metadata key.


    project String
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the ProjectMetadataItem resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing ProjectMetadataItem Resource

    Get an existing ProjectMetadataItem resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: ProjectMetadataItemState, opts?: CustomResourceOptions): ProjectMetadataItem
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            key: Optional[str] = None,
            project: Optional[str] = None,
            value: Optional[str] = None) -> ProjectMetadataItem
    func GetProjectMetadataItem(ctx *Context, name string, id IDInput, state *ProjectMetadataItemState, opts ...ResourceOption) (*ProjectMetadataItem, error)
    public static ProjectMetadataItem Get(string name, Input<string> id, ProjectMetadataItemState? state, CustomResourceOptions? opts = null)
    public static ProjectMetadataItem get(String name, Output<String> id, ProjectMetadataItemState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    Key string
    The metadata key to set.
    Project string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    Value string
    The value to set for the given metadata key.


    Key string
    The metadata key to set.
    Project string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    Value string
    The value to set for the given metadata key.


    key String
    The metadata key to set.
    project String
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    value String
    The value to set for the given metadata key.


    key string
    The metadata key to set.
    project string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    value string
    The value to set for the given metadata key.


    key str
    The metadata key to set.
    project str
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    value str
    The value to set for the given metadata key.


    key String
    The metadata key to set.
    project String
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    value String
    The value to set for the given metadata key.


    Import

    Project metadata items can be imported using the key, e.g.

    • {{key}}

    When using the pulumi import command, project metadata items can be imported using one of the formats above. For example:

    $ pulumi import gcp:compute/projectMetadataItem:ProjectMetadataItem default {{key}}
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    Google Cloud (GCP) Classic pulumi/pulumi-gcp
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the google-beta Terraform Provider.
    gcp logo
    Google Cloud Classic v7.29.0 published on Wednesday, Jun 26, 2024 by Pulumi