AWS Classic v5.41.0, May 15 23
AWS Classic v5.41.0, May 15 23
aws.codestarnotifications.NotificationRule
Explore with Pulumi AI
Provides a CodeStar Notifications Rule.
Example Usage
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var code = new Aws.CodeCommit.Repository("code", new()
{
RepositoryName = "example-code-repo",
});
var notif = new Aws.Sns.Topic("notif");
var notifAccess = Aws.Iam.GetPolicyDocument.Invoke(new()
{
Statements = new[]
{
new Aws.Iam.Inputs.GetPolicyDocumentStatementInputArgs
{
Actions = new[]
{
"sns:Publish",
},
Principals = new[]
{
new Aws.Iam.Inputs.GetPolicyDocumentStatementPrincipalInputArgs
{
Type = "Service",
Identifiers = new[]
{
"codestar-notifications.amazonaws.com",
},
},
},
Resources = new[]
{
notif.Arn,
},
},
},
});
var @default = new Aws.Sns.TopicPolicy("default", new()
{
Arn = notif.Arn,
Policy = notifAccess.Apply(getPolicyDocumentResult => getPolicyDocumentResult.Json),
});
var commits = new Aws.CodeStarNotifications.NotificationRule("commits", new()
{
DetailType = "BASIC",
EventTypeIds = new[]
{
"codecommit-repository-comments-on-commits",
},
Resource = code.Arn,
Targets = new[]
{
new Aws.CodeStarNotifications.Inputs.NotificationRuleTargetArgs
{
Address = notif.Arn,
},
},
});
});
Coming soon!
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.codecommit.Repository;
import com.pulumi.aws.codecommit.RepositoryArgs;
import com.pulumi.aws.sns.Topic;
import com.pulumi.aws.iam.IamFunctions;
import com.pulumi.aws.iam.inputs.GetPolicyDocumentArgs;
import com.pulumi.aws.sns.TopicPolicy;
import com.pulumi.aws.sns.TopicPolicyArgs;
import com.pulumi.aws.codestarnotifications.NotificationRule;
import com.pulumi.aws.codestarnotifications.NotificationRuleArgs;
import com.pulumi.aws.codestarnotifications.inputs.NotificationRuleTargetArgs;
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 code = new Repository("code", RepositoryArgs.builder()
.repositoryName("example-code-repo")
.build());
var notif = new Topic("notif");
final var notifAccess = IamFunctions.getPolicyDocument(GetPolicyDocumentArgs.builder()
.statements(GetPolicyDocumentStatementArgs.builder()
.actions("sns:Publish")
.principals(GetPolicyDocumentStatementPrincipalArgs.builder()
.type("Service")
.identifiers("codestar-notifications.amazonaws.com")
.build())
.resources(notif.arn())
.build())
.build());
var default_ = new TopicPolicy("default", TopicPolicyArgs.builder()
.arn(notif.arn())
.policy(notifAccess.applyValue(getPolicyDocumentResult -> getPolicyDocumentResult).applyValue(notifAccess -> notifAccess.applyValue(getPolicyDocumentResult -> getPolicyDocumentResult.json())))
.build());
var commits = new NotificationRule("commits", NotificationRuleArgs.builder()
.detailType("BASIC")
.eventTypeIds("codecommit-repository-comments-on-commits")
.resource(code.arn())
.targets(NotificationRuleTargetArgs.builder()
.address(notif.arn())
.build())
.build());
}
}
import pulumi
import pulumi_aws as aws
code = aws.codecommit.Repository("code", repository_name="example-code-repo")
notif = aws.sns.Topic("notif")
notif_access = notif.arn.apply(lambda arn: aws.iam.get_policy_document_output(statements=[aws.iam.GetPolicyDocumentStatementArgs(
actions=["sns:Publish"],
principals=[aws.iam.GetPolicyDocumentStatementPrincipalArgs(
type="Service",
identifiers=["codestar-notifications.amazonaws.com"],
)],
resources=[arn],
)]))
default = aws.sns.TopicPolicy("default",
arn=notif.arn,
policy=notif_access.json)
commits = aws.codestarnotifications.NotificationRule("commits",
detail_type="BASIC",
event_type_ids=["codecommit-repository-comments-on-commits"],
resource=code.arn,
targets=[aws.codestarnotifications.NotificationRuleTargetArgs(
address=notif.arn,
)])
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const code = new aws.codecommit.Repository("code", {repositoryName: "example-code-repo"});
const notif = new aws.sns.Topic("notif", {});
const notifAccess = notif.arn.apply(arn => aws.iam.getPolicyDocumentOutput({
statements: [{
actions: ["sns:Publish"],
principals: [{
type: "Service",
identifiers: ["codestar-notifications.amazonaws.com"],
}],
resources: [arn],
}],
}));
const _default = new aws.sns.TopicPolicy("default", {
arn: notif.arn,
policy: notifAccess.apply(notifAccess => notifAccess.json),
});
const commits = new aws.codestarnotifications.NotificationRule("commits", {
detailType: "BASIC",
eventTypeIds: ["codecommit-repository-comments-on-commits"],
resource: code.arn,
targets: [{
address: notif.arn,
}],
});
resources:
code:
type: aws:codecommit:Repository
properties:
repositoryName: example-code-repo
notif:
type: aws:sns:Topic
default:
type: aws:sns:TopicPolicy
properties:
arn: ${notif.arn}
policy: ${notifAccess.json}
commits:
type: aws:codestarnotifications:NotificationRule
properties:
detailType: BASIC
eventTypeIds:
- codecommit-repository-comments-on-commits
resource: ${code.arn}
targets:
- address: ${notif.arn}
variables:
notifAccess:
fn::invoke:
Function: aws:iam:getPolicyDocument
Arguments:
statements:
- actions:
- sns:Publish
principals:
- type: Service
identifiers:
- codestar-notifications.amazonaws.com
resources:
- ${notif.arn}
Create NotificationRule Resource
new NotificationRule(name: string, args: NotificationRuleArgs, opts?: CustomResourceOptions);
@overload
def NotificationRule(resource_name: str,
opts: Optional[ResourceOptions] = None,
detail_type: Optional[str] = None,
event_type_ids: Optional[Sequence[str]] = None,
name: Optional[str] = None,
resource: Optional[str] = None,
status: Optional[str] = None,
tags: Optional[Mapping[str, str]] = None,
targets: Optional[Sequence[NotificationRuleTargetArgs]] = None)
@overload
def NotificationRule(resource_name: str,
args: NotificationRuleArgs,
opts: Optional[ResourceOptions] = None)
func NewNotificationRule(ctx *Context, name string, args NotificationRuleArgs, opts ...ResourceOption) (*NotificationRule, error)
public NotificationRule(string name, NotificationRuleArgs args, CustomResourceOptions? opts = null)
public NotificationRule(String name, NotificationRuleArgs args)
public NotificationRule(String name, NotificationRuleArgs args, CustomResourceOptions options)
type: aws:codestarnotifications:NotificationRule
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args NotificationRuleArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args NotificationRuleArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args NotificationRuleArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args NotificationRuleArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args NotificationRuleArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
NotificationRule Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
The NotificationRule resource accepts the following input properties:
- Detail
Type string The level of detail to include in the notifications for this resource. Possible values are
BASIC
andFULL
.- Event
Type List<string>Ids A list of event types associated with this notification rule. For list of allowed events see here.
- Resource string
The ARN of the resource to associate with the notification rule.
- Name string
The name of notification rule.
- Status string
The status of the notification rule. Possible values are
ENABLED
andDISABLED
, default isENABLED
.- Dictionary<string, string>
A map of tags to assign to the resource. .If configured with a provider
default_tags
configuration block present, tags with matching keys will overwrite those defined at the provider-level.- Targets
List<Notification
Rule Target Args> Configuration blocks containing notification target information. Can be specified multiple times. At least one target must be specified on creation.
- Detail
Type string The level of detail to include in the notifications for this resource. Possible values are
BASIC
andFULL
.- Event
Type []stringIds A list of event types associated with this notification rule. For list of allowed events see here.
- Resource string
The ARN of the resource to associate with the notification rule.
- Name string
The name of notification rule.
- Status string
The status of the notification rule. Possible values are
ENABLED
andDISABLED
, default isENABLED
.- map[string]string
A map of tags to assign to the resource. .If configured with a provider
default_tags
configuration block present, tags with matching keys will overwrite those defined at the provider-level.- Targets
[]Notification
Rule Target Args Configuration blocks containing notification target information. Can be specified multiple times. At least one target must be specified on creation.
- detail
Type String The level of detail to include in the notifications for this resource. Possible values are
BASIC
andFULL
.- event
Type List<String>Ids A list of event types associated with this notification rule. For list of allowed events see here.
- resource String
The ARN of the resource to associate with the notification rule.
- name String
The name of notification rule.
- status String
The status of the notification rule. Possible values are
ENABLED
andDISABLED
, default isENABLED
.- Map<String,String>
A map of tags to assign to the resource. .If configured with a provider
default_tags
configuration block present, tags with matching keys will overwrite those defined at the provider-level.- targets
List<Notification
Rule Target Args> Configuration blocks containing notification target information. Can be specified multiple times. At least one target must be specified on creation.
- detail
Type string The level of detail to include in the notifications for this resource. Possible values are
BASIC
andFULL
.- event
Type string[]Ids A list of event types associated with this notification rule. For list of allowed events see here.
- resource string
The ARN of the resource to associate with the notification rule.
- name string
The name of notification rule.
- status string
The status of the notification rule. Possible values are
ENABLED
andDISABLED
, default isENABLED
.- {[key: string]: string}
A map of tags to assign to the resource. .If configured with a provider
default_tags
configuration block present, tags with matching keys will overwrite those defined at the provider-level.- targets
Notification
Rule Target Args[] Configuration blocks containing notification target information. Can be specified multiple times. At least one target must be specified on creation.
- detail_
type str The level of detail to include in the notifications for this resource. Possible values are
BASIC
andFULL
.- event_
type_ Sequence[str]ids A list of event types associated with this notification rule. For list of allowed events see here.
- resource str
The ARN of the resource to associate with the notification rule.
- name str
The name of notification rule.
- status str
The status of the notification rule. Possible values are
ENABLED
andDISABLED
, default isENABLED
.- Mapping[str, str]
A map of tags to assign to the resource. .If configured with a provider
default_tags
configuration block present, tags with matching keys will overwrite those defined at the provider-level.- targets
Sequence[Notification
Rule Target Args] Configuration blocks containing notification target information. Can be specified multiple times. At least one target must be specified on creation.
- detail
Type String The level of detail to include in the notifications for this resource. Possible values are
BASIC
andFULL
.- event
Type List<String>Ids A list of event types associated with this notification rule. For list of allowed events see here.
- resource String
The ARN of the resource to associate with the notification rule.
- name String
The name of notification rule.
- status String
The status of the notification rule. Possible values are
ENABLED
andDISABLED
, default isENABLED
.- Map<String>
A map of tags to assign to the resource. .If configured with a provider
default_tags
configuration block present, tags with matching keys will overwrite those defined at the provider-level.- targets List<Property Map>
Configuration blocks containing notification target information. Can be specified multiple times. At least one target must be specified on creation.
Outputs
All input properties are implicitly available as output properties. Additionally, the NotificationRule resource produces the following output properties:
Look up Existing NotificationRule Resource
Get an existing NotificationRule 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?: NotificationRuleState, opts?: CustomResourceOptions): NotificationRule
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
arn: Optional[str] = None,
detail_type: Optional[str] = None,
event_type_ids: Optional[Sequence[str]] = None,
name: Optional[str] = None,
resource: Optional[str] = None,
status: Optional[str] = None,
tags: Optional[Mapping[str, str]] = None,
tags_all: Optional[Mapping[str, str]] = None,
targets: Optional[Sequence[NotificationRuleTargetArgs]] = None) -> NotificationRule
func GetNotificationRule(ctx *Context, name string, id IDInput, state *NotificationRuleState, opts ...ResourceOption) (*NotificationRule, error)
public static NotificationRule Get(string name, Input<string> id, NotificationRuleState? state, CustomResourceOptions? opts = null)
public static NotificationRule get(String name, Output<String> id, NotificationRuleState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
- name
- The unique name of the resulting resource.
- id
- 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
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- 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
- The unique name of the resulting resource.
- id
- 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
- The unique name of the resulting resource.
- id
- 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.
- Arn string
The codestar notification rule ARN.
- Detail
Type string The level of detail to include in the notifications for this resource. Possible values are
BASIC
andFULL
.- Event
Type List<string>Ids A list of event types associated with this notification rule. For list of allowed events see here.
- Name string
The name of notification rule.
- Resource string
The ARN of the resource to associate with the notification rule.
- Status string
The status of the notification rule. Possible values are
ENABLED
andDISABLED
, default isENABLED
.- Dictionary<string, string>
A map of tags to assign to the resource. .If configured with a provider
default_tags
configuration block present, tags with matching keys will overwrite those defined at the provider-level.- Dictionary<string, string>
A map of tags assigned to the resource, including those inherited from the provider
default_tags
configuration block.- Targets
List<Notification
Rule Target Args> Configuration blocks containing notification target information. Can be specified multiple times. At least one target must be specified on creation.
- Arn string
The codestar notification rule ARN.
- Detail
Type string The level of detail to include in the notifications for this resource. Possible values are
BASIC
andFULL
.- Event
Type []stringIds A list of event types associated with this notification rule. For list of allowed events see here.
- Name string
The name of notification rule.
- Resource string
The ARN of the resource to associate with the notification rule.
- Status string
The status of the notification rule. Possible values are
ENABLED
andDISABLED
, default isENABLED
.- map[string]string
A map of tags to assign to the resource. .If configured with a provider
default_tags
configuration block present, tags with matching keys will overwrite those defined at the provider-level.- map[string]string
A map of tags assigned to the resource, including those inherited from the provider
default_tags
configuration block.- Targets
[]Notification
Rule Target Args Configuration blocks containing notification target information. Can be specified multiple times. At least one target must be specified on creation.
- arn String
The codestar notification rule ARN.
- detail
Type String The level of detail to include in the notifications for this resource. Possible values are
BASIC
andFULL
.- event
Type List<String>Ids A list of event types associated with this notification rule. For list of allowed events see here.
- name String
The name of notification rule.
- resource String
The ARN of the resource to associate with the notification rule.
- status String
The status of the notification rule. Possible values are
ENABLED
andDISABLED
, default isENABLED
.- Map<String,String>
A map of tags to assign to the resource. .If configured with a provider
default_tags
configuration block present, tags with matching keys will overwrite those defined at the provider-level.- Map<String,String>
A map of tags assigned to the resource, including those inherited from the provider
default_tags
configuration block.- targets
List<Notification
Rule Target Args> Configuration blocks containing notification target information. Can be specified multiple times. At least one target must be specified on creation.
- arn string
The codestar notification rule ARN.
- detail
Type string The level of detail to include in the notifications for this resource. Possible values are
BASIC
andFULL
.- event
Type string[]Ids A list of event types associated with this notification rule. For list of allowed events see here.
- name string
The name of notification rule.
- resource string
The ARN of the resource to associate with the notification rule.
- status string
The status of the notification rule. Possible values are
ENABLED
andDISABLED
, default isENABLED
.- {[key: string]: string}
A map of tags to assign to the resource. .If configured with a provider
default_tags
configuration block present, tags with matching keys will overwrite those defined at the provider-level.- {[key: string]: string}
A map of tags assigned to the resource, including those inherited from the provider
default_tags
configuration block.- targets
Notification
Rule Target Args[] Configuration blocks containing notification target information. Can be specified multiple times. At least one target must be specified on creation.
- arn str
The codestar notification rule ARN.
- detail_
type str The level of detail to include in the notifications for this resource. Possible values are
BASIC
andFULL
.- event_
type_ Sequence[str]ids A list of event types associated with this notification rule. For list of allowed events see here.
- name str
The name of notification rule.
- resource str
The ARN of the resource to associate with the notification rule.
- status str
The status of the notification rule. Possible values are
ENABLED
andDISABLED
, default isENABLED
.- Mapping[str, str]
A map of tags to assign to the resource. .If configured with a provider
default_tags
configuration block present, tags with matching keys will overwrite those defined at the provider-level.- Mapping[str, str]
A map of tags assigned to the resource, including those inherited from the provider
default_tags
configuration block.- targets
Sequence[Notification
Rule Target Args] Configuration blocks containing notification target information. Can be specified multiple times. At least one target must be specified on creation.
- arn String
The codestar notification rule ARN.
- detail
Type String The level of detail to include in the notifications for this resource. Possible values are
BASIC
andFULL
.- event
Type List<String>Ids A list of event types associated with this notification rule. For list of allowed events see here.
- name String
The name of notification rule.
- resource String
The ARN of the resource to associate with the notification rule.
- status String
The status of the notification rule. Possible values are
ENABLED
andDISABLED
, default isENABLED
.- Map<String>
A map of tags to assign to the resource. .If configured with a provider
default_tags
configuration block present, tags with matching keys will overwrite those defined at the provider-level.- Map<String>
A map of tags assigned to the resource, including those inherited from the provider
default_tags
configuration block.- targets List<Property Map>
Configuration blocks containing notification target information. Can be specified multiple times. At least one target must be specified on creation.
Supporting Types
NotificationRuleTarget
Import
CodeStar notification rule can be imported using the ARN, e.g.,
$ pulumi import aws:codestarnotifications/notificationRule:NotificationRule foo arn:aws:codestar-notifications:us-west-1:0123456789:notificationrule/2cdc68a3-8f7c-4893-b6a5-45b362bd4f2b
Package Details
- Repository
- AWS Classic pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
This Pulumi package is based on the
aws
Terraform Provider.