Creating a Dynamic Group
When you create a dynamic group, the group is automatically created in the tenancy. You cannot specify a different compartment for the dynamic group.
Writing Matching Rules
A rule specifies one or more conditions for membership in the dynamic group. Type the rule into the text box. To add another rule, select the +Another Matching Rule button.
A rule with a single condition has the following syntax:
variable = | != value
A rule with multiple conditions has the following syntax:
any | all {variable =|!= value, variable =|!= value,...}
variable is one of the following:
-
instance.compartment.id. The OCID of the compartment where the instance resides. -
instance.id. The OCID of the instance. -
tag.tagnamespace.tagkey.value = tagvalue. Thetagnamespace,tagkey, andtagvalueall must match to include this resource in the group. -
tag.tagnamespace.tagkey.value. Only thetagnamespaceandtagkeymust match to include this resource in the group. The value of the tag is not considered.
The following matching rule includes all instances in the specified compartment:
instance.compartment.id = 'ocid1.compartment.unique_ID'
The following matching rule includes all instances in the specified compartment except for
the two instances specified with instance.id !=:
all {instance.compartment.id = 'ocid1.compartment.unique_ID',
instance.id != 'ocid1.instance.unique_ID', instance.id != 'ocid1.instance.unique_ID2'}
The following matching rule includes all instances that have a tag applied that has tag namespace Product1, key ProjectA, and value abc123:
tag.Product1.ProjectA.value = abc123