Skip to content

IAM CreateRole with tags: can TagRole authorization be limited to creation without permitting ownership-tag adoption?

0

I am reviewing a least-privilege CloudFormation execution role that creates application IAM roles with required ownership tags. This is a pre-deployment review; no role-creation test has been performed for this investigation.

A read-only DescribeType response for AWS::IAM::Role in eu-central-1, captured on 2026-09-11, declares:

  • tagging.tagOnCreate = true
  • tagging.tagUpdatable = true
  • tagging.cloudFormationSystemTags = false
  • iam:CreateRole and iam:TagRole in handlers.create.permissions

These are schema declarations, not a capture of the IAM authorization context during creation.

The proposed design would allow CreateRole for narrowly scoped role ARNs with required aws:RequestTag values and an aws:TagKeys allowlist. For TagRole, it would additionally require existing ownership tags to match through aws:ResourceTag conditions.

The aim is to support initial tagged creation while preventing the same principal from assigning ownership tags to an existing untagged or differently tagged role within the permitted ARN scope.

Could someone clarify:

  1. During authorization of CreateRole with inline Tags, what values are available to the TagRole permission check for aws:ResourceTag, aws:RequestTag, and aws:TagKeys? Are proposed ownership tags available as ResourceTag values during that check, or are these keys absent?

  2. If requiring matching ResourceTag values prevents initial creation, is there a documented condition that permits the creation-time TagRole check while denying a standalone TagRole request against an existing unowned role with the same requested ownership tags? I am looking for a discriminator beyond the target ARN and requested tag values. If none exists, what supported control would enforce that separation?

  3. Given cloudFormationSystemTags=false for this resource type, what documented guarantee, if any, does that provide about aws:cloudformation:* keys being absent from aws:TagKeys in this creation path? Please distinguish this declaration from other template or stack tag propagation.

Please distinguish a dependent authorization check from a separate API call: the absence of a separate TagRole CloudTrail event would not establish the condition-key context. If the answer depends on the active CloudFormation handler implementation, please identify the scope and evidence supporting that behavior.

References:

Documentation or an IAM service-specific explanation would be especially helpful.

1 Answer
1
  1. Evaluation Context during CreateRole During the initial creation of a resource, the aws:ResourceTag/key condition evaluates to null (absent) for the iam:TagRole permission check. Proposed ownership tags are solely available in aws:RequestTag/key and aws:TagKeys. They do not populate the aws:ResourceTag context because the resource does not yet exist.

  2. Creation-Time vs. Standalone Tagging Discriminator There is no documented IAM condition key (such as the ec2:CreateAction key used in Amazon EC2) that natively distinguishes an iam:TagRole check triggered by iam:CreateRole from a standalone iam:TagRole API call. Because aws:ResourceTag is absent during creation, enforcing an aws:ResourceTag/owner condition on iam:TagRole to prevent the adoption of existing untagged roles will unavoidably deny the creation-time tag assignment. Natively separating these actions solely via resource-based or identity-based IAM conditions is not supported. An external detective/preventative control mechanism (like EventBridge auto-remediation or a Service Control Policy explicitly denying TagRole except by specific deployment roles) is required to enforce this boundary securely.

  3. CloudFormation System Tags Behavior The schema declaration tagging.cloudFormationSystemTags = false acts as an explicit directive to the CloudFormation resource provider framework. It dictates that the CloudFormation engine must not append its default system tags (such as aws:cloudformation:stack-id or aws:cloudformation:logical-id) to the tagging payload during resource provisioning. Consequently, this guarantees that aws:cloudformation:* keys are absent from both the aws:TagKeys array and aws:RequestTag evaluation context during the handler's execution of the API call.

EXPERT

answered a month ago

EXPERT

reviewed a month ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.