Notification class
Provides an AutoScaling Group with Notification support, via SNS Topics. Each of
the notifications map to a Notification Configuration inside Amazon Web
Services, and are applied to each AutoScaling Group you supply.
Example Usage
Basic usage:
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = new aws.sns.Topic("example", {name: "example-topic"});
const bar = new aws.autoscaling.Group("bar", {name: "foobar1-test"});
const foo = new aws.autoscaling.Group("foo", {name: "barfoo-test"});
const exampleNotifications = new aws.autoscaling.Notification("example_notifications", {
groupNames: [
bar.name,
foo.name,
],
notifications: [
aws.autoscaling.NotificationType.InstanceLaunch,
aws.autoscaling.NotificationType.InstanceTerminate,
aws.autoscaling.NotificationType.InstanceLaunchError,
aws.autoscaling.NotificationType.InstanceTerminateError,
],
topicArn: example.arn,
});
import pulumi
import pulumi_aws as aws
example = aws.sns.Topic("example", name="example-topic")
bar = aws.autoscaling.Group("bar", name="foobar1-test")
foo = aws.autoscaling.Group("foo", name="barfoo-test")
example_notifications = aws.autoscaling.Notification("example_notifications",
group_names=[
bar.name,
foo.name,
],
notifications=[
aws.autoscaling.NotificationType.INSTANCE_LAUNCH,
aws.autoscaling.NotificationType.INSTANCE_TERMINATE,
aws.autoscaling.NotificationType.INSTANCE_LAUNCH_ERROR,
aws.autoscaling.NotificationType.INSTANCE_TERMINATE_ERROR,
],
topic_arn=example.arn)
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var example = new Aws.Sns.Topic("example", new()
{
Name = "example-topic",
});
var bar = new Aws.AutoScaling.Group("bar", new()
{
Name = "foobar1-test",
});
var foo = new Aws.AutoScaling.Group("foo", new()
{
Name = "barfoo-test",
});
var exampleNotifications = new Aws.AutoScaling.Notification("example_notifications", new()
{
GroupNames = new[]
{
bar.Name,
foo.Name,
},
Notifications = new[]
{
Aws.AutoScaling.NotificationType.InstanceLaunch,
Aws.AutoScaling.NotificationType.InstanceTerminate,
Aws.AutoScaling.NotificationType.InstanceLaunchError,
Aws.AutoScaling.NotificationType.InstanceTerminateError,
},
TopicArn = example.Arn,
});
});
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/autoscaling"
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/sns"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
example, err := sns.NewTopic(ctx, "example", &sns.TopicArgs{
Name: pulumi.String("example-topic"),
})
if err != nil {
return err
}
bar, err := autoscaling.NewGroup(ctx, "bar", &autoscaling.GroupArgs{
Name: pulumi.String("foobar1-test"),
})
if err != nil {
return err
}
foo, err := autoscaling.NewGroup(ctx, "foo", &autoscaling.GroupArgs{
Name: pulumi.String("barfoo-test"),
})
if err != nil {
return err
}
_, err = autoscaling.NewNotification(ctx, "example_notifications", &autoscaling.NotificationArgs{
GroupNames: pulumi.StringArray{
bar.Name,
foo.Name,
},
Notifications: autoscaling.NotificationTypeArray{
autoscaling.NotificationTypeInstanceLaunch,
autoscaling.NotificationTypeInstanceTerminate,
autoscaling.NotificationTypeInstanceLaunchError,
autoscaling.NotificationTypeInstanceTerminateError,
},
TopicArn: example.Arn,
})
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
aws = {
source = "pulumi/aws"
}
}
}
resource "aws_autoscaling_notification" "example_notifications" {
group_names = [aws_autoscaling_group.bar.name, aws_autoscaling_group.foo.name]
notifications = ["autoscaling:EC2_INSTANCE_LAUNCH", "autoscaling:EC2_INSTANCE_TERMINATE", "autoscaling:EC2_INSTANCE_LAUNCH_ERROR", "autoscaling:EC2_INSTANCE_TERMINATE_ERROR"]
topic_arn = aws_sns_topic.example.arn
}
resource "aws_sns_topic" "example" {
name = "example-topic"
}
resource "aws_autoscaling_group" "bar" {
name = "foobar1-test"
}
resource "aws_autoscaling_group" "foo" {
name = "barfoo-test"
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.sns.Topic;
import com.pulumi.aws.sns.TopicArgs;
import com.pulumi.aws.autoscaling.Group;
import com.pulumi.aws.autoscaling.GroupArgs;
import com.pulumi.aws.autoscaling.Notification;
import com.pulumi.aws.autoscaling.NotificationArgs;
import java.util.ArrayList;
import java.util.Arrays;
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 Topic("example", TopicArgs.builder()
.name("example-topic")
.build());
var bar = new Group("bar", GroupArgs.builder()
.name("foobar1-test")
.build());
var foo = new Group("foo", GroupArgs.builder()
.name("barfoo-test")
.build());
var exampleNotifications = new Notification("exampleNotifications", NotificationArgs.builder()
.groupNames(
bar.name(),
foo.name())
.notifications(
"autoscaling:EC2_INSTANCE_LAUNCH",
"autoscaling:EC2_INSTANCE_TERMINATE",
"autoscaling:EC2_INSTANCE_LAUNCH_ERROR",
"autoscaling:EC2_INSTANCE_TERMINATE_ERROR")
.topicArn(example.arn())
.build());
}
}
resources:
exampleNotifications:
type: aws:autoscaling:Notification
name: example_notifications
properties:
groupNames:
- ${bar.name}
- ${foo.name}
notifications:
- autoscaling:EC2_INSTANCE_LAUNCH
- autoscaling:EC2_INSTANCE_TERMINATE
- autoscaling:EC2_INSTANCE_LAUNCH_ERROR
- autoscaling:EC2_INSTANCE_TERMINATE_ERROR
topicArn: ${example.arn}
example:
type: aws:sns:Topic
properties:
name: example-topic
bar:
type: aws:autoscaling:Group
properties:
name: foobar1-test
foo:
type: aws:autoscaling:Group
properties:
name: barfoo-test
Constructors
- Notification(String name, {NotificationArgs? args, CustomResourceOptions? options})
-
Creates a new Notification.
nameThe Pulumi resource name.argsArguments used to configure this Notification. The set of arguments for Notification.optionsResource options controlling this resource's behavior. - Notification.reference(String urn)
- Creates a typed reference to an existing Notification resource.
Properties
-
childResources
→ Set<
Resource> -
finalinherited
-
completionSources
↔ Map<
String, IOutputCompletionSource> -
latefinalinherited
-
groupNames
↔ Output<
List< String> > -
List of AutoScaling Group Names
latefinal
- hashCode → int
-
The hash code for this object.
no setterinherited
-
id
↔ Output<
String> -
getter/setter pairinherited
- isCustom → bool
-
Returns whether this resource is provider-managed.
no setterinherited
- isProtected → bool
-
Returns whether this resource is protected from deletion.
no setterinherited
- isRemote → bool
-
Whether this resource is registered as remote.
no setterinherited
- isResourceReference → bool
-
Whether this instance represents a resource value returned over RPC.
finalinherited
-
notifications
↔ Output<
List< NotificationType> > -
List of Notification Types that trigger
notifications. Acceptable values are documented in the AWS documentation here
latefinal
-
region
↔ Output<
String> -
Region where this resource will be managed. Defaults to the Region set in the provider configuration.
latefinal
-
resourceTransforms
→ List<
ResourceTransform> -
Inherited/explicit async transforms.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
topicArn
↔ Output<
String> -
Topic ARN for notifications to be sent through
latefinal
-
transformations
→ List<
ResourceTransformation> -
Inherited/explicit legacy transformations.
no setterinherited
-
urn
↔ Output<
String> -
latefinalinherited
Methods
-
failId(
Object error) → void -
Completes this resource ID with an error when registration fails.
inherited
-
failOutputs(
Object error) → void -
Completes all output properties with
error.inherited -
failUrn(
Object error) → void -
Completes this resource URN with an error when registration fails.
inherited
-
getProvider(
String moduleMember) → ProviderResource? -
Returns provider for
moduleMember's package, if configured.inherited -
getResourceName(
) → String -
Returns this resource's logical name.
inherited
-
getResourceType(
) → String -
Returns this resource's Pulumi type token.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
registerOutput<
T> (String propertyName, {Object? decoder(Object?)?, bool isSecret = false}) → Output< T> -
Registers a dynamic output property for this resource.
inherited
-
resolveId(
String? value, {required bool isKnown}) → void -
Resolves the provider-assigned ID for this resource.
inherited
-
resolveOutputs(
Struct outputs) → void -
Resolves all output properties from a monitor response payload.
inherited
-
resolveUrn(
String value) → void -
Resolves this resource's URN once assigned by the engine.
inherited
-
serializeProperties(
Map< String, dynamic> properties) → Future<Struct> -
Serializes resource properties for RPC transmission.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
get(
String name, Input< String> id, {NotificationState? state, CustomResourceOptions? options}) → Notification -
Gets an existing Notification resource's state with the given
nameandid.