1. Packages
  2. Ibm Provider
  3. API Docs
  4. ResourceTag
ibm 1.78.0 published on Wednesday, Apr 30, 2025 by ibm-cloud

ibm.ResourceTag

Explore with Pulumi AI

ibm logo
ibm 1.78.0 published on Wednesday, Apr 30, 2025 by ibm-cloud

    Create, update, or delete IBM Cloud resource tags. For more information, about tagging, see IBM Cloud resource tags.

    Example Usage

    The following example enables you to attach resource tags

    Coming soon!
    
    Coming soon!
    
    Coming soon!
    
    Coming soon!
    
    Coming soon!
    
    resources:
      tag:
        type: ibm:ResourceTag
        properties:
          resourceId: ${ibm_satellite_location.location.crn}
          tags: ${var.tag_names}
      tagWithTimeout:
        type: ibm:ResourceTag
        properties:
          resourceId: ${ibm_satellite_location.location.crn}
          tags: ${var.tag_names}
          timeout:
            - create: 45s
    variables:
      location:
        fn::invoke:
          function: ibm:getSatelliteLocation
          arguments:
            location: ${var.location}
    

    Attributes reference

    In addition to all argument reference list, you can access the following attribute reference after your resource is created.

    • id - (String) The unique identifier of the resource tag.
    • acccount_id - (String) The ID of an account that owns the resources to be tagged. This is required if tag-type is set to service.

    Create ResourceTag Resource

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

    Constructor syntax

    new ResourceTag(name: string, args: ResourceTagArgs, opts?: CustomResourceOptions);
    @overload
    def ResourceTag(resource_name: str,
                    args: ResourceTagArgs,
                    opts: Optional[ResourceOptions] = None)
    
    @overload
    def ResourceTag(resource_name: str,
                    opts: Optional[ResourceOptions] = None,
                    resource_id: Optional[str] = None,
                    replace: Optional[bool] = None,
                    resource_tag_id: Optional[str] = None,
                    resource_type: Optional[str] = None,
                    tag_type: Optional[str] = None,
                    tags: Optional[Sequence[str]] = None,
                    timeouts: Optional[ResourceTagTimeoutsArgs] = None)
    func NewResourceTag(ctx *Context, name string, args ResourceTagArgs, opts ...ResourceOption) (*ResourceTag, error)
    public ResourceTag(string name, ResourceTagArgs args, CustomResourceOptions? opts = null)
    public ResourceTag(String name, ResourceTagArgs args)
    public ResourceTag(String name, ResourceTagArgs args, CustomResourceOptions options)
    
    type: ibm:ResourceTag
    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 ResourceTagArgs
    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 ResourceTagArgs
    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 ResourceTagArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ResourceTagArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ResourceTagArgs
    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 resourceTagResource = new Ibm.ResourceTag("resourceTagResource", new()
    {
        ResourceId = "string",
        Replace = false,
        ResourceTagId = "string",
        ResourceType = "string",
        TagType = "string",
        Tags = new[]
        {
            "string",
        },
        Timeouts = new Ibm.Inputs.ResourceTagTimeoutsArgs
        {
            Create = "string",
        },
    });
    
    example, err := ibm.NewResourceTag(ctx, "resourceTagResource", &ibm.ResourceTagArgs{
    	ResourceId:    pulumi.String("string"),
    	Replace:       pulumi.Bool(false),
    	ResourceTagId: pulumi.String("string"),
    	ResourceType:  pulumi.String("string"),
    	TagType:       pulumi.String("string"),
    	Tags: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    	Timeouts: &ibm.ResourceTagTimeoutsArgs{
    		Create: pulumi.String("string"),
    	},
    })
    
    var resourceTagResource = new ResourceTag("resourceTagResource", ResourceTagArgs.builder()
        .resourceId("string")
        .replace(false)
        .resourceTagId("string")
        .resourceType("string")
        .tagType("string")
        .tags("string")
        .timeouts(ResourceTagTimeoutsArgs.builder()
            .create("string")
            .build())
        .build());
    
    resource_tag_resource = ibm.ResourceTag("resourceTagResource",
        resource_id="string",
        replace=False,
        resource_tag_id="string",
        resource_type="string",
        tag_type="string",
        tags=["string"],
        timeouts={
            "create": "string",
        })
    
    const resourceTagResource = new ibm.ResourceTag("resourceTagResource", {
        resourceId: "string",
        replace: false,
        resourceTagId: "string",
        resourceType: "string",
        tagType: "string",
        tags: ["string"],
        timeouts: {
            create: "string",
        },
    });
    
    type: ibm:ResourceTag
    properties:
        replace: false
        resourceId: string
        resourceTagId: string
        resourceType: string
        tagType: string
        tags:
            - string
        timeouts:
            create: string
    

    ResourceTag 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 ResourceTag resource accepts the following input properties:

    ResourceId string
    The CRN of the resource on which the tags is be attached.
    Replace bool
    If true, it indicates that the attaching operation is a replacement operation
    ResourceTagId string
    ResourceType string
    The resource type on which the tags should be attached. This is valid for Classic Infrastructure resources only. The resource_type allowed values are: SoftLayer_Virtual_DedicatedHost, SoftLayer_Hardware, SoftLayer_Hardware_Server, SoftLayer_Network_Application_Delivery_Controller, SoftLayer_Network_Vlan, SoftLayer_Network_Vlan_Firewall, SoftLayer_Network_Component_Firewall, SoftLayer_Network_Firewall_Module_Context, SoftLayer_Virtual_Guest. A wrong value would result in an error in the pulumi up command.
    TagType string
    Type of the tag. Supported values are: user or access. The default value is user.
    Tags List<string>
    List of tags associated with resource instance.
    Timeouts ResourceTagTimeouts
    ResourceId string
    The CRN of the resource on which the tags is be attached.
    Replace bool
    If true, it indicates that the attaching operation is a replacement operation
    ResourceTagId string
    ResourceType string
    The resource type on which the tags should be attached. This is valid for Classic Infrastructure resources only. The resource_type allowed values are: SoftLayer_Virtual_DedicatedHost, SoftLayer_Hardware, SoftLayer_Hardware_Server, SoftLayer_Network_Application_Delivery_Controller, SoftLayer_Network_Vlan, SoftLayer_Network_Vlan_Firewall, SoftLayer_Network_Component_Firewall, SoftLayer_Network_Firewall_Module_Context, SoftLayer_Virtual_Guest. A wrong value would result in an error in the pulumi up command.
    TagType string
    Type of the tag. Supported values are: user or access. The default value is user.
    Tags []string
    List of tags associated with resource instance.
    Timeouts ResourceTagTimeoutsArgs
    resourceId String
    The CRN of the resource on which the tags is be attached.
    replace Boolean
    If true, it indicates that the attaching operation is a replacement operation
    resourceTagId String
    resourceType String
    The resource type on which the tags should be attached. This is valid for Classic Infrastructure resources only. The resource_type allowed values are: SoftLayer_Virtual_DedicatedHost, SoftLayer_Hardware, SoftLayer_Hardware_Server, SoftLayer_Network_Application_Delivery_Controller, SoftLayer_Network_Vlan, SoftLayer_Network_Vlan_Firewall, SoftLayer_Network_Component_Firewall, SoftLayer_Network_Firewall_Module_Context, SoftLayer_Virtual_Guest. A wrong value would result in an error in the pulumi up command.
    tagType String
    Type of the tag. Supported values are: user or access. The default value is user.
    tags List<String>
    List of tags associated with resource instance.
    timeouts ResourceTagTimeouts
    resourceId string
    The CRN of the resource on which the tags is be attached.
    replace boolean
    If true, it indicates that the attaching operation is a replacement operation
    resourceTagId string
    resourceType string
    The resource type on which the tags should be attached. This is valid for Classic Infrastructure resources only. The resource_type allowed values are: SoftLayer_Virtual_DedicatedHost, SoftLayer_Hardware, SoftLayer_Hardware_Server, SoftLayer_Network_Application_Delivery_Controller, SoftLayer_Network_Vlan, SoftLayer_Network_Vlan_Firewall, SoftLayer_Network_Component_Firewall, SoftLayer_Network_Firewall_Module_Context, SoftLayer_Virtual_Guest. A wrong value would result in an error in the pulumi up command.
    tagType string
    Type of the tag. Supported values are: user or access. The default value is user.
    tags string[]
    List of tags associated with resource instance.
    timeouts ResourceTagTimeouts
    resource_id str
    The CRN of the resource on which the tags is be attached.
    replace bool
    If true, it indicates that the attaching operation is a replacement operation
    resource_tag_id str
    resource_type str
    The resource type on which the tags should be attached. This is valid for Classic Infrastructure resources only. The resource_type allowed values are: SoftLayer_Virtual_DedicatedHost, SoftLayer_Hardware, SoftLayer_Hardware_Server, SoftLayer_Network_Application_Delivery_Controller, SoftLayer_Network_Vlan, SoftLayer_Network_Vlan_Firewall, SoftLayer_Network_Component_Firewall, SoftLayer_Network_Firewall_Module_Context, SoftLayer_Virtual_Guest. A wrong value would result in an error in the pulumi up command.
    tag_type str
    Type of the tag. Supported values are: user or access. The default value is user.
    tags Sequence[str]
    List of tags associated with resource instance.
    timeouts ResourceTagTimeoutsArgs
    resourceId String
    The CRN of the resource on which the tags is be attached.
    replace Boolean
    If true, it indicates that the attaching operation is a replacement operation
    resourceTagId String
    resourceType String
    The resource type on which the tags should be attached. This is valid for Classic Infrastructure resources only. The resource_type allowed values are: SoftLayer_Virtual_DedicatedHost, SoftLayer_Hardware, SoftLayer_Hardware_Server, SoftLayer_Network_Application_Delivery_Controller, SoftLayer_Network_Vlan, SoftLayer_Network_Vlan_Firewall, SoftLayer_Network_Component_Firewall, SoftLayer_Network_Firewall_Module_Context, SoftLayer_Virtual_Guest. A wrong value would result in an error in the pulumi up command.
    tagType String
    Type of the tag. Supported values are: user or access. The default value is user.
    tags List<String>
    List of tags associated with resource instance.
    timeouts Property Map

    Outputs

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

    AccountId string
    The ID of the account that owns the resources to be tagged (required if tag-type is set to service)
    Id string
    The provider-assigned unique ID for this managed resource.
    AccountId string
    The ID of the account that owns the resources to be tagged (required if tag-type is set to service)
    Id string
    The provider-assigned unique ID for this managed resource.
    accountId String
    The ID of the account that owns the resources to be tagged (required if tag-type is set to service)
    id String
    The provider-assigned unique ID for this managed resource.
    accountId string
    The ID of the account that owns the resources to be tagged (required if tag-type is set to service)
    id string
    The provider-assigned unique ID for this managed resource.
    account_id str
    The ID of the account that owns the resources to be tagged (required if tag-type is set to service)
    id str
    The provider-assigned unique ID for this managed resource.
    accountId String
    The ID of the account that owns the resources to be tagged (required if tag-type is set to service)
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing ResourceTag Resource

    Get an existing ResourceTag 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?: ResourceTagState, opts?: CustomResourceOptions): ResourceTag
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            account_id: Optional[str] = None,
            replace: Optional[bool] = None,
            resource_id: Optional[str] = None,
            resource_tag_id: Optional[str] = None,
            resource_type: Optional[str] = None,
            tag_type: Optional[str] = None,
            tags: Optional[Sequence[str]] = None,
            timeouts: Optional[ResourceTagTimeoutsArgs] = None) -> ResourceTag
    func GetResourceTag(ctx *Context, name string, id IDInput, state *ResourceTagState, opts ...ResourceOption) (*ResourceTag, error)
    public static ResourceTag Get(string name, Input<string> id, ResourceTagState? state, CustomResourceOptions? opts = null)
    public static ResourceTag get(String name, Output<String> id, ResourceTagState state, CustomResourceOptions options)
    resources:  _:    type: ibm:ResourceTag    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:
    AccountId string
    The ID of the account that owns the resources to be tagged (required if tag-type is set to service)
    Replace bool
    If true, it indicates that the attaching operation is a replacement operation
    ResourceId string
    The CRN of the resource on which the tags is be attached.
    ResourceTagId string
    ResourceType string
    The resource type on which the tags should be attached. This is valid for Classic Infrastructure resources only. The resource_type allowed values are: SoftLayer_Virtual_DedicatedHost, SoftLayer_Hardware, SoftLayer_Hardware_Server, SoftLayer_Network_Application_Delivery_Controller, SoftLayer_Network_Vlan, SoftLayer_Network_Vlan_Firewall, SoftLayer_Network_Component_Firewall, SoftLayer_Network_Firewall_Module_Context, SoftLayer_Virtual_Guest. A wrong value would result in an error in the pulumi up command.
    TagType string
    Type of the tag. Supported values are: user or access. The default value is user.
    Tags List<string>
    List of tags associated with resource instance.
    Timeouts ResourceTagTimeouts
    AccountId string
    The ID of the account that owns the resources to be tagged (required if tag-type is set to service)
    Replace bool
    If true, it indicates that the attaching operation is a replacement operation
    ResourceId string
    The CRN of the resource on which the tags is be attached.
    ResourceTagId string
    ResourceType string
    The resource type on which the tags should be attached. This is valid for Classic Infrastructure resources only. The resource_type allowed values are: SoftLayer_Virtual_DedicatedHost, SoftLayer_Hardware, SoftLayer_Hardware_Server, SoftLayer_Network_Application_Delivery_Controller, SoftLayer_Network_Vlan, SoftLayer_Network_Vlan_Firewall, SoftLayer_Network_Component_Firewall, SoftLayer_Network_Firewall_Module_Context, SoftLayer_Virtual_Guest. A wrong value would result in an error in the pulumi up command.
    TagType string
    Type of the tag. Supported values are: user or access. The default value is user.
    Tags []string
    List of tags associated with resource instance.
    Timeouts ResourceTagTimeoutsArgs
    accountId String
    The ID of the account that owns the resources to be tagged (required if tag-type is set to service)
    replace Boolean
    If true, it indicates that the attaching operation is a replacement operation
    resourceId String
    The CRN of the resource on which the tags is be attached.
    resourceTagId String
    resourceType String
    The resource type on which the tags should be attached. This is valid for Classic Infrastructure resources only. The resource_type allowed values are: SoftLayer_Virtual_DedicatedHost, SoftLayer_Hardware, SoftLayer_Hardware_Server, SoftLayer_Network_Application_Delivery_Controller, SoftLayer_Network_Vlan, SoftLayer_Network_Vlan_Firewall, SoftLayer_Network_Component_Firewall, SoftLayer_Network_Firewall_Module_Context, SoftLayer_Virtual_Guest. A wrong value would result in an error in the pulumi up command.
    tagType String
    Type of the tag. Supported values are: user or access. The default value is user.
    tags List<String>
    List of tags associated with resource instance.
    timeouts ResourceTagTimeouts
    accountId string
    The ID of the account that owns the resources to be tagged (required if tag-type is set to service)
    replace boolean
    If true, it indicates that the attaching operation is a replacement operation
    resourceId string
    The CRN of the resource on which the tags is be attached.
    resourceTagId string
    resourceType string
    The resource type on which the tags should be attached. This is valid for Classic Infrastructure resources only. The resource_type allowed values are: SoftLayer_Virtual_DedicatedHost, SoftLayer_Hardware, SoftLayer_Hardware_Server, SoftLayer_Network_Application_Delivery_Controller, SoftLayer_Network_Vlan, SoftLayer_Network_Vlan_Firewall, SoftLayer_Network_Component_Firewall, SoftLayer_Network_Firewall_Module_Context, SoftLayer_Virtual_Guest. A wrong value would result in an error in the pulumi up command.
    tagType string
    Type of the tag. Supported values are: user or access. The default value is user.
    tags string[]
    List of tags associated with resource instance.
    timeouts ResourceTagTimeouts
    account_id str
    The ID of the account that owns the resources to be tagged (required if tag-type is set to service)
    replace bool
    If true, it indicates that the attaching operation is a replacement operation
    resource_id str
    The CRN of the resource on which the tags is be attached.
    resource_tag_id str
    resource_type str
    The resource type on which the tags should be attached. This is valid for Classic Infrastructure resources only. The resource_type allowed values are: SoftLayer_Virtual_DedicatedHost, SoftLayer_Hardware, SoftLayer_Hardware_Server, SoftLayer_Network_Application_Delivery_Controller, SoftLayer_Network_Vlan, SoftLayer_Network_Vlan_Firewall, SoftLayer_Network_Component_Firewall, SoftLayer_Network_Firewall_Module_Context, SoftLayer_Virtual_Guest. A wrong value would result in an error in the pulumi up command.
    tag_type str
    Type of the tag. Supported values are: user or access. The default value is user.
    tags Sequence[str]
    List of tags associated with resource instance.
    timeouts ResourceTagTimeoutsArgs
    accountId String
    The ID of the account that owns the resources to be tagged (required if tag-type is set to service)
    replace Boolean
    If true, it indicates that the attaching operation is a replacement operation
    resourceId String
    The CRN of the resource on which the tags is be attached.
    resourceTagId String
    resourceType String
    The resource type on which the tags should be attached. This is valid for Classic Infrastructure resources only. The resource_type allowed values are: SoftLayer_Virtual_DedicatedHost, SoftLayer_Hardware, SoftLayer_Hardware_Server, SoftLayer_Network_Application_Delivery_Controller, SoftLayer_Network_Vlan, SoftLayer_Network_Vlan_Firewall, SoftLayer_Network_Component_Firewall, SoftLayer_Network_Firewall_Module_Context, SoftLayer_Virtual_Guest. A wrong value would result in an error in the pulumi up command.
    tagType String
    Type of the tag. Supported values are: user or access. The default value is user.
    tags List<String>
    List of tags associated with resource instance.
    timeouts Property Map

    Supporting Types

    ResourceTagTimeouts, ResourceTagTimeoutsArgs

    Create string
    Create string
    create String
    create string
    create str
    create String

    Import

    The ibm_resource_tag resource can be imported by using the resource CRN.

    Syntax

    $ pulumi import ibm:index/resourceTag:ResourceTag tag resource_id
    

    Example

    $ pulumi import ibm:index/resourceTag:ResourceTag tag crn:v1:bluemix:public:satellite:us-east:a/ab3ed67929c2a81285fbb5f9eb22800a:c1ga7h9w0angomd44654::
    

    Example for importing classic infrastructure tags.

    Syntax

    $ pulumi import ibm:index/resourceTag:ResourceTag tag resource_id/resource_type
    

    Example

    $ pulumi import ibm:index/resourceTag:ResourceTag tag 118398132/SoftLayer_Virtual_Guest
    

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

    Package Details

    Repository
    ibm ibm-cloud/terraform-provider-ibm
    License
    Notes
    This Pulumi package is based on the ibm Terraform Provider.
    ibm logo
    ibm 1.78.0 published on Wednesday, Apr 30, 2025 by ibm-cloud