<p>I found what i needed to allow or the eqivalent StringNotEquals to deny useing the tag
aws:ResourceTag</p>

<pre><code>"Condition": {
                "StringEquals": {
                    "aws:ResourceTag/Key_-1": "Value_-1"
                }
            }
</code></pre>

CC BY-SA 4.0
2020-05-12T06:35:17.110Z
2020-05-12T06:35:17.110Z
doug
<p>Honestly, I'm confused your question. It's meant to prevent git pull IAM user for specific repository or something else?</p>

<p>Here is example of how to deny policy for specific repository that can be attached to your IAM users.</p>

<pre><code>{
  "Version": "2012-10-17",
  "Statement" : [
    {
      "Effect" : "Deny",
      "Action" : [
        "codecommit:*"
      ],
      "Resource" : [
        "arn:aws:codecommit:us-east-2:111111111111:myrepo"
      ]
    }
  ]
}
</code></pre>

CC BY-SA 4.0
2020-05-12T06:37:44.400Z
To allow or deny permitions based on tags added to the repos so the tags can then be used to determin the repos diffrent groups of users have what  access
doug
CC BY-SA 4.0
2020-05-09T12:51:35.897Z
2020-05-09T12:51:35.897Z
Pyae Phyoe Shein
<p>If I add a tag to a codecommit repo with
code commit => the repo => Settings => repository tags => add tags
how do i reference this tag in IAM</p>

<p>I have in the policy document a statment i am trying to use to reference the tag Im not sure what i use in the resource section to refrence a tag I add.</p>

<p>statement {
  sid = "AllowCodeCommitAccess"
  actions = [
    "codecommit:GitPull",
  ]
resources = ["?????????"]
}</p>

<p>Also I haven't actually added the tag yet to codecommit repo as something on aws said it could impact access. I assume that just means If IAM uses it to denny resources but wasn't %100 sure and haven't added it yet.</p>

<aws-iam>
How do you reference a code commit tag in IAM
doug
# How do you reference a code commit tag in IAM

(Asked by: username_0 on 2020-05-06)

If I add a tag to a codecommit repo with
code commit => the repo => Settings => repository tags => add tags
how do i reference this tag in IAM

I have in the policy document a statment i am trying to use to reference the tag Im not sure what i use in the resource section to refrence a tag I add.

statement {
sid = "AllowCodeCommitAccess"
actions = [
"codecommit:GitPull",
]
resources = ["?????????"]
}

Also I haven't actually added the tag yet to codecommit repo as something on aws said it could impact access. I assume that just means If IAM uses it to denny resources but wasn't %100 sure and haven't added it yet.

**Tags:** aws-iam


---

## 2 answers

### Answer by username_0 on 2020-05-12. Score: 1 | Accepted answer

I found what i needed to allow or the eqivalent StringNotEquals to deny useing the tag
aws:ResourceTag
"Condition": {
                "StringEquals": {
                    "aws:ResourceTag/Key_-1": "Value_-1"
                }
            }


---

### Answer by username_1 on 2020-05-09. Score: 0

Honestly, I'm confused your question. It's meant to prevent git pull IAM user for specific repository or something else?
Here is example of how to deny policy for specific repository that can be attached to your IAM users.
{
  "Version": "2012-10-17",
  "Statement" : [
    {
      "Effect" : "Deny",
      "Action" : [
        "codecommit:*"
      ],
      "Resource" : [
        "arn:aws:codecommit:us-east-2:111111111111:myrepo"
      ]
    }
  ]
}

> **Comments:**
> **username_0**: To allow or deny permitions based on tags added to the repos so the tags can then be used to determin the repos diffrent groups of users have what  access  

---

