aws-cloudformation / cloudformation-coverage-roadmap

The AWS CloudFormation Public Coverage Roadmap
https://aws.amazon.com/cloudformation/
Creative Commons Attribution Share Alike 4.0 International
1.11k stars 54 forks source link

AWS::CodeCommit::ApprovalRuleTemplate #329

Open benbridts opened 4 years ago

benbridts commented 4 years ago

2. Scope of request

AWS::CodeCommit::ApprovalRuleTemplate does not exist as a CloudFormation resource.

3. Expected behavior

It should manage the template and optionally the allowed approvers. The association with a repo will be better as a separate resource (so the association can live in a stack with the repo while the template is centrally managed), I can make a separate issue for that but releasing one without the other does not make a lot of sense.

5. Helpful Links to speed up research and evaluation

I'd expect the same attributes as the Create API call: https://docs.aws.amazon.com/codecommit/latest/APIReference/API_CreateApprovalRuleTemplate.html

6. Category (required) - Will help with tagging and be easier to find by other users to +1

Developer Tools (CodeStar, ...)

arantespp commented 4 years ago

+1

mechanicalpete commented 4 years ago

+1

cramseyio commented 4 years ago

+1

farrantch commented 4 years ago

+1

usa-usa-usa-usa commented 4 years ago

PLEASE! It's extremely frustrating to have features like this released well before cloudformation supports them.

benbridts commented 4 years ago

General reminder that pressing the 👍 is the best way to indicate you want this implemented. You can also subscribe to this issue (on the right hand side) to get notifications when there is a new comment. That's also the reason that voting with 👍 is preferred, as it will not send out emails to every subscriber.

(cc @arantespp @mechanicalpete @cramseyio @farrantch @jcwhisman )

zxkane commented 4 years ago

I implemented this via cfn custom resources. If anyone is interested in it, you can refer to the implementation.

aro1976 commented 4 years ago

I spend the whole weekend working on templates for our devops team, it is very frustating to have to mix cloudformation with scripts and lambdas just because there is no native support.

eduardomourar commented 3 years ago

While this is not implemented with a public one, you can use this private resource type Community::CodeCommit::ApprovalRuleTemplate and Community::CodeCommit::RepositoryAssociation.

Installation instructions:

aws cloudformation register-type \
  --region <SELECTED_REGION> \
  --type-name "Community::CodeCommit::ApprovalRuleTemplate" \
  --schema-handler-package "s3://community-resource-provider-catalog/community-codecommit-approvalruletemplate-0.1.0.zip" \
  --type RESOURCE \
  --execution-role-arn <ROLE_ARN_WITH_ENOUGH_PRIVILEGE>

aws cloudformation register-type \
  --region <SELECTED_REGION> \
  --type-name "Community::CodeCommit::RepositoryAssociation" \
  --schema-handler-package "s3://community-resource-provider-catalog/community-codecommit-repositoryassociation-0.1.0.zip" \
  --type RESOURCE \
  --execution-role-arn <ROLE_ARN_WITH_ENOUGH_PRIVILEGE>

Usage example:

AWSTemplateFormatVersion: 2010-09-09

Parameters:
  ruleName:
    Type: String
    Default: "repo-rule"

  ruleDescription:
    Type: String
    Default: "rule description"

  repoName:
    Type: String
    Default: "repo"

Resources:
  Repo:
    Type: AWS::CodeCommit::Repository
    Properties:
      RepositoryName: !Ref repoName

  RuleTemplate:
    Type: Community::CodeCommit::ApprovalRuleTemplate
    Properties:
      Name: !Ref ruleName
      Description: !Ref ruleDescription
      Content:
        Version: "2018-11-08"
        DestinationReferences:
          - "refs/heads/master"
        Statements:
          - Type: "Approvers"
            NumberOfApprovalsNeeded: 1
            ApprovalPoolMembers:
              - "*"

  RepoAssociation:
    Type: Community::CodeCommit::RepositoryAssociation
    Properties:
      ApprovalRuleTemplateArn: !Ref RuleTemplate
      RepositoryNames: [!GetAtt Repo.Name]

Outputs:
  RuleTemplateArn:
    Value: !Ref RuleTemplate
r2690698 commented 3 years ago

+1 to this

tonggremlin commented 2 years ago

This is 2022 and I +1 this!

KevinToala commented 1 year ago

+1

oussmoh commented 7 months ago

+1

aabid0193 commented 6 months ago

+1, still no progress on this?

aabid0193 commented 6 months ago

While this is not implemented with a public one, you can use this private resource type Community::CodeCommit::ApprovalRuleTemplate and Community::CodeCommit::RepositoryAssociation.

Installation instructions:

aws cloudformation register-type \
  --region <SELECTED_REGION> \
  --type-name "Community::CodeCommit::ApprovalRuleTemplate" \
  --schema-handler-package "s3://community-resource-provider-catalog/community-codecommit-approvalruletemplate-0.1.0.zip" \
  --type RESOURCE \
  --execution-role-arn <ROLE_ARN_WITH_ENOUGH_PRIVILEGE>

aws cloudformation register-type \
  --region <SELECTED_REGION> \
  --type-name "Community::CodeCommit::RepositoryAssociation" \
  --schema-handler-package "s3://community-resource-provider-catalog/community-codecommit-repositoryassociation-0.1.0.zip" \
  --type RESOURCE \
  --execution-role-arn <ROLE_ARN_WITH_ENOUGH_PRIVILEGE>

Usage example:

AWSTemplateFormatVersion: 2010-09-09

Parameters:
  ruleName:
    Type: String
    Default: "repo-rule"

  ruleDescription:
    Type: String
    Default: "rule description"

  repoName:
    Type: String
    Default: "repo"

Resources:
  Repo:
    Type: AWS::CodeCommit::Repository
    Properties:
      RepositoryName: !Ref repoName

  RuleTemplate:
    Type: Community::CodeCommit::ApprovalRuleTemplate
    Properties:
      Name: !Ref ruleName
      Description: !Ref ruleDescription
      Content:
        Version: "2018-11-08"
        DestinationReferences:
          - "refs/heads/master"
        Statements:
          - Type: "Approvers"
            NumberOfApprovalsNeeded: 1
            ApprovalPoolMembers:
              - "*"

  RepoAssociation:
    Type: Community::CodeCommit::RepositoryAssociation
    Properties:
      ApprovalRuleTemplateArn: !Ref RuleTemplate
      RepositoryNames: [!GetAtt Repo.Name]

Outputs:
  RuleTemplateArn:
    Value: !Ref RuleTemplate

Does this still work? I had tried it but with no luck.