oci_identity_tag

This resource provides the Tag resource in Oracle Cloud Infrastructure Identity service.

Creates a new tag in the specified tag namespace.

The tag requires either the OCID or the name of the tag namespace that will contain this tag definition.

You must specify a name for the tag, which must be unique across all tags in the tag namespace and cannot be changed. The name can contain any ASCII character except the space (_) or period (.) characters. Names are case insensitive. That means, for example, “myTag” and “mytag” are not allowed in the same namespace. If you specify a name that’s already in use in the tag namespace, a 409 error is returned.

The tag must have a description. It does not have to be unique, and you can change it with UpdateTag.

The tag must have a value type, which is specified with a validator. Tags can use either a static value or a list of possible values. Static values are entered by a user applying the tag to a resource. Lists are created by you and the user must apply a value from the list. Lists are validiated.

Example Usage

resource "oci_identity_tag" "test_tag" {
	#Required
	description = var.tag_description
	name = var.tag_name
	tag_namespace_id = oci_identity_tag_namespace.test_tag_namespace.id

	#Optional
	defined_tags = {"Operations.CostCenter"= "42"}
	freeform_tags = {"Department"= "Finance"}
	is_cost_tracking = var.tag_is_cost_tracking
	validator {
		#Required
		validator_type = var.tag_validator_validator_type
		values = var.tag_validator_values
	}
	is_retired = false
}

Argument Reference

The following arguments are supported:

** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

Attributes Reference

The following attributes are exported:

Timeouts

The timeouts block allows you to specify timeouts for certain operations: * create - (Defaults to 15 minutes), when creating the Tag * update - (Defaults to 15 minutes), when updating the Tag * delete - (Defaults to 12 hours), when destroying the Tag

Import

Tags can be imported using the tagNamespaceId and tagName, e.g.

$ terraform import oci_identity_tag.test_tag "tagNamespaces/{tagNamespaceId}/tags/{tagName}"