

This is the new *CloudFormation Template Reference Guide*. Please update your bookmarks and links. For help getting started with CloudFormation, see the [AWS CloudFormation User Guide](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/Welcome.html).

# AWS::CodeGuruReviewer::RepositoryAssociation
<a name="aws-resource-codegurureviewer-repositoryassociation"></a>

This resource configures how Amazon CodeGuru Reviewer retrieves the source code to be reviewed. You can use an AWS CloudFormation template to create an association with the following repository types:
+ AWS CodeCommit - For more information, see [Create an AWS CodeCommit repository association](https://docs.aws.amazon.com/codeguru/latest/reviewer-ug/create-codecommit-association.html) in the *Amazon CodeGuru Reviewer User Guide*. 
+ Bitbucket - For more information, see [Create a Bitbucket repository association](https://docs.aws.amazon.com/codeguru/latest/reviewer-ug/create-bitbucket-association.html) in the *Amazon CodeGuru Reviewer User Guide*. 
+ GitHub Enterprise Server - For more information, see [Create a GitHub Enterprise Server repository association](https://docs.aws.amazon.com/codeguru/latest/reviewer-ug/create-github-enterprise-association.html) in the *Amazon CodeGuru Reviewer User Guide*. 
+ S3Bucket - For more information, see [Create code reviews with GitHub Actions](https://docs.aws.amazon.com/codeguru/latest/reviewer-ug/working-with-cicd.html) in the *Amazon CodeGuru Reviewer User Guide*. 

**Note**  
 You cannot use a CloudFormation template to create an association with a GitHub repository. 

## Syntax
<a name="aws-resource-codegurureviewer-repositoryassociation-syntax"></a>

To declare this entity in your CloudFormation template, use the following syntax:

### JSON
<a name="aws-resource-codegurureviewer-repositoryassociation-syntax.json"></a>

```
{
  "Type" : "AWS::CodeGuruReviewer::RepositoryAssociation",
  "Properties" : {
      "[BucketName](#cfn-codegurureviewer-repositoryassociation-bucketname)" : String,
      "[ConnectionArn](#cfn-codegurureviewer-repositoryassociation-connectionarn)" : String,
      "[Name](#cfn-codegurureviewer-repositoryassociation-name)" : String,
      "[Owner](#cfn-codegurureviewer-repositoryassociation-owner)" : String,
      "[Tags](#cfn-codegurureviewer-repositoryassociation-tags)" : [ Tag, ... ],
      "[Type](#cfn-codegurureviewer-repositoryassociation-type)" : String
    }
}
```

### YAML
<a name="aws-resource-codegurureviewer-repositoryassociation-syntax.yaml"></a>

```
Type: AWS::CodeGuruReviewer::RepositoryAssociation
Properties:
  [BucketName](#cfn-codegurureviewer-repositoryassociation-bucketname): String
  [ConnectionArn](#cfn-codegurureviewer-repositoryassociation-connectionarn): String
  [Name](#cfn-codegurureviewer-repositoryassociation-name): String
  [Owner](#cfn-codegurureviewer-repositoryassociation-owner): String
  [Tags](#cfn-codegurureviewer-repositoryassociation-tags): 
    - Tag
  [Type](#cfn-codegurureviewer-repositoryassociation-type): String
```

## Properties
<a name="aws-resource-codegurureviewer-repositoryassociation-properties"></a>

`BucketName`  <a name="cfn-codegurureviewer-repositoryassociation-bucketname"></a>
The name of the bucket. This is required for your S3Bucket repository. The name must start with the prefix `codeguru-reviewer-*`.  
*Required*: No  
*Type*: String  
*Pattern*: `^\S(.*\S)?$`  
*Minimum*: `3`  
*Maximum*: `63`  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`ConnectionArn`  <a name="cfn-codegurureviewer-repositoryassociation-connectionarn"></a>
 The Amazon Resource Name (ARN) of an AWS CodeStar Connections connection. Its format is `arn:aws:codestar-connections:region-id:aws-account_id:connection/connection-id`. For more information, see [Connection](https://docs.aws.amazon.com/codestar-connections/latest/APIReference/API_Connection.html) in the *AWS CodeStar Connections API Reference*.   
`ConnectionArn` must be specified for Bitbucket and GitHub Enterprise Server repositories. It has no effect if it is specified for an AWS CodeCommit repository.   
*Required*: No  
*Type*: String  
*Pattern*: `arn:aws(-[\w]+)*:.+:.+:[0-9]{12}:.+`  
*Minimum*: `0`  
*Maximum*: `256`  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`Name`  <a name="cfn-codegurureviewer-repositoryassociation-name"></a>
The name of the repository.  
*Required*: Yes  
*Type*: String  
*Pattern*: `^\S[\w.-]*$`  
*Minimum*: `1`  
*Maximum*: `100`  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`Owner`  <a name="cfn-codegurureviewer-repositoryassociation-owner"></a>
 The owner of the repository. For a GitHub Enterprise Server or Bitbucket repository, this is the username for the account that owns the repository.   
`Owner` must be specified for Bitbucket and GitHub Enterprise Server repositories. It has no effect if it is specified for an AWS CodeCommit repository.   
*Required*: No  
*Type*: String  
*Pattern*: `^\S(.*\S)?$`  
*Minimum*: `1`  
*Maximum*: `100`  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`Tags`  <a name="cfn-codegurureviewer-repositoryassociation-tags"></a>
 An array of key-value pairs used to tag an associated repository. A tag is a custom attribute label with two parts:   
+ A *tag key* (for example, `CostCenter`, `Environment`, `Project`, or `Secret`). Tag keys are case sensitive.
+ An optional field known as a *tag value* (for example, `111122223333`, `Production`, or a team name). Omitting the tag value is the same as using an empty string. Like tag keys, tag values are case sensitive.
*Required*: No  
*Type*: Array of [Tag](aws-properties-codegurureviewer-repositoryassociation-tag.md)  
*Maximum*: `50`  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`Type`  <a name="cfn-codegurureviewer-repositoryassociation-type"></a>
 The type of repository that contains the source code to be reviewed. The valid values are:   
+  `CodeCommit` 
+  `Bitbucket` 
+  `GitHubEnterpriseServer` 
+  `S3Bucket` 
*Required*: Yes  
*Type*: String  
*Allowed values*: `CodeCommit | Bitbucket | GitHubEnterpriseServer | S3Bucket`  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

## Return values
<a name="aws-resource-codegurureviewer-repositoryassociation-return-values"></a>

### Ref
<a name="aws-resource-codegurureviewer-repositoryassociation-return-values-ref"></a>

 When the logical ID of this resource is provided to the `Ref` intrinsic function, `Ref` returns the Amazon Resource Name (ARN) of the AWS CodeGuru Reviewer [https://docs.aws.amazon.com/codeguru/latest/reviewer-api/API_RepositoryAssociation.html](https://docs.aws.amazon.com/codeguru/latest/reviewer-api/API_RepositoryAssociation.html), such as `arn:aws:codeguru-reviewer:region:123456789012:association/universally-unique-identifier`. 

 For more information about using the `Ref` function, see [Ref](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-ref.html). 

### Fn::GetAtt
<a name="aws-resource-codegurureviewer-repositoryassociation-return-values-fn--getatt"></a>

`Fn::GetAtt` returns a value for a specified attribute of this type. The following is the available sample return values. For more information about using `Fn::GetAtt`, see [Fn::GetAtt](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-getatt.html). 

#### 
<a name="aws-resource-codegurureviewer-repositoryassociation-return-values-fn--getatt-fn--getatt"></a>

`AssociationArn`  <a name="AssociationArn-fn::getatt"></a>
The Amazon Resource Name (ARN) of the [https://docs.aws.amazon.com/codeguru/latest/reviewer-api/API_RepositoryAssociation.html](https://docs.aws.amazon.com/codeguru/latest/reviewer-api/API_RepositoryAssociation.html) object. You can retrieve this ARN by calling `ListRepositories`.

## Examples
<a name="aws-resource-codegurureviewer-repositoryassociation--examples"></a>



**Topics**
+ [Create an AWS CodeCommit repository association using an existing CodeCommit repository](#aws-resource-codegurureviewer-repositoryassociation--examples--Create_an_CodeCommit_repository_association_using_an_existing_CodeCommit_repository)
+ [Create an AWS CodeCommit repository association with a new CodeCommit repository](#aws-resource-codegurureviewer-repositoryassociation--examples--Create_an_CodeCommit_repository_association_with_a_new_CodeCommit_repository)
+ [Create a Bitbucket repository association](#aws-resource-codegurureviewer-repositoryassociation--examples--Create_a_Bitbucket_repository_association)
+ [Create a GitHub Enterprise Server repository association](#aws-resource-codegurureviewer-repositoryassociation--examples--Create_a_GitHub_Enterprise_Server_repository_association)
+ [Create a repository association with tags](#aws-resource-codegurureviewer-repositoryassociation--examples--Create_a_repository_association_with_tags)

### Create an AWS CodeCommit repository association using an existing CodeCommit repository
<a name="aws-resource-codegurureviewer-repositoryassociation--examples--Create_an_CodeCommit_repository_association_using_an_existing_CodeCommit_repository"></a>

The following example creates an Amazon CodeGuru Reviewer repository association using an existing AWS CodeCommit repository named `MyRepository`.

#### YAML
<a name="aws-resource-codegurureviewer-repositoryassociation--examples--Create_an_CodeCommit_repository_association_using_an_existing_CodeCommit_repository--yaml"></a>

```
Resources:
  MyRepositoryAssociation:
    Type: AWS::CodeGuruReviewer::RepositoryAssociation
    Properties:
      Name: MyRepository
      Type: CodeCommit
```

#### JSON
<a name="aws-resource-codegurureviewer-repositoryassociation--examples--Create_an_CodeCommit_repository_association_using_an_existing_CodeCommit_repository--json"></a>

```
{
  "Resources": {
    "MyRepositoryAssociation": {
      "Type": "AWS::CodeGuruReviewer::RepositoryAssociation",
      "Properties": {
        "Name": "MyRepository",
        "Type": "CodeCommit"
      }
    }
  }
}
```

### Create an AWS CodeCommit repository association with a new CodeCommit repository
<a name="aws-resource-codegurureviewer-repositoryassociation--examples--Create_an_CodeCommit_repository_association_with_a_new_CodeCommit_repository"></a>

The following example creates an AWS CodeCommit repository named `MyRepositoryName`. Next, it creates an Amazon CodeGuru Reviewer repository association using the CodeCommit repository. The `DependsOn` property in the `RepositoryAssociation` specifies the CodeCommit repository. This is because the repository association can be created only after the CodeCommit repository is created.

#### YAML
<a name="aws-resource-codegurureviewer-repositoryassociation--examples--Create_an_CodeCommit_repository_association_with_a_new_CodeCommit_repository--yaml"></a>

```
Resources:
  MyRepository:
    Type: AWS::CodeCommit::Repository
    Properties:
      RepositoryName: MyRepositoryName
  MyRepositoryAssociation:
    Type: AWS::CodeGuruReviewer::RepositoryAssociation
    Properties:
      Name: MyRepositoryName
      Type: CodeCommit
```

#### JSON
<a name="aws-resource-codegurureviewer-repositoryassociation--examples--Create_an_CodeCommit_repository_association_with_a_new_CodeCommit_repository--json"></a>

```
{
  "Resources": {
    "MyRepository": {
      "Type": "AWS::CodeCommit::Repository",
      "Properties": {
        "RepositoryName": "MyRepositoryName"
      }
    },
    "MyRepositoryAssociation": {
      "Type": "AWS::CodeGuruReviewer::RepositoryAssociation",
      "Properties": {
        "Name": "MyRepositoryName",
        "Type": "CodeCommit"
      }
    }
  }
}
```

### Create a Bitbucket repository association
<a name="aws-resource-codegurureviewer-repositoryassociation--examples--Create_a_Bitbucket_repository_association"></a>

The following example creates an Amazon CodeGuru Reviewer repository association using a Bitbucket repository.

#### YAML
<a name="aws-resource-codegurureviewer-repositoryassociation--examples--Create_a_Bitbucket_repository_association--yaml"></a>

```
Resources:
  MyRepositoryAssociation:
    Type: AWS::CodeGuruReviewer::RepositoryAssociation
    Properties:
      Name: MyBitbucketRepoName
      Type: Bitbucket
      ConnectionArn: arn:aws:codestar-connections:us-west-2:123456789012:connection/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee
      Owner: MyOwnerName
```

#### JSON
<a name="aws-resource-codegurureviewer-repositoryassociation--examples--Create_a_Bitbucket_repository_association--json"></a>

```
{
  "Resources": {
    "MyRepositoryAssociation": {
      "Type": "AWS::CodeGuruReviewer::RepositoryAssociation",
      "Properties": {
        "Name": "MyBitbucketRepoName",
        "Type": "Bitbucket",
        "ConnectionArn": "arn:aws:codestar-connections:us-west-2:123456789012:connection/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee",
        "Owner": "MyOwnerName"
      }
    }
  }
}
```

### Create a GitHub Enterprise Server repository association
<a name="aws-resource-codegurureviewer-repositoryassociation--examples--Create_a_GitHub_Enterprise_Server_repository_association"></a>

The following example creates an Amazon CodeGuru Reviewer repository association using a GitHub Enterprise Server repository.

#### YAML
<a name="aws-resource-codegurureviewer-repositoryassociation--examples--Create_a_GitHub_Enterprise_Server_repository_association--yaml"></a>

```
Resources:
  MyRepositoryAssociation:
    Type: AWS::CodeGuruReviewer::RepositoryAssociation
    Properties:
      Name: MyGitHubEnterpriseRepoName
      Type: GitHubEnterpriseServer
      ConnectionArn: arn:aws:codestar-connections:us-west-2:123456789012:connection/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee
      Owner: MyOwnerName
```

#### JSON
<a name="aws-resource-codegurureviewer-repositoryassociation--examples--Create_a_GitHub_Enterprise_Server_repository_association--json"></a>

```
{
  "Resources": {
    "MyRepositoryAssociation": {
      "Type": "AWS::CodeGuruReviewer::RepositoryAssociation",
      "Properties": {
        "Name": "MyGitHubEnterpriseRepoName",
        "Type": "GitHubEnterpriseServer",
        "ConnectionArn": "arn:aws:codestar-connections:us-west-2:123456789012:connection/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee",
        "Owner": "MyOwnerName"
      }
    }
  }
}
```

### Create a repository association with tags
<a name="aws-resource-codegurureviewer-repositoryassociation--examples--Create_a_repository_association_with_tags"></a>

The following example creates an Amazon CodeGuru Reviewer repository association that has two tags. The repository is an AWS CodeCommit repository. Use the `Tags` property the same way to add tags when you create a BitBucket or GitHub Enterprise repository association.

#### YAML
<a name="aws-resource-codegurureviewer-repositoryassociation--examples--Create_a_repository_association_with_tags--yaml"></a>

```
Resources:
  MyRepositoryAssociation:
    Type: AWS::CodeGuruReviewer::RepositoryAssociation
    Properties:
      Name: MyRepository
      Type: CodeCommit
      Tags:
        - Key: tag1-key
          Value: tag1-value
        - Key: tag2-key
          Value: tag2-value
```

#### JSON
<a name="aws-resource-codegurureviewer-repositoryassociation--examples--Create_a_repository_association_with_tags--json"></a>

```
{
  "Resources": {
    "MyRepositoryAssociation": {
      "Type": "AWS::CodeGuruReviewer::RepositoryAssociation",
      "Properties": {
        "Name": "MyRepository",
        "Type": "CodeCommit",
        "Tags": [
          {
            "Key": "tag1-key",
            "Value": "tag1-value"
          },
          {
            "Key": "tag2-key",
            "Value": "tag2-value"
          }
        ]
      }
    }
  }
}
```

# AWS::CodeGuruReviewer::RepositoryAssociation Tag
<a name="aws-properties-codegurureviewer-repositoryassociation-tag"></a>

<a name="aws-properties-codegurureviewer-repositoryassociation-tag-description"></a>The `Tag` property type specifies Property description not available. for an [AWS::CodeGuruReviewer::RepositoryAssociation](aws-resource-codegurureviewer-repositoryassociation.md).

## Syntax
<a name="aws-properties-codegurureviewer-repositoryassociation-tag-syntax"></a>

To declare this entity in your CloudFormation template, use the following syntax:

### JSON
<a name="aws-properties-codegurureviewer-repositoryassociation-tag-syntax.json"></a>

```
{
  "[Key](#cfn-codegurureviewer-repositoryassociation-tag-key)" : String,
  "[Value](#cfn-codegurureviewer-repositoryassociation-tag-value)" : String
}
```

### YAML
<a name="aws-properties-codegurureviewer-repositoryassociation-tag-syntax.yaml"></a>

```
  [Key](#cfn-codegurureviewer-repositoryassociation-tag-key): String
  [Value](#cfn-codegurureviewer-repositoryassociation-tag-value): String
```

## Properties
<a name="aws-properties-codegurureviewer-repositoryassociation-tag-properties"></a>

`Key`  <a name="cfn-codegurureviewer-repositoryassociation-tag-key"></a>
Property description not available.  
*Required*: Yes  
*Type*: String  
*Minimum*: `1`  
*Maximum*: `128`  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)

`Value`  <a name="cfn-codegurureviewer-repositoryassociation-tag-value"></a>
Property description not available.  
*Required*: Yes  
*Type*: String  
*Minimum*: `0`  
*Maximum*: `256`  
*Update requires*: [Replacement](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-replacement)