1. Packages
  2. AWS
  3. API Docs
  4. codecommit
  5. ApprovalRuleTemplate
AWS v6.76.0 published on Tuesday, Apr 8, 2025 by Pulumi

aws.codecommit.ApprovalRuleTemplate

Explore with Pulumi AI

Provides a CodeCommit Approval Rule Template Resource.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const example = new aws.codecommit.ApprovalRuleTemplate("example", {
    name: "MyExampleApprovalRuleTemplate",
    description: "This is an example approval rule template",
    content: JSON.stringify({
        Version: "2018-11-08",
        DestinationReferences: ["refs/heads/master"],
        Statements: [{
            Type: "Approvers",
            NumberOfApprovalsNeeded: 2,
            ApprovalPoolMembers: ["arn:aws:sts::123456789012:assumed-role/CodeCommitReview/*"],
        }],
    }),
});
Copy
import pulumi
import json
import pulumi_aws as aws

example = aws.codecommit.ApprovalRuleTemplate("example",
    name="MyExampleApprovalRuleTemplate",
    description="This is an example approval rule template",
    content=json.dumps({
        "Version": "2018-11-08",
        "DestinationReferences": ["refs/heads/master"],
        "Statements": [{
            "Type": "Approvers",
            "NumberOfApprovalsNeeded": 2,
            "ApprovalPoolMembers": ["arn:aws:sts::123456789012:assumed-role/CodeCommitReview/*"],
        }],
    }))
Copy
package main

