VpcEndpointConnectionNotification class

Provides a VPC Endpoint connection notification resource. Connection notifications notify subscribers of VPC Endpoint events.

Example Usage

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

const topic = aws.iam.getPolicyDocument({
    statements: [{
        principals: [{
            type: "Service",
            identifiers: ["vpce.amazonaws.com"],
        }],
        effect: "Allow",
        actions: ["SNS:Publish"],
        resources: ["arn:aws:sns:*:*:vpce-notification-topic"],
    }],
});
const topicTopic = new aws.sns.Topic("topic", {
    name: "vpce-notification-topic",
    policy: topic.then(topic => topic.json),
});
const foo = new aws.ec2.VpcEndpointService("foo", {
    acceptanceRequired: false,
    networkLoadBalancerArns: [test.arn],
});
const fooVpcEndpointConnectionNotification = new aws.ec2.VpcEndpointConnectionNotification("foo", {
    vpcEndpointServiceId: foo.id,
    connectionNotificationArn: topicTopic.arn,
    connectionEvents: [
        "Accept",
        "Reject",
    ],
});
import pulumi
import pulumi_aws as aws

topic = aws.iam.get_policy_document(statements=[{
    "principals": [{
        "type": "Service",
        "identifiers": ["vpce.amazonaws.com"],
    }],
    "effect": "Allow",
    "actions": ["SNS:Publish"],
    "resources": ["arn:aws:sns:*:*:vpce-notification-topic"],
}])
topic_topic = aws.sns.Topic("topic",
    name="vpce-notification-topic",
    policy=topic.json)
foo = aws.ec2.VpcEndpointService("foo",
    acceptance_required=False,
    network_load_balancer_arns=[test["arn"]])
foo_vpc_endpoint_connection_notification = aws.ec2.VpcEndpointConnectionNotification("foo",
    vpc_endpoint_service_id=foo.id,
    connection_notification_arn=topic_topic.arn,
    connection_events=[
        "Accept",
        "Reject",
    ])
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() =>
{
    var topic = Aws.Iam.GetPolicyDocument.Invoke(new()
    {
        Statements = new[]
        {
            new Aws.Iam.Inputs.GetPolicyDocumentStatementInputArgs
            {
                Principals = new[]
                {
                    new Aws.Iam.Inputs.GetPolicyDocumentStatementPrincipalInputArgs
                    {
                        Type = "Service",
                        Identifiers = new[]
                        {
                            "vpce.amazonaws.com",
                        },
                    },
                },
                Effect = "Allow",
                Actions = new[]
                {
                    "SNS:Publish",
                },
                Resources = new[]
                {
                    "arn:aws:sns:*:*:vpce-notification-topic",
                },
            },
        },
    });

    var topicTopic = new Aws.Sns.Topic("topic", new()
    {
        Name = "vpce-notification-topic",
        Policy = topic.Apply(getPolicyDocumentResult => getPolicyDocumentResult.Json),
    });

    var foo = new Aws.Ec2.VpcEndpointService("foo", new()
    {
        AcceptanceRequired = false,
        NetworkLoadBalancerArns = new[]
        {
            test.Arn,
        },
    });

    var fooVpcEndpointConnectionNotification = new Aws.Ec2.VpcEndpointConnectionNotification("foo", new()
    {
        VpcEndpointServiceId = foo.Id,
        ConnectionNotificationArn = topicTopic.Arn,
        ConnectionEvents = new[]
        {
            "Accept",
            "Reject",
        },
    });

});
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/ec2"
	"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/iam"
	"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 {
		topic, err := iam.GetPolicyDocument(ctx, &iam.GetPolicyDocumentArgs{
			Statements: []iam.GetPolicyDocumentStatement{
				{
					Principals: []iam.GetPolicyDocumentStatementPrincipal{
						{
							Type: "Service",
							Identifiers: []string{
								"vpce.amazonaws.com",
							},
						},
					},
					Effect: pulumi.StringRef("Allow"),
					Actions: []string{
						"SNS:Publish",
					},
					Resources: []string{
						"arn:aws:sns:*:*:vpce-notification-topic",
					},
				},
			},
		}, nil)
		if err != nil {
			return err
		}
		topicTopic, err := sns.NewTopic(ctx, "topic", &sns.TopicArgs{
			Name:   pulumi.String("vpce-notification-topic"),
			Policy: pulumi.String(topic.Json),
		})
		if err != nil {
			return err
		}
		foo, err := ec2.NewVpcEndpointService(ctx, "foo", &ec2.VpcEndpointServiceArgs{
			AcceptanceRequired: pulumi.Bool(false),
			NetworkLoadBalancerArns: pulumi.StringArray{
				test.Arn,
			},
		})
		if err != nil {
			return err
		}
		_, err = ec2.NewVpcEndpointConnectionNotification(ctx, "foo", &ec2.VpcEndpointConnectionNotificationArgs{
			VpcEndpointServiceId:      foo.ID().ToIDOutput().ToStringOutput(),
			ConnectionNotificationArn: topicTopic.Arn,
			ConnectionEvents: pulumi.StringArray{
				pulumi.String("Accept"),
				pulumi.String("Reject"),
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    aws = {
      source = "pulumi/aws"
    }
  }
}

data "aws_iam_getpolicydocument" "topic" {
  statements {
    principals {
      type        = "Service"
      identifiers = ["vpce.amazonaws.com"]
    }
    effect    = "Allow"
    actions   = ["SNS:Publish"]
    resources = ["arn:aws:sns:*:*:vpce-notification-topic"]
  }
}

resource "aws_sns_topic" "topic" {
  name   = "vpce-notification-topic"
  policy = data.aws_iam_getpolicydocument.topic.json
}
resource "aws_ec2_vpcendpointservice" "foo" {
  acceptance_required        = false
  network_load_balancer_arns = [test.arn]
}
resource "aws_ec2_vpcendpointconnectionnotification" "foo" {
  vpc_endpoint_service_id     = aws_ec2_vpcendpointservice.foo.id
  connection_notification_arn = aws_sns_topic.topic.arn
  connection_events           = ["Accept", "Reject"]
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.iam.IamFunctions;
import com.pulumi.aws.iam.inputs.GetPolicyDocumentArgs;
import com.pulumi.aws.iam.inputs.GetPolicyDocumentStatementArgs;
import com.pulumi.aws.iam.inputs.GetPolicyDocumentStatementPrincipalArgs;
import com.pulumi.aws.sns.Topic;
import com.pulumi.aws.sns.TopicArgs;
import com.pulumi.aws.ec2.VpcEndpointService;
import com.pulumi.aws.ec2.VpcEndpointServiceArgs;
import com.pulumi.aws.ec2.VpcEndpointConnectionNotification;
import com.pulumi.aws.ec2.VpcEndpointConnectionNotificationArgs;
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) {
        final var topic = IamFunctions.getPolicyDocument(GetPolicyDocumentArgs.builder()
            .statements(GetPolicyDocumentStatementArgs.builder()
                .principals(GetPolicyDocumentStatementPrincipalArgs.builder()
                    .type("Service")
                    .identifiers("vpce.amazonaws.com")
                    .build())
                .effect("Allow")
                .actions("SNS:Publish")
                .resources("arn:aws:sns:*:*:vpce-notification-topic")
                .build())
            .build());

        var topicTopic = new Topic("topicTopic", TopicArgs.builder()
            .name("vpce-notification-topic")
            .policy(topic.json())
            .build());

        var foo = new VpcEndpointService("foo", VpcEndpointServiceArgs.builder()
            .acceptanceRequired(false)
            .networkLoadBalancerArns(test.arn())
            .build());

        var fooVpcEndpointConnectionNotification = new VpcEndpointConnectionNotification("fooVpcEndpointConnectionNotification", VpcEndpointConnectionNotificationArgs.builder()
            .vpcEndpointServiceId(foo.id())
            .connectionNotificationArn(topicTopic.arn())
            .connectionEvents(
                "Accept",
                "Reject")
            .build());

    }
}
resources:
  topicTopic:
    type: aws:sns:Topic
    name: topic
    properties:
      name: vpce-notification-topic
      policy: ${topic.json}
  foo:
    type: aws:ec2:VpcEndpointService
    properties:
      acceptanceRequired: false
      networkLoadBalancerArns:
        - ${test.arn}
  fooVpcEndpointConnectionNotification:
    type: aws:ec2:VpcEndpointConnectionNotification
    name: foo
    properties:
      vpcEndpointServiceId: ${foo.id}
      connectionNotificationArn: ${topicTopic.arn}
      connectionEvents:
        - Accept
        - Reject
