Hello guys ,
i am trying to make a policy that tag each resource we create in our organization with the AccountID value.
i have two tags to force:
1) CreatedDate
2) CreatedBy
The "CreatedBy" tag name i cant find any idea how to insert the "AccountID" who created this resource in the tag value.
I saw when i create a kubernetes service that his resources have this TagName CreatedBy that pointing to the kubernetes .. which means that kind of solution already exist i guess.
my policy looks like this :
{
"mode": "All",
"policyRule": {
"if": {
"allOf": [
{
"field": "tags['CreatedOnDate']",
"exists": "false"
},
{
"field": "tags['CreatedBy']",
"exists": "false"
}
]
},
"then": {
"effect": "append",
"details": [
{
"field": "tags['CreatedOnDate']",
"value": "[utcNow()]"
},
{
"field": "tags['CreatedBy']",
"value": [????]
}
]
}
},
"parameters": {}
}