import (
	"encoding/json"

	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/codecommit"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		tmpJSON0, err := json.Marshal(map[string]interface{}{
			"Version": "2018-11-08",
			"DestinationReferences": []string{
				"refs/heads/master",
			},
			"Statements": []map[string]interface{}{
				map[string]interface{}{
					"Type":                    "Approvers",
					"NumberOfApprovalsNeeded": 2,
					"ApprovalPoolMembers": []string{
						"arn:aws:sts::123456789012:assumed-role/CodeCommitReview/*",
					},
				},
			},
		})
		if err != nil {
			return err
		}
		json0 := string(tmpJSON0)
		_, err = codecommit.NewApprovalRuleTemplate(ctx, "example", &codecommit.ApprovalRuleTemplateArgs{
			Name:        pulumi.String("MyExampleApprovalRuleTemplate"),
			Description: pulumi.String("This is an example approval rule template"),
			Content:     pulumi.String(json0),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() => 
{
    var example = new Aws.CodeCommit.ApprovalRuleTemplate("example", new()
    {
        Name = "MyExampleApprovalRuleTemplate",
        Description = "This is an example approval rule template",
        Content = JsonSerializer.Serialize(new Dictionary<string, object?>
        {
            ["Version"] = "2018-11-08",
            ["DestinationReferences"] = new[]
            {
                "refs/heads/master",
            },
            ["Statements"] = new[]
            {
                new Dictionary<string, object?>
                {
                    ["Type"] = "Approvers",
                    ["NumberOfApprovalsNeeded"] = 2,
                    ["ApprovalPoolMembers"] = new[]
                    {
                        "arn:aws:sts::123456789012:assumed-role/CodeCommitReview/*",
                    },
                },
            },
        }),
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.codecommit.ApprovalRuleTemplate;
import com.pulumi.aws.codecommit.ApprovalRuleTemplateArgs;
import static com.pulumi.codegen.internal.Serialization.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var example = new ApprovalRuleTemplate("example", ApprovalRuleTemplateArgs.builder()
            .name("MyExampleApprovalRuleTemplate")
            .description("This is an example approval rule template")
            .content(serializeJson(
                jsonObject(
                    jsonProperty("Version", "2018-11-08"),
                    jsonProperty("DestinationReferences", jsonArray("refs/heads/master")),
                    jsonProperty("Statements", jsonArray(jsonObject(
                        jsonProperty("Type", "Approvers"),
                        jsonProperty("NumberOfApprovalsNeeded", 2),
                        jsonProperty("ApprovalPoolMembers", jsonArray("arn:aws:sts::123456789012:assumed-role/CodeCommitReview/*"))
                    )))
                )))
            .build());

    }
}
Copy
resources:
  example:
    type: aws:codecommit:ApprovalRuleTemplate
    properties:
      name: MyExampleApprovalRuleTemplate
      description: This is an example approval rule template
      content:
        fn::toJSON:
          Version: 2018-11-08
          DestinationReferences:
            - refs/heads/master
          Statements:
            - Type: Approvers
              NumberOfApprovalsNeeded: 2
              ApprovalPoolMembers:
                - arn:aws:sts::123456789012:assumed-role/CodeCommitReview/*
Copy

Create ApprovalRuleTemplate Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new ApprovalRuleTemplate(name: string, args: ApprovalRuleTemplateArgs, opts?: CustomResourceOptions);
@overload
def ApprovalRuleTemplate(resource_name: str,
                         args: ApprovalRuleTemplateArgs,
                         opts: Optional[ResourceOptions] = None)

@overload
def ApprovalRuleTemplate(resource_name: str,
                         opts: Optional[ResourceOptions] = None,
                         content: Optional[str] = None,
                         description: Optional[str] = None,
                         name: Optional[str] = None)
func NewApprovalRuleTemplate(ctx *Context, name string, args ApprovalRuleTemplateArgs, opts ...ResourceOption) (*ApprovalRuleTemplate, error)
public ApprovalRuleTemplate(string name, ApprovalRuleTemplateArgs args, CustomResourceOptions? opts = null)
public ApprovalRuleTemplate(String name, ApprovalRuleTemplateArgs args)
public ApprovalRuleTemplate(String name, ApprovalRuleTemplateArgs args, CustomResourceOptions options)
type: aws:codecommit:ApprovalRuleTemplate
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. ApprovalRuleTemplateArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. ApprovalRuleTemplateArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. ApprovalRuleTemplateArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. ApprovalRuleTemplateArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. ApprovalRuleTemplateArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var approvalRuleTemplateResource = new Aws.CodeCommit.ApprovalRuleTemplate("approvalRuleTemplateResource", new()
{
    Content = "string",
    Description = "string",
    Name = "string",
});
Copy
example, err := codecommit.NewApprovalRuleTemplate(ctx, "approvalRuleTemplateResource", &codecommit.ApprovalRuleTemplateArgs{
	Content:     pulumi.String("string"),
	Description: pulumi.String("string"),
	Name:        pulumi.String("string"),
})
Copy
var approvalRuleTemplateResource = new ApprovalRuleTemplate("approvalRuleTemplateResource", ApprovalRuleTemplateArgs.builder()
    .content("string")
    .description("string")
    .name("string")
    .build());
Copy
approval_rule_template_resource = aws.codecommit.ApprovalRuleTemplate("approvalRuleTemplateResource",
    content="string",
    description="string",
    name="string")
Copy
const approvalRuleTemplateResource = new aws.codecommit.ApprovalRuleTemplate("approvalRuleTemplateResource", {
    content: "string",
    description: "string",
    name: "string",
});
Copy
type: aws:codecommit:ApprovalRuleTemplate
properties:
    content: string
    description: string
    name: string
Copy

ApprovalRuleTemplate Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The ApprovalRuleTemplate resource accepts the following input properties:

Content This property is required. string
The content of the approval rule template. Maximum of 3000 characters.
Description string
The description of the approval rule template. Maximum of 1000 characters.
Name string
The name for the approval rule template. Maximum of 100 characters.
Content This property is required. string
The content of the approval rule template. Maximum of 3000 characters.
Description string
The description of the approval rule template. Maximum of 1000 characters.
Name string
The name for the approval rule template. Maximum of 100 characters.
content This property is required. String
The content of the approval rule template. Maximum of 3000 characters.
description String
The description of the approval rule template. Maximum of 1000 characters.
name String
The name for the approval rule template. Maximum of 100 characters.
content This property is required. string
The content of the approval rule template. Maximum of 3000 characters.
description string
The description of the approval rule template. Maximum of 1000 characters.
name string
The name for the approval rule template. Maximum of 100 characters.
content This property is required. str
The content of the approval rule template. Maximum of 3000 characters.
description str
The description of the approval rule template. Maximum of 1000 characters.
name str
The name for the approval rule template. Maximum of 100 characters.
content This property is required. String
The content of the approval rule template. Maximum of 3000 characters.
description String
The description of the approval rule template. Maximum of 1000 characters.
name String
The name for the approval rule template. Maximum of 100 characters.

Outputs

All input properties are implicitly available as output properties. Additionally, the ApprovalRuleTemplate resource produces the following output properties:

ApprovalRuleTemplateId string
The ID of the approval rule template
CreationDate string
The date the approval rule template was created, in RFC3339 format.
Id string
The provider-assigned unique ID for this managed resource.
LastModifiedDate string
The date the approval rule template was most recently changed, in RFC3339 format.
LastModifiedUser string
The Amazon Resource Name (ARN) of the user who made the most recent changes to the approval rule template.
RuleContentSha256 string
The SHA-256 hash signature for the content of the approval rule template.
ApprovalRuleTemplateId string
The ID of the approval rule template
CreationDate string
The date the approval rule template was created, in RFC3339 format.
Id string
The provider-assigned unique ID for this managed resource.
LastModifiedDate string
The date the approval rule template was most recently changed, in RFC3339 format.
LastModifiedUser string
The Amazon Resource Name (ARN) of the user who made the most recent changes to the approval rule template.
RuleContentSha256 string
The SHA-256 hash signature for the content of the approval rule template.
approvalRuleTemplateId String
The ID of the approval rule template
creationDate String
The date the approval rule template was created, in RFC3339 format.
id String
The provider-assigned unique ID for this managed resource.
lastModifiedDate String
The date the approval rule template was most recently changed, in RFC3339 format.
lastModifiedUser String
The Amazon Resource Name (ARN) of the user who made the most recent changes to the approval rule template.
ruleContentSha256 String
The SHA-256 hash signature for the content of the approval rule template.
approvalRuleTemplateId string
The ID of the approval rule template
creationDate string
The date the approval rule template was created, in RFC3339 format.
id string
The provider-assigned unique ID for this managed resource.
lastModifiedDate string
The date the approval rule template was most recently changed, in RFC3339 format.
lastModifiedUser string
The Amazon Resource Name (ARN) of the user who made the most recent changes to the approval rule template.
ruleContentSha256 string
The SHA-256 hash signature for the content of the approval rule template.
approval_rule_template_id str
The ID of the approval rule template
creation_date str
The date the approval rule template was created, in RFC3339 format.
id str
The provider-assigned unique ID for this managed resource.
last_modified_date str
The date the approval rule template was most recently changed, in RFC3339 format.
last_modified_user str
The Amazon Resource Name (ARN) of the user who made the most recent changes to the approval rule template.
rule_content_sha256 str
The SHA-256 hash signature for the content of the approval rule template.
approvalRuleTemplateId String
The ID of the approval rule template
creationDate String
The date the approval rule template was created, in RFC3339 format.
id String
The provider-assigned unique ID for this managed resource.
lastModifiedDate String
The date the approval rule template was most recently changed, in RFC3339 format.
lastModifiedUser String
The Amazon Resource Name (ARN) of the user who made the most recent changes to the approval rule template.
ruleContentSha256 String
The SHA-256 hash signature for the content of the approval rule template.

Look up Existing ApprovalRuleTemplate Resource

Get an existing ApprovalRuleTemplate resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: ApprovalRuleTemplateState, opts?: CustomResourceOptions): ApprovalRuleTemplate
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        approval_rule_template_id: Optional[str] = None,
        content: Optional[str] = None,
        creation_date: Optional[str] = None,
        description: Optional[str] = None,
        last_modified_date: Optional[str] = None,
        last_modified_user: Optional[str] = None,
        name: Optional[str] = None,
        rule_content_sha256: Optional[str] = None) -> ApprovalRuleTemplate
func GetApprovalRuleTemplate(ctx *Context, name string, id IDInput, state *ApprovalRuleTemplateState, opts ...ResourceOption) (*ApprovalRuleTemplate, error)
public static ApprovalRuleTemplate Get(string name, Input<string> id, ApprovalRuleTemplateState? state, CustomResourceOptions? opts = null)
public static ApprovalRuleTemplate get(String name, Output<String> id, ApprovalRuleTemplateState state, CustomResourceOptions options)
resources:  _:    type: aws:codecommit:ApprovalRuleTemplate    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
ApprovalRuleTemplateId string
The ID of the approval rule template
Content string
The content of the approval rule template. Maximum of 3000 characters.
CreationDate string
The date the approval rule template was created, in RFC3339 format.
Description string
The description of the approval rule template. Maximum of 1000 characters.
LastModifiedDate string
The date the approval rule template was most recently changed, in RFC3339 format.
LastModifiedUser string
The Amazon Resource Name (ARN) of the user who made the most recent changes to the approval rule template.
Name string
The name for the approval rule template. Maximum of 100 characters.
RuleContentSha256 string
The SHA-256 hash signature for the content of the approval rule template.
ApprovalRuleTemplateId string
The ID of the approval rule template
Content string
The content of the approval rule template. Maximum of 3000 characters.
CreationDate string
The date the approval rule template was created, in RFC3339 format.
Description string
The description of the approval rule template. Maximum of 1000 characters.
LastModifiedDate string
The date the approval rule template was most recently changed, in RFC3339 format.
LastModifiedUser string
The Amazon Resource Name (ARN) of the user who made the most recent changes to the approval rule template.
Name string
The name for the approval rule template. Maximum of 100 characters.
RuleContentSha256 string
The SHA-256 hash signature for the content of the approval rule template.
approvalRuleTemplateId String
The ID of the approval rule template
content String
The content of the approval rule template. Maximum of 3000 characters.
creationDate String
The date the approval rule template was created, in RFC3339 format.
description String
The description of the approval rule template. Maximum of 1000 characters.
lastModifiedDate String
The date the approval rule template was most recently changed, in RFC3339 format.
lastModifiedUser String
The Amazon Resource Name (ARN) of the user who made the most recent changes to the approval rule template.
name String
The name for the approval rule template. Maximum of 100 characters.
ruleContentSha256 String
The SHA-256 hash signature for the content of the approval rule template.
approvalRuleTemplateId string
The ID of the approval rule template
content string
The content of the approval rule template. Maximum of 3000 characters.
creationDate string
The date the approval rule template was created, in RFC3339 format.
description string
The description of the approval rule template. Maximum of 1000 characters.
lastModifiedDate string
The date the approval rule template was most recently changed, in RFC3339 format.
lastModifiedUser string
The Amazon Resource Name (ARN) of the user who made the most recent changes to the approval rule template.
name string
The name for the approval rule template. Maximum of 100 characters.
ruleContentSha256 string
The SHA-256 hash signature for the content of the approval rule template.
approval_rule_template_id str
The ID of the approval rule template
content str
The content of the approval rule template. Maximum of 3000 characters.
creation_date str
The date the approval rule template was created, in RFC3339 format.
description str
The description of the approval rule template. Maximum of 1000 characters.
last_modified_date str
The date the approval rule template was most recently changed, in RFC3339 format.
last_modified_user str
The Amazon Resource Name (ARN) of the user who made the most recent changes to the approval rule template.
name str
The name for the approval rule template. Maximum of 100 characters.
rule_content_sha256 str
The SHA-256 hash signature for the content of the approval rule template.
approvalRuleTemplateId String
The ID of the approval rule template
content String
The content of the approval rule template. Maximum of 3000 characters.
creationDate String
The date the approval rule template was created, in RFC3339 format.
description String
The description of the approval rule template. Maximum of 1000 characters.
lastModifiedDate String
The date the approval rule template was most recently changed, in RFC3339 format.
lastModifiedUser String
The Amazon Resource Name (ARN) of the user who made the most recent changes to the approval rule template.
name String
The name for the approval rule template. Maximum of 100 characters.
ruleContentSha256 String
The SHA-256 hash signature for the content of the approval rule template.

Import

Using pulumi import, import CodeCommit approval rule templates using the name. For example:

$ pulumi import aws:codecommit/approvalRuleTemplate:ApprovalRuleTemplate imported ExistingApprovalRuleTemplateName
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
AWS Classic pulumi/pulumi-aws
License
Apache-2.0
Notes
This Pulumi package is based on the aws Terraform Provider.