Tag Policies: Account shows as compliant despite non-compliant resources

0

Hi,

I am looking to play around with Tag policies. I've created a policy which states I expect Name, Owner and Cost Code as mandatory tags.

Name & Owner I want to enforce any value for:
ec2:image
ec2:instance
ec2:security-group
ec2:snapshot
ec2:volume

For Cost Code, same resources and 1 of 3 values:
123456789
3324234423
342423234

Now, when I apply my policy and evaluation has run on my account, it shows as "Compliant"

This is false.

I have a test instance (plus random resources scattered around) which definitely do not have the 3 tags which I'd expect to show up as non-compliant.

Any ideas what is going on?
See my tweet about this for screenshots:
https://twitter.com/nmyster/status/1199976433810100224?s=20

I don't believe this is an EC2 problem but it is ec2 resources I am looking to report on and appreciate this is a new feature but would hope to have got something back from it.

Neil

njsn
질문됨 4년 전985회 조회
3개 답변
0
수락된 답변

Hi - This extract from the documentation explains why your resources without tags are being called compliant -

"Tag policies are a type of policy that can help you standardize tags across resources in your organization's accounts. In a tag policy, you specify tagging rules applicable to resources when they are tagged.

For example, a tag policy can specify that when the CostCenter tag is attached to a resource, it must use the case treatment and tag values that the tag policy defines.

Untagged resources or tags that aren't defined in the tag policy aren't evaluated for compliance with the tag policy."

In other words, you cannot use Tag Policies to require resources to have tags. Tag Policies helps you check for compliance of tagged resources.

Link to documentation that explains this further https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_tag-policies.html#what-are-tag-policies

If you want to prevent AWS resources from being created without tags in the first place, you can use Service Control Policies (SCPs) - https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_example-scps.html#example-require-tag-on-create .

A best practice would be to use Tag Policies to first identify all the noncompliant tagged resources, correct them, turn on enforcement [ https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_tag-policies-enforcement.html ] to prevent any noncompliant changes to these tags. Next, use SCPs to prevent resources being created without tags.

Edited by: santosh-aws on Dec 2, 2019 3:33 PM

Edited by: santosh-aws on Dec 2, 2019 3:41 PM

답변함 4년 전
profile picture
전문가
검토됨 8달 전
0

Thank you for this! Turns out I should read more before jumping in!

I've now managed to get Tag Policies to do something useful. I certainly think this would be 10x more useful if you could include resources where the tag doesn't exist when it should and be able to use Tag Policy to enforce the existence of a tag on creation/update

Aware IAM can do this but the one source to rule them would be ideal

njsn
답변함 4년 전
0

How did you go with this? I have implemented a tagging policy.

But should this mean that if i apply a non compliant tag to an existing resource it will find it?

Created a non compliant tag on purpose and then tried searching for non compliance from the resource groups tag policy page. It hasnt found the non compliant tag.

Roarkz
답변함 3년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