import * as pulumi from "@pulumi/pulumi"; /** * The `vsphere.Tag` resource can be used to create and manage tags, which allow * you to attach metadata to objects in the vSphere inventory to make these * objects more sortable and searchable. * * For more information about tags, click [here][ext-tags-general]. * * [ext-tags-general]: https://techdocs.broadcom.com/us/en/vmware-cis/vsphere/vsphere/8-0/vsphere-tags-and-attributes.html * * ## Example Usage * * This example creates a tag named `test-tag`. This tag is assigned the * `test-category` category, which was created by the * `vsphere.TagCategory` resource. The resulting * tag can be assigned to VMs and datastores only, and can be the only value in * the category that can be assigned, as per the restrictions defined by the * category. * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as vsphere from "@pulumi/vsphere"; * * const category = new vsphere.TagCategory("category", { * name: "test-category", * cardinality: "SINGLE", * description: "Managed by Pulumi", * associableTypes: [ * "VirtualMachine", * "Datastore", * ], * }); * const tag = new vsphere.Tag("tag", { * name: "test-tag", * categoryId: category.id, * description: "Managed by Pulumi", * }); * ``` * * ### Using Tags in a Supported Resource * * Tags can be applied to vSphere resources via the `tags` argument * in any supported resource. * * The following example builds on the above example by creating a * `vsphere.VirtualMachine` and applying the * created tag to it: * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as vsphere from "@pulumi/vsphere"; * * const category = new vsphere.TagCategory("category", { * name: "test-category", * cardinality: "SINGLE", * description: "Managed by Pulumi", * associableTypes: [ * "VirtualMachine", * "Datastore", * ], * }); * const tag = new vsphere.Tag("tag", { * name: "test-tag", * categoryId: category.id, * description: "Managed by Pulumi", * }); * const web = new vsphere.VirtualMachine("web", {tags: [tag.id]}); * ``` * * ## Import * * An existing tag can be imported into this resource by supplying * * both the tag's category name and the name of the tag as a JSON string to * * `pulumi import`, as per the example below: * * [docs-import]: https://developer.hashicorp.com/terraform/cli/import * * ```sh * $ pulumi import vsphere:index/tag:Tag tag \ * ``` * * '{"category_name": "pulumi-test-category", "tag_name": "pulumi-test-tag"}' */ export declare class Tag extends pulumi.CustomResource { /** * Get an existing Tag resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state Any extra arguments used during the lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ static get(name: string, id: pulumi.Input, state?: TagState, opts?: pulumi.CustomResourceOptions): Tag; /** * Returns true if the given object is an instance of Tag. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj: any): obj is Tag; /** * The unique identifier of the parent category in * which this tag will be created. Forces a new resource if changed. */ readonly categoryId: pulumi.Output; /** * A description for the tag. */ readonly description: pulumi.Output; /** * The display name of the tag. The name must be unique * within its category. */ readonly name: pulumi.Output; /** * Create a Tag resource with the given unique name, arguments, and options. * * @param name The _unique_ name of the resource. * @param args The arguments to use to populate this resource's properties. * @param opts A bag of options that control this resource's behavior. */ constructor(name: string, args: TagArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering Tag resources. */ export interface TagState { /** * The unique identifier of the parent category in * which this tag will be created. Forces a new resource if changed. */ categoryId?: pulumi.Input; /** * A description for the tag. */ description?: pulumi.Input; /** * The display name of the tag. The name must be unique * within its category. */ name?: pulumi.Input; } /** * The set of arguments for constructing a Tag resource. */ export interface TagArgs { /** * The unique identifier of the parent category in * which this tag will be created. Forces a new resource if changed. */ categoryId: pulumi.Input; /** * A description for the tag. */ description?: pulumi.Input; /** * The display name of the tag. The name must be unique * within its category. */ name?: pulumi.Input; }