Tag Governance policy Tag Key & Value Policy validate several tags at thee same time

john_wenzel
Giga Contributor

On my Tag Key & Value Checks I have 3 items

 

tag1
tag2
tag3

 

I also have a table called my_tags which contain correlated values.

 

So I need a script that determines that the cloud resource has the vale of tag1 set, however if it is set I need to make sure the value of tag1 also correlates to the values of tag2 and tag3 dependent of the value set in my_tags.

 

I know how to make sure the tag1 value is set and that it matches a value within the my_tags table, however I am not sure how to get the value of tag2 in that same script so that I can make sure it matches in the table.

 

Anyone have advice for me to get all of the tag values in a single script?

 

Example

Table - my_tags

tag1  - tag2 - tag3

------------------------

aa1     aa2     aa3

bb1     bb2    bb3

cc1      cc2     cc3

 

Resource 1

tag1=empty

tag2=aa2

tag3=aa3

 

Policy should fail and user should be advised that the tag is not set and that it should be set to aa1

 

Resource 2

tag1=bb1

tag2=bb2

tag3=bb3

 

Policy passes

 

Resource 3

tag1=cc1

tag2=cc2

tag3=bb3

 

Policy should fail and user should be advised that the tag values are mismatched and that tag3 should be set to cc3 or that tag1 and tag2 should be set to bb1 and bb2.

 

 

Thanks,

0 REPLIES 0