{
  "Resources": {
    "MyRepoF4F48043": {
      "Type": "AWS::CodeCommit::Repository",
      "Properties": {
        "RepositoryName": "my-repo",
        "Triggers": []
      }
    },
    "PipelineArtifactsBucket22248F97": {
      "Type": "AWS::S3::Bucket",
      "DeletionPolicy": "Retain"
    },
    "PipelineRoleD68726F7": {
      "Type": "AWS::IAM::Role",
      "Properties": {
        "AssumeRolePolicyDocument": {
          "Statement": [
            {
              "Action": "sts:AssumeRole",
              "Effect": "Allow",
              "Principal": {
                "Service": "codepipeline.amazonaws.com"
              }
            }
          ],
          "Version": "2012-10-17"
        }
      }
    },
    "PipelineRoleDefaultPolicyC7A05455": {
      "Type": "AWS::IAM::Policy",
      "Properties": {
        "PolicyDocument": {
          "Statement": [
            {
              "Action": [
                "s3:GetObject*",
                "s3:GetBucket*",
                "s3:List*",
                "s3:PutObject*",
                "s3:DeleteObject*",
                "s3:Abort*"
              ],
              "Effect": "Allow",
              "Resource": [
                {
                  "Fn::GetAtt": [
                    "PipelineArtifactsBucket22248F97",
                    "Arn"
                  ]
                },
                {
                  "Fn::Join": [
                    "",
                    [
                      {
                        "Fn::GetAtt": [
                          "PipelineArtifactsBucket22248F97",
                          "Arn"
                        ]
                      },
                      "/",
                      "*"
                    ]
                  ]
                }
              ]
            },
            {
              "Action": [
                "codecommit:GetBranch",
                "codecommit:GetCommit",
                "codecommit:UploadArchive",
                "codecommit:GetUploadArchiveStatus",
                "codecommit:CancelUploadArchive"
              ],
              "Effect": "Allow",
              "Resource": {
                "Fn::GetAtt": [
                  "MyRepoF4F48043",
                  "Arn"
                ]
              }
            },
            {
              "Action": [
                "codebuild:BatchGetBuilds",
                "codebuild:StartBuild",
                "codebuild:StopBuild"
              ],
              "Effect": "Allow",
              "Resource": {
                "Fn::GetAtt": [
                  "MyBuildProject30DB9D6E",
                  "Arn"
                ]
              }
            }
          ],
          "Version": "2012-10-17"
        },
        "PolicyName": "PipelineRoleDefaultPolicyC7A05455",
        "Roles": [
          {
            "Ref": "PipelineRoleD68726F7"
          }
        ]
      }
    },
    "PipelineC660917D": {
      "Type": "AWS::CodePipeline::Pipeline",
      "Properties": {
        "ArtifactStore": {
          "Location": {
            "Ref": "PipelineArtifactsBucket22248F97"
          },
          "Type": "S3"
        },
        "RoleArn": {
          "Fn::GetAtt": [
            "PipelineRoleD68726F7",
            "Arn"
          ]
        },
        "Stages": [
          {
            "Actions": [
              {
                "ActionTypeId": {
                  "Category": "Source",
                  "Owner": "AWS",
                  "Provider": "CodeCommit",
                  "Version": "1"
                },
                "Configuration": {
                  "RepositoryName": {
                    "Fn::GetAtt": [
                      "MyRepoF4F48043",
                      "Name"
                    ]
                  },
                  "BranchName": "master",
                  "PollForSourceChanges": true
                },
                "InputArtifacts": [],
                "Name": "source",
                "OutputArtifacts": [
                  {
                    "Name": "SourceArtifact"
                  }
                ],
                "RunOrder": 1
              }
            ],
            "Name": "source"
          },
          {
            "Actions": [
              {
                "ActionTypeId": {
                  "Category": "Build",
                  "Owner": "AWS",
                  "Provider": "CodeBuild",
                  "Version": "1"
                },
                "Configuration": {
                  "ProjectName": {
                    "Ref": "MyBuildProject30DB9D6E"
                  }
                },
                "InputArtifacts": [
                  {
                    "Name": "SourceArtifact"
                  }
                ],
                "Name": "build",
                "OutputArtifacts": [],
                "RunOrder": 1
              }
            ],
            "Name": "build"
          }
        ]
      },
      "DependsOn": [
        "PipelineRoleD68726F7",
        "PipelineRoleDefaultPolicyC7A05455"
      ]
    },
    "MyBuildProjectRole6B7E2258": {
      "Type": "AWS::IAM::Role",
      "Properties": {
        "AssumeRolePolicyDocument": {
          "Statement": [
            {
              "Action": "sts:AssumeRole",
              "Effect": "Allow",
              "Principal": {
                "Service": "codebuild.amazonaws.com"
              }
            }
          ],
          "Version": "2012-10-17"
        }
      }
    },
    "MyBuildProjectRoleDefaultPolicy5604AA87": {
      "Type": "AWS::IAM::Policy",
      "Properties": {
        "PolicyDocument": {
          "Statement": [
            {
              "Action": [
                "logs:CreateLogGroup",
                "logs:CreateLogStream",
                "logs:PutLogEvents"
              ],
              "Effect": "Allow",
              "Resource": [
                {
                  "Fn::Join": [
                    "",
                    [
                      "arn",
                      ":",
                      {
                        "Ref": "AWS::Partition"
                      },
                      ":",
                      "logs",
                      ":",
                      {
                        "Ref": "AWS::Region"
                      },
                      ":",
                      {
                        "Ref": "AWS::AccountId"
                      },
                      ":",
                      "log-group",
                      ":",
                      {
                        "Fn::Join": [
                          "",
                          [
                            "/aws/codebuild/",
                            {
                              "Ref": "MyBuildProject30DB9D6E"
                            }
                          ]
                        ]
                      }
                    ]
                  ]
                },
                {
                  "Fn::Join": [
                    "",
                    [
                      {
                        "Fn::Join": [
                          "",
                          [
                            "arn",
                            ":",
                            {
                              "Ref": "AWS::Partition"
                            },
                            ":",
                            "logs",
                            ":",
                            {
                              "Ref": "AWS::Region"
                            },
                            ":",
                            {
                              "Ref": "AWS::AccountId"
                            },
                            ":",
                            "log-group",
                            ":",
                            {
                              "Fn::Join": [
                                "",
                                [
                                  "/aws/codebuild/",
                                  {
                                    "Ref": "MyBuildProject30DB9D6E"
                                  }
                                ]
                              ]
                            }
                          ]
                        ]
                      },
                      ":*"
                    ]
                  ]
                }
              ]
            },
            {
              "Action": [
                "s3:GetObject*",
                "s3:GetBucket*",
                "s3:List*",
                "s3:PutObject*",
                "s3:DeleteObject*",
                "s3:Abort*"
              ],
              "Effect": "Allow",
              "Resource": [
                {
                  "Fn::GetAtt": [
                    "PipelineArtifactsBucket22248F97",
                    "Arn"
                  ]
                },
                {
                  "Fn::Join": [
                    "",
                    [
                      {
                        "Fn::GetAtt": [
                          "PipelineArtifactsBucket22248F97",
                          "Arn"
                        ]
                      },
                      "/",
                      "*"
                    ]
                  ]
                }
              ]
            }
          ],
          "Version": "2012-10-17"
        },
        "PolicyName": "MyBuildProjectRoleDefaultPolicy5604AA87",
        "Roles": [
          {
            "Ref": "MyBuildProjectRole6B7E2258"
          }
        ]
      }
    },
    "MyBuildProject30DB9D6E": {
      "Type": "AWS::CodeBuild::Project",
      "Properties": {
        "Source": {
          "Type": "CODEPIPELINE"
        },
        "Artifacts": {
          "Type": "CODEPIPELINE"
        },
        "ServiceRole": {
          "Fn::GetAtt": [
            "MyBuildProjectRole6B7E2258",
            "Arn"
          ]
        },
        "Environment": {
          "Type": "LINUX_CONTAINER",
          "PrivilegedMode": false,
          "Image": "aws/codebuild/ubuntu-base:14.04",
          "ComputeType": "BUILD_GENERAL1_SMALL"
        }
      }
    }
  }
}