Resource: awsCodestarnotificationsNotificationRule
Provides a CodeStar Notifications Rule.
Example Usage
/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
const awsCodecommitRepositoryCode =
new aws.codecommitRepository.CodecommitRepository(this, "code", {
repositoryName: "example-code-repo",
});
const awsSnsTopicNotif = new aws.snsTopic.SnsTopic(this, "notif", {
name: "notification",
});
const dataAwsIamPolicyDocumentNotifAccess =
new aws.dataAwsIamPolicyDocument.DataAwsIamPolicyDocument(
this,
"notif_access",
{
statement: [
{
actions: ["sns:Publish"],
principals: [
{
identifiers: ["codestar-notifications.amazonaws.com"],
type: "Service",
},
],
resources: [awsSnsTopicNotif.arn],
},
],
}
);
new aws.codestarnotificationsNotificationRule.CodestarnotificationsNotificationRule(
this,
"commits",
{
detailType: "BASIC",
eventTypeIds: ["codecommit-repository-comments-on-commits"],
name: "example-code-repo-commits",
resource: awsCodecommitRepositoryCode.arn,
target: [
{
address: awsSnsTopicNotif.arn,
},
],
}
);
new aws.snsTopicPolicy.SnsTopicPolicy(this, "default", {
arn: awsSnsTopicNotif.arn,
policy: dataAwsIamPolicyDocumentNotifAccess.json,
});
Argument Reference
The following arguments are supported:
detailType
- (Required) The level of detail to include in the notifications for this resource. Possible values arebasic
andfull
.eventTypeIds
- (Required) A list of event types associated with this notification rule. For list of allowed events see here.name
- (Required) The name of notification rule.resource
- (Required) The ARN of the resource to associate with the notification rule.status
- (Optional) The status of the notification rule. Possible values areenabled
anddisabled
, default isenabled
.tags
- (Optional) A map of tags to assign to the resource. If configured with a providerdefaultTags
configuration block present, tags with matching keys will overwrite those defined at the provider-level.target
- (Optional) Configuration blocks containing notification target information. Can be specified multiple times. At least one target must be specified on creation.
An target
block supports the following arguments:
address
- (Required) The ARN of notification rule target. For example, a SNS Topic ARN.type
- (Optional) The type of the notification target. Default value issns
.
Attributes Reference
In addition to all arguments above, the following attributes are exported:
id
- The codestar notification rule ARN.arn
- The codestar notification rule ARN.tagsAll
- A map of tags assigned to the resource, including those inherited from the providerdefaultTags
configuration block.
Import
CodeStar notification rule can be imported using the ARN, e.g.,