CloudFormation Create Repository with Multiple Branches

0

Hello,

Please how do i create multiple branch in cloudformation when setting up my repository

I want to create [Dev|Test|Prod] Branch in CloudFormation.

please with a sample code.

IACCodeCommitRepo:
    Type: AWS::CodeCommit::Repository
    DeletionPolicy: Retain
    Properties:
      RepositoryName: !Ref AppId
      RepositoryDescription: !Sub IaC Repository for ProptterAccount
      # To Add Code Repository from S3
      Code:
        BranchName: main
        S3:
          Bucket: !Ref SourceCodeBucketName
          Key: !Ref SourceCodeBucketKey
1 Answer
1
Accepted Answer

Hello.
I don't think it is possible to create a non-default branch in CloudFormation.
So I think it is necessary to create it from the git command or management console after the CodeCommit repository is created.
https://docs.aws.amazon.com/codecommit/latest/userguide/how-to-create-branch.html

profile picture
EXPERT
answered 8 months ago
profile pictureAWS
EXPERT
reviewed 8 months ago
  • Cloudformation stack would be account specific and can't be branched. You may want to leverage code pipeline where you create the webhooks in each aws Account(environment per say) and that particular branch from source repository would be sourced. Take a look at this blog post, if you want to consider branch based deployment.

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.

Guidelines for Answering Questions