ibm.ResourceTag
Explore with Pulumi AI
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:
- Resource
Id 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
- Resource
Tag stringId - Resource
Type 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 thepulumi up
command. - Tag
Type string - Type of the tag. Supported values are:
user
oraccess
. The default value is user. - List<string>
- List of tags associated with resource instance.
- Timeouts
Resource
Tag Timeouts
- Resource
Id 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
- Resource
Tag stringId - Resource
Type 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 thepulumi up
command. - Tag
Type string - Type of the tag. Supported values are:
user
oraccess
. The default value is user. - []string
- List of tags associated with resource instance.
- Timeouts
Resource
Tag Timeouts Args
- resource
Id 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
- resource
Tag StringId - resource
Type 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 thepulumi up
command. - tag
Type String - Type of the tag. Supported values are:
user
oraccess
. The default value is user. - List<String>
- List of tags associated with resource instance.
- timeouts
Resource
Tag Timeouts
- resource
Id 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
- resource
Tag stringId - resource
Type 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 thepulumi up
command. - tag
Type string - Type of the tag. Supported values are:
user
oraccess
. The default value is user. - string[]
- List of tags associated with resource instance.
- timeouts
Resource
Tag Timeouts
- 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_ strid - 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 thepulumi up
command. - tag_
type str - Type of the tag. Supported values are:
user
oraccess
. The default value is user. - Sequence[str]
- List of tags associated with resource instance.
- timeouts
Resource
Tag Timeouts Args
- resource
Id 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
- resource
Tag StringId - resource
Type 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 thepulumi up
command. - tag
Type String - Type of the tag. Supported values are:
user
oraccess
. The default value is user. - 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:
- 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.
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.
- Account
Id 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
- Resource
Id string - The CRN of the resource on which the tags is be attached.
- Resource
Tag stringId - Resource
Type 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 thepulumi up
command. - Tag
Type string - Type of the tag. Supported values are:
user
oraccess
. The default value is user. - List<string>
- List of tags associated with resource instance.
- Timeouts
Resource
Tag Timeouts
- Account
Id 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
- Resource
Id string - The CRN of the resource on which the tags is be attached.
- Resource
Tag stringId - Resource
Type 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 thepulumi up
command. - Tag
Type string - Type of the tag. Supported values are:
user
oraccess
. The default value is user. - []string
- List of tags associated with resource instance.
- Timeouts
Resource
Tag Timeouts Args
- account
Id 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
- resource
Id String - The CRN of the resource on which the tags is be attached.
- resource
Tag StringId - resource
Type 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 thepulumi up
command. - tag
Type String - Type of the tag. Supported values are:
user
oraccess
. The default value is user. - List<String>
- List of tags associated with resource instance.
- timeouts
Resource
Tag Timeouts
- account
Id 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
- resource
Id string - The CRN of the resource on which the tags is be attached.
- resource
Tag stringId - resource
Type 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 thepulumi up
command. - tag
Type string - Type of the tag. Supported values are:
user
oraccess
. The default value is user. - string[]
- List of tags associated with resource instance.
- timeouts
Resource
Tag Timeouts
- 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_ strid - 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 thepulumi up
command. - tag_
type str - Type of the tag. Supported values are:
user
oraccess
. The default value is user. - Sequence[str]
- List of tags associated with resource instance.
- timeouts
Resource
Tag Timeouts Args
- account
Id 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
- resource
Id String - The CRN of the resource on which the tags is be attached.
- resource
Tag StringId - resource
Type 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 thepulumi up
command. - tag
Type String - Type of the tag. Supported values are:
user
oraccess
. The default value is user. - 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.