variables:
  topic:
    fn::invoke:
      function: aws:iam:getPolicyDocument
      arguments:
        statements:
          - principals:
              - type: Service
                identifiers:
                  - vpce.amazonaws.com
            effect: Allow
            actions:
              - SNS:Publish
            resources:
              - arn:aws:sns:*:*:vpce-notification-topic

Import

Using pulumi import, import VPC Endpoint connection notifications using the VPC endpoint connection notification id. For example:

$ pulumi import aws:ec2/vpcEndpointConnectionNotification:VpcEndpointConnectionNotification foo vpce-nfn-09e6ed3b4efba2263

Constructors

VpcEndpointConnectionNotification(String name, {VpcEndpointConnectionNotificationArgs? args, CustomResourceOptions? options})
Creates a new VpcEndpointConnectionNotification. name The Pulumi resource name. args Arguments used to configure this VpcEndpointConnectionNotification. The set of arguments for VpcEndpointConnectionNotification. options Resource options controlling this resource's behavior.
VpcEndpointConnectionNotification.reference(String urn)
Creates a typed reference to an existing VpcEndpointConnectionNotification resource.

Properties

childResources Set<Resource>
finalinherited
completionSources Map<String, IOutputCompletionSource>
latefinalinherited
connectionEvents ↔ Output<List<String>>
One or more endpoint events for which to receive notifications.
latefinal
connectionNotificationArn ↔ Output<String>
The ARN of the SNS topic for the notifications.
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
notificationType ↔ Output<String>
The type of notification.
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
state ↔ Output<String>
The state of the notification.
latefinal
transformations List<ResourceTransformation>
Inherited/explicit legacy transformations.
no setterinherited
urn ↔ Output<String>
latefinalinherited
vpcEndpointId ↔ Output<String?>
The ID of the VPC Endpoint to receive notifications for.
latefinal
vpcEndpointServiceId ↔ Output<String?>
The ID of the VPC Endpoint Service to receive notifications for.
latefinal

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, {VpcEndpointConnectionNotificationState? state, CustomResourceOptions? options}) VpcEndpointConnectionNotification
Gets an existing VpcEndpointConnectionNotification resource's state with the given name and id.