1. Packages
  2. Ucloud Provider
  3. API Docs
  4. LabelAttachment
ucloud 1.39.1 published on Monday, Apr 14, 2025 by ucloud

ucloud.LabelAttachment

Explore with Pulumi AI

ucloud logo
ucloud 1.39.1 published on Monday, Apr 14, 2025 by ucloud

    Provides a label attachment resource.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as ucloud from "@pulumi/ucloud";
    
    const fooVpc = new ucloud.Vpc("fooVpc", {
        cidrBlocks: ["192.168.0.0/16"],
        tag: "tf-acc",
    });
    const fooSubnet = new ucloud.Subnet("fooSubnet", {
        cidrBlock: "192.168.1.0/24",
        tag: "tf-acc",
        vpcId: fooVpc.vpcId,
    });
    const fooVip = new ucloud.Vip("fooVip", {
        remark: "test-update",
        subnetId: fooSubnet.subnetId,
        tag: "tf-acc",
        vpcId: fooVpc.vpcId,
    });
    const fooLabel = new ucloud.Label("fooLabel", {
        key: "tf-acc-label-key",
        value: "tf-acc-label-value",
    });
    const fooLabelAttachment = new ucloud.LabelAttachment("fooLabelAttachment", {
        key: fooLabel.key,
        resource: fooVip.vipId,
        value: fooLabel.value,
    });
    
    import pulumi
    import pulumi_ucloud as ucloud
    
    foo_vpc = ucloud.Vpc("fooVpc",
        cidr_blocks=["192.168.0.0/16"],
        tag="tf-acc")
    foo_subnet = ucloud.Subnet("fooSubnet",
        cidr_block="192.168.1.0/24",
        tag="tf-acc",
        vpc_id=foo_vpc.vpc_id)
    foo_vip = ucloud.Vip("fooVip",
        remark="test-update",
        subnet_id=foo_subnet.subnet_id,
        tag="tf-acc",
        vpc_id=foo_vpc.vpc_id)
    foo_label = ucloud.Label("fooLabel",
        key="tf-acc-label-key",
        value="tf-acc-label-value")
    foo_label_attachment = ucloud.LabelAttachment("fooLabelAttachment",
        key=foo_label.key,
        resource=foo_vip.vip_id,
        value=foo_label.value)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/ucloud/ucloud"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		fooVpc, err := ucloud.NewVpc(ctx, "fooVpc", &ucloud.VpcArgs{
    			CidrBlocks: pulumi.StringArray{
    				pulumi.String("192.168.0.0/16"),
    			},
    			Tag: pulumi.String("tf-acc"),
    		})
    		if err != nil {
    			return err
    		}
    		fooSubnet, err := ucloud.NewSubnet(ctx, "fooSubnet", &ucloud.SubnetArgs{
    			CidrBlock: pulumi.String("192.168.1.0/24"),
    			Tag:       pulumi.String("tf-acc"),
    			VpcId:     fooVpc.VpcId,
    		})
    		if err != nil {
    			return err
    		}
    		fooVip, err := ucloud.NewVip(ctx, "fooVip", &ucloud.VipArgs{
    			Remark:   pulumi.String("test-update"),
    			SubnetId: fooSubnet.SubnetId,
    			Tag:      pulumi.String("tf-acc"),
    			VpcId:    fooVpc.VpcId,
    		})
    		if err != nil {
    			return err
    		}
    		fooLabel, err := ucloud.NewLabel(ctx, "fooLabel", &ucloud.LabelArgs{
    			Key:   pulumi.String("tf-acc-label-key"),
    			Value: pulumi.String("tf-acc-label-value"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = ucloud.NewLabelAttachment(ctx, "fooLabelAttachment", &ucloud.LabelAttachmentArgs{
    			Key:      fooLabel.Key,
    			Resource: fooVip.VipId,
    			Value:    fooLabel.Value,
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Ucloud = Pulumi.Ucloud;
    
    return await Deployment.RunAsync(() => 
    {
        var fooVpc = new Ucloud.Vpc("fooVpc", new()
        {
            CidrBlocks = new[]
            {
                "192.168.0.0/16",
            },
            Tag = "tf-acc",
        });
    
        var fooSubnet = new Ucloud.Subnet("fooSubnet", new()
        {
            CidrBlock = "192.168.1.0/24",
            Tag = "tf-acc",
            VpcId = fooVpc.VpcId,
        });
    
        var fooVip = new Ucloud.Vip("fooVip", new()
        {
            Remark = "test-update",
            SubnetId = fooSubnet.SubnetId,
            Tag = "tf-acc",
            VpcId = fooVpc.VpcId,
        });
    
        var fooLabel = new Ucloud.Label("fooLabel", new()
        {
            Key = "tf-acc-label-key",
            Value = "tf-acc-label-value",
        });
    
        var fooLabelAttachment = new Ucloud.LabelAttachment("fooLabelAttachment", new()
        {
            Key = fooLabel.Key,
            Resource = fooVip.VipId,
            Value = fooLabel.Value,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.ucloud.Vpc;
    import com.pulumi.ucloud.VpcArgs;
    import com.pulumi.ucloud.Subnet;
    import com.pulumi.ucloud.SubnetArgs;
    import com.pulumi.ucloud.Vip;
    import com.pulumi.ucloud.VipArgs;
    import com.pulumi.ucloud.Label;
    import com.pulumi.ucloud.LabelArgs;
    import com.pulumi.ucloud.LabelAttachment;
    import com.pulumi.ucloud.LabelAttachmentArgs;
    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 fooVpc = new Vpc("fooVpc", VpcArgs.builder()
                .cidrBlocks("192.168.0.0/16")
                .tag("tf-acc")
                .build());
    
            var fooSubnet = new Subnet("fooSubnet", SubnetArgs.builder()
                .cidrBlock("192.168.1.0/24")
                .tag("tf-acc")
                .vpcId(fooVpc.vpcId())
                .build());
    
            var fooVip = new Vip("fooVip", VipArgs.builder()
                .remark("test-update")
                .subnetId(fooSubnet.subnetId())
                .tag("tf-acc")
                .vpcId(fooVpc.vpcId())
                .build());
    
            var fooLabel = new Label("fooLabel", LabelArgs.builder()
                .key("tf-acc-label-key")
                .value("tf-acc-label-value")
                .build());
    
            var fooLabelAttachment = new LabelAttachment("fooLabelAttachment", LabelAttachmentArgs.builder()
                .key(fooLabel.key())
                .resource(fooVip.vipId())
                .value(fooLabel.value())
                .build());
    
        }
    }
    
    resources:
      fooVpc:
        type: ucloud:Vpc
        properties:
          cidrBlocks:
            - 192.168.0.0/16
          tag: tf-acc
      fooSubnet:
        type: ucloud:Subnet
        properties:
          cidrBlock: 192.168.1.0/24
          tag: tf-acc
          vpcId: ${fooVpc.vpcId}
      fooVip:
        type: ucloud:Vip
        properties:
          remark: test-update
          subnetId: ${fooSubnet.subnetId}
          tag: tf-acc
          vpcId: ${fooVpc.vpcId}
      fooLabel:
        type: ucloud:Label
        properties:
          key: tf-acc-label-key
          value: tf-acc-label-value
      fooLabelAttachment:
        type: ucloud:LabelAttachment
        properties:
          key: ${fooLabel.key}
          resource: ${fooVip.vipId}
          value: ${fooLabel.value}
    

    Create LabelAttachment Resource

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

    Constructor syntax

    new LabelAttachment(name: string, args: LabelAttachmentArgs, opts?: CustomResourceOptions);
    @overload
    def LabelAttachment(resource_name: str,
                        args: LabelAttachmentArgs,
                        opts: Optional[ResourceOptions] = None)
    
    @overload
    def LabelAttachment(resource_name: str,
                        opts: Optional[ResourceOptions] = None,
                        key: Optional[str] = None,
                        resource: Optional[str] = None,
                        value: Optional[str] = None,
                        label_attachment_id: Optional[str] = None)
    func NewLabelAttachment(ctx *Context, name string, args LabelAttachmentArgs, opts ...ResourceOption) (*LabelAttachment, error)
    public LabelAttachment(string name, LabelAttachmentArgs args, CustomResourceOptions? opts = null)
    public LabelAttachment(String name, LabelAttachmentArgs args)
    public LabelAttachment(String name, LabelAttachmentArgs args, CustomResourceOptions options)
    
    type: ucloud:LabelAttachment
    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 LabelAttachmentArgs
    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 LabelAttachmentArgs
    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 LabelAttachmentArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args LabelAttachmentArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args LabelAttachmentArgs
    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 labelAttachmentResource = new Ucloud.LabelAttachment("labelAttachmentResource", new()
    {
        Key = "string",
        Resource = "string",
        Value = "string",
        LabelAttachmentId = "string",
    });
    
    example, err := ucloud.NewLabelAttachment(ctx, "labelAttachmentResource", &ucloud.LabelAttachmentArgs{
    Key: pulumi.String("string"),
    Resource: pulumi.String("string"),
    Value: pulumi.String("string"),
    LabelAttachmentId: pulumi.String("string"),
    })
    
    var labelAttachmentResource = new LabelAttachment("labelAttachmentResource", LabelAttachmentArgs.builder()
        .key("string")
        .resource("string")
        .value("string")
        .labelAttachmentId("string")
        .build());
    
    label_attachment_resource = ucloud.LabelAttachment("labelAttachmentResource",
        key="string",
        resource="string",
        value="string",
        label_attachment_id="string")
    
    const labelAttachmentResource = new ucloud.LabelAttachment("labelAttachmentResource", {
        key: "string",
        resource: "string",
        value: "string",
        labelAttachmentId: "string",
    });
    
    type: ucloud:LabelAttachment
    properties:
        key: string
        labelAttachmentId: string
        resource: string
        value: string
    

    LabelAttachment Resource Properties

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

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The LabelAttachment resource accepts the following input properties:

    Key string
    key of the label.
    Resource string
    id of the attached resource, for example vip-xxx.
    Value string
    value of the label
    LabelAttachmentId string
    Key string
    key of the label.
    Resource string
    id of the attached resource, for example vip-xxx.
    Value string
    value of the label
    LabelAttachmentId string
    key String
    key of the label.
    resource String
    id of the attached resource, for example vip-xxx.
    value String
    value of the label
    labelAttachmentId String
    key string
    key of the label.
    resource string
    id of the attached resource, for example vip-xxx.
    value string
    value of the label
    labelAttachmentId string
    key str
    key of the label.
    resource str
    id of the attached resource, for example vip-xxx.
    value str
    value of the label
    label_attachment_id str
    key String
    key of the label.
    resource String
    id of the attached resource, for example vip-xxx.
    value String
    value of the label
    labelAttachmentId String

    Outputs

    All input properties are implicitly available as output properties. Additionally, the LabelAttachment 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 LabelAttachment Resource

    Get an existing LabelAttachment 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?: LabelAttachmentState, opts?: CustomResourceOptions): LabelAttachment
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            key: Optional[str] = None,
            label_attachment_id: Optional[str] = None,
            resource: Optional[str] = None,
            value: Optional[str] = None) -> LabelAttachment
    func GetLabelAttachment(ctx *Context, name string, id IDInput, state *LabelAttachmentState, opts ...ResourceOption) (*LabelAttachment, error)
    public static LabelAttachment Get(string name, Input<string> id, LabelAttachmentState? state, CustomResourceOptions? opts = null)
    public static LabelAttachment get(String name, Output<String> id, LabelAttachmentState state, CustomResourceOptions options)
    resources:  _:    type: ucloud:LabelAttachment    get:      id: ${id}
    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
    key of the label.
    LabelAttachmentId string
    Resource string
    id of the attached resource, for example vip-xxx.
    Value string
    value of the label
    Key string
    key of the label.
    LabelAttachmentId string
    Resource string
    id of the attached resource, for example vip-xxx.
    Value string
    value of the label
    key String
    key of the label.
    labelAttachmentId String
    resource String
    id of the attached resource, for example vip-xxx.
    value String
    value of the label
    key string
    key of the label.
    labelAttachmentId string
    resource string
    id of the attached resource, for example vip-xxx.
    value string
    value of the label
    key str
    key of the label.
    label_attachment_id str
    resource str
    id of the attached resource, for example vip-xxx.
    value str
    value of the label
    key String
    key of the label.
    labelAttachmentId String
    resource String
    id of the attached resource, for example vip-xxx.
    value String
    value of the label

    Package Details

    Repository
    ucloud ucloud/terraform-provider-ucloud
    License
    Notes
    This Pulumi package is based on the ucloud Terraform Provider.
    ucloud logo
    ucloud 1.39.1 published on Monday, Apr 14, 2025 by ucloud