github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/sns/topicSubscription.go (about)

     1  // Code generated by the Pulumi Terraform Bridge (tfgen) Tool DO NOT EDIT.
     2  // *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
     3  
     4  package sns
     5  
     6  import (
     7  	"context"
     8  	"reflect"
     9  
    10  	"errors"
    11  	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal"
    12  	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    13  )
    14  
    15  // Provides a resource for subscribing to SNS topics. Requires that an SNS topic exist for the subscription to attach to. This resource allows you to automatically place messages sent to SNS topics in SQS queues, send them as HTTP(S) POST requests to a given endpoint, send SMS messages, or notify devices / applications. The most likely use case for provider users will probably be SQS queues.
    16  //
    17  // > **NOTE:** If the SNS topic and SQS queue are in different AWS regions, the `sns.TopicSubscription` must use an AWS provider that is in the same region as the SNS topic. If the `sns.TopicSubscription` uses a provider with a different region than the SNS topic, this provider will fail to create the subscription.
    18  //
    19  // > **NOTE:** Setup of cross-account subscriptions from SNS topics to SQS queues requires the provider to have access to BOTH accounts.
    20  //
    21  // > **NOTE:** If an SNS topic and SQS queue are in different AWS accounts but the same region, the `sns.TopicSubscription` must use the AWS provider for the account with the SQS queue. If `sns.TopicSubscription` uses a Provider with a different account than the SQS queue, this provider creates the subscription but does not keep state and tries to re-create the subscription at every `apply`.
    22  //
    23  // > **NOTE:** If an SNS topic and SQS queue are in different AWS accounts and different AWS regions, the subscription needs to be initiated from the account with the SQS queue but in the region of the SNS topic.
    24  //
    25  // > **NOTE:** You cannot unsubscribe to a subscription that is pending confirmation. If you use `email`, `email-json`, or `http`/`https` (without auto-confirmation enabled), until the subscription is confirmed (e.g., outside of this provider), AWS does not allow this provider to delete / unsubscribe the subscription. If you `destroy` an unconfirmed subscription, this provider will remove the subscription from its state but the subscription will still exist in AWS. However, if you delete an SNS topic, SNS [deletes all the subscriptions](https://docs.aws.amazon.com/sns/latest/dg/sns-delete-subscription-topic.html) associated with the topic. Also, you can import a subscription after confirmation and then have the capability to delete it.
    26  //
    27  // ## Example Usage
    28  //
    29  // You can directly supply a topic and ARN by hand in the `topicArn` property along with the queue ARN:
    30  //
    31  // <!--Start PulumiCodeChooser -->
    32  // ```go
    33  // package main
    34  //
    35  // import (
    36  //
    37  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/sns"
    38  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    39  //
    40  // )
    41  //
    42  //	func main() {
    43  //		pulumi.Run(func(ctx *pulumi.Context) error {
    44  //			_, err := sns.NewTopicSubscription(ctx, "user_updates_sqs_target", &sns.TopicSubscriptionArgs{
    45  //				Topic:    pulumi.Any("arn:aws:sns:us-west-2:432981146916:user-updates-topic"),
    46  //				Protocol: pulumi.String("sqs"),
    47  //				Endpoint: pulumi.String("arn:aws:sqs:us-west-2:432981146916:queue-too"),
    48  //			})
    49  //			if err != nil {
    50  //				return err
    51  //			}
    52  //			return nil
    53  //		})
    54  //	}
    55  //
    56  // ```
    57  // <!--End PulumiCodeChooser -->
    58  //
    59  // Alternatively you can use the ARN properties of a managed SNS topic and SQS queue:
    60  //
    61  // <!--Start PulumiCodeChooser -->
    62  // ```go
    63  // package main
    64  //
    65  // import (
    66  //
    67  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/sns"
    68  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/sqs"
    69  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    70  //
    71  // )
    72  //
    73  //	func main() {
    74  //		pulumi.Run(func(ctx *pulumi.Context) error {
    75  //			userUpdates, err := sns.NewTopic(ctx, "user_updates", &sns.TopicArgs{
    76  //				Name: pulumi.String("user-updates-topic"),
    77  //			})
    78  //			if err != nil {
    79  //				return err
    80  //			}
    81  //			userUpdatesQueue, err := sqs.NewQueue(ctx, "user_updates_queue", &sqs.QueueArgs{
    82  //				Name: pulumi.String("user-updates-queue"),
    83  //			})
    84  //			if err != nil {
    85  //				return err
    86  //			}
    87  //			_, err = sns.NewTopicSubscription(ctx, "user_updates_sqs_target", &sns.TopicSubscriptionArgs{
    88  //				Topic:    userUpdates.Arn,
    89  //				Protocol: pulumi.String("sqs"),
    90  //				Endpoint: userUpdatesQueue.Arn,
    91  //			})
    92  //			if err != nil {
    93  //				return err
    94  //			}
    95  //			return nil
    96  //		})
    97  //	}
    98  //
    99  // ```
   100  // <!--End PulumiCodeChooser -->
   101  //
   102  // You can subscribe SNS topics to SQS queues in different Amazon accounts and regions:
   103  //
   104  // <!--Start PulumiCodeChooser -->
   105  // ```go
   106  // package main
   107  //
   108  // import (
   109  //
   110  //	"fmt"
   111  //
   112  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/iam"
   113  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/sns"
   114  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/sqs"
   115  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
   116  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
   117  //
   118  // )
   119  // func main() {
   120  // pulumi.Run(func(ctx *pulumi.Context) error {
   121  // cfg := config.New(ctx, "")
   122  // sns := map[string]interface{}{
   123  // "account-id": "111111111111",
   124  // "displayName": "example",
   125  // "name": "example-sns-topic",
   126  // "region": "us-west-1",
   127  // "role-name": "service/service",
   128  // };
   129  // if param := cfg.GetObject("sns"); param != nil {
   130  // sns = param
   131  // }
   132  // sqs := map[string]interface{}{
   133  // "account-id": "222222222222",
   134  // "name": "example-sqs-queue",
   135  // "region": "us-east-1",
   136  // "role-name": "service/service",
   137  // };
   138  // if param := cfg.GetObject("sqs"); param != nil {
   139  // sqs = param
   140  // }
   141  // sns_topic_policy, err := iam.GetPolicyDocument(ctx, &iam.GetPolicyDocumentArgs{
   142  // PolicyId: pulumi.StringRef("__default_policy_ID"),
   143  // Statements: []iam.GetPolicyDocumentStatement{
   144  // {
   145  // Actions: []string{
   146  // "SNS:Subscribe",
   147  // "SNS:SetTopicAttributes",
   148  // "SNS:RemovePermission",
   149  // "SNS:Publish",
   150  // "SNS:ListSubscriptionsByTopic",
   151  // "SNS:GetTopicAttributes",
   152  // "SNS:DeleteTopic",
   153  // "SNS:AddPermission",
   154  // },
   155  // Conditions: []iam.GetPolicyDocumentStatementCondition{
   156  // {
   157  // Test: "StringEquals",
   158  // Variable: "AWS:SourceOwner",
   159  // Values: interface{}{
   160  // sns.AccountId,
   161  // },
   162  // },
   163  // },
   164  // Effect: pulumi.StringRef("Allow"),
   165  // Principals: []iam.GetPolicyDocumentStatementPrincipal{
   166  // {
   167  // Type: "AWS",
   168  // Identifiers: []string{
   169  // "*",
   170  // },
   171  // },
   172  // },
   173  // Resources: []string{
   174  // fmt.Sprintf("arn:aws:sns:%v:%v:%v", sns.Region, sns.AccountId, sns.Name),
   175  // },
   176  // Sid: pulumi.StringRef("__default_statement_ID"),
   177  // },
   178  // {
   179  // Actions: []string{
   180  // "SNS:Subscribe",
   181  // "SNS:Receive",
   182  // },
   183  // Conditions: []iam.GetPolicyDocumentStatementCondition{
   184  // {
   185  // Test: "StringLike",
   186  // Variable: "SNS:Endpoint",
   187  // Values: []string{
   188  // fmt.Sprintf("arn:aws:sqs:%v:%v:%v", sqs.Region, sqs.AccountId, sqs.Name),
   189  // },
   190  // },
   191  // },
   192  // Effect: pulumi.StringRef("Allow"),
   193  // Principals: []iam.GetPolicyDocumentStatementPrincipal{
   194  // {
   195  // Type: "AWS",
   196  // Identifiers: []string{
   197  // "*",
   198  // },
   199  // },
   200  // },
   201  // Resources: []string{
   202  // fmt.Sprintf("arn:aws:sns:%v:%v:%v", sns.Region, sns.AccountId, sns.Name),
   203  // },
   204  // Sid: pulumi.StringRef("__console_sub_0"),
   205  // },
   206  // },
   207  // }, nil);
   208  // if err != nil {
   209  // return err
   210  // }
   211  // sqs_queue_policy, err := iam.GetPolicyDocument(ctx, &iam.GetPolicyDocumentArgs{
   212  // PolicyId: pulumi.StringRef(fmt.Sprintf("arn:aws:sqs:%v:%v:%v/SQSDefaultPolicy", sqs.Region, sqs.AccountId, sqs.Name)),
   213  // Statements: []iam.GetPolicyDocumentStatement{
   214  // {
   215  // Sid: pulumi.StringRef("example-sns-topic"),
   216  // Effect: pulumi.StringRef("Allow"),
   217  // Principals: []iam.GetPolicyDocumentStatementPrincipal{
   218  // {
   219  // Type: "AWS",
   220  // Identifiers: []string{
   221  // "*",
   222  // },
   223  // },
   224  // },
   225  // Actions: []string{
   226  // "SQS:SendMessage",
   227  // },
   228  // Resources: []string{
   229  // fmt.Sprintf("arn:aws:sqs:%v:%v:%v", sqs.Region, sqs.AccountId, sqs.Name),
   230  // },
   231  // Conditions: []iam.GetPolicyDocumentStatementCondition{
   232  // {
   233  // Test: "ArnEquals",
   234  // Variable: "aws:SourceArn",
   235  // Values: []string{
   236  // fmt.Sprintf("arn:aws:sns:%v:%v:%v", sns.Region, sns.AccountId, sns.Name),
   237  // },
   238  // },
   239  // },
   240  // },
   241  // },
   242  // }, nil);
   243  // if err != nil {
   244  // return err
   245  // }
   246  // _, err = sns.NewTopic(ctx, "sns-topic", &sns.TopicArgs{
   247  // Name: pulumi.Any(sns.Name),
   248  // DisplayName: pulumi.Any(sns.Display_name),
   249  // Policy: pulumi.String(sns_topic_policy.Json),
   250  // })
   251  // if err != nil {
   252  // return err
   253  // }
   254  // _, err = sqs.NewQueue(ctx, "sqs-queue", &sqs.QueueArgs{
   255  // Name: pulumi.Any(sqs.Name),
   256  // Policy: pulumi.String(sqs_queue_policy.Json),
   257  // })
   258  // if err != nil {
   259  // return err
   260  // }
   261  // _, err = sns.NewTopicSubscription(ctx, "sns-topic", &sns.TopicSubscriptionArgs{
   262  // Topic: sns_topic.Arn,
   263  // Protocol: pulumi.String("sqs"),
   264  // Endpoint: sqs_queue.Arn,
   265  // })
   266  // if err != nil {
   267  // return err
   268  // }
   269  // return nil
   270  // })
   271  // }
   272  // ```
   273  // <!--End PulumiCodeChooser -->
   274  //
   275  // ## Import
   276  //
   277  // Using `pulumi import`, import SNS Topic Subscriptions using the subscription `arn`. For example:
   278  //
   279  // ```sh
   280  // $ pulumi import aws:sns/topicSubscription:TopicSubscription user_updates_sqs_target arn:aws:sns:us-west-2:0123456789012:my-topic:8a21d249-4329-4871-acc6-7be709c6ea7f
   281  // ```
   282  type TopicSubscription struct {
   283  	pulumi.CustomResourceState
   284  
   285  	// ARN of the subscription.
   286  	Arn pulumi.StringOutput `pulumi:"arn"`
   287  	// Integer indicating number of minutes to wait in retrying mode for fetching subscription arn before marking it as failure. Only applicable for http and https protocols. Default is `1`.
   288  	ConfirmationTimeoutInMinutes pulumi.IntPtrOutput `pulumi:"confirmationTimeoutInMinutes"`
   289  	// Whether the subscription confirmation request was authenticated.
   290  	ConfirmationWasAuthenticated pulumi.BoolOutput `pulumi:"confirmationWasAuthenticated"`
   291  	// JSON String with the delivery policy (retries, backoff, etc.) that will be used in the subscription - this only applies to HTTP/S subscriptions. Refer to the [SNS docs](https://docs.aws.amazon.com/sns/latest/dg/DeliveryPolicies.html) for more details.
   292  	DeliveryPolicy pulumi.StringPtrOutput `pulumi:"deliveryPolicy"`
   293  	// Endpoint to send data to. The contents vary with the protocol. See details below.
   294  	Endpoint pulumi.StringOutput `pulumi:"endpoint"`
   295  	// Whether the endpoint is capable of [auto confirming subscription](http://docs.aws.amazon.com/sns/latest/dg/SendMessageToHttp.html#SendMessageToHttp.prepare) (e.g., PagerDuty). Default is `false`.
   296  	EndpointAutoConfirms pulumi.BoolPtrOutput `pulumi:"endpointAutoConfirms"`
   297  	// JSON String with the filter policy that will be used in the subscription to filter messages seen by the target resource. Refer to the [SNS docs](https://docs.aws.amazon.com/sns/latest/dg/message-filtering.html) for more details.
   298  	FilterPolicy pulumi.StringPtrOutput `pulumi:"filterPolicy"`
   299  	// Whether the `filterPolicy` applies to `MessageAttributes` (default) or `MessageBody`.
   300  	FilterPolicyScope pulumi.StringOutput `pulumi:"filterPolicyScope"`
   301  	// AWS account ID of the subscription's owner.
   302  	OwnerId pulumi.StringOutput `pulumi:"ownerId"`
   303  	// Whether the subscription has not been confirmed.
   304  	PendingConfirmation pulumi.BoolOutput `pulumi:"pendingConfirmation"`
   305  	// Protocol to use. Valid values are: `sqs`, `sms`, `lambda`, `firehose`, and `application`. Protocols `email`, `email-json`, `http` and `https` are also valid but partially supported. See details below.
   306  	Protocol pulumi.StringOutput `pulumi:"protocol"`
   307  	// Whether to enable raw message delivery (the original message is directly passed, not wrapped in JSON with the original message in the message property). Default is `false`.
   308  	RawMessageDelivery pulumi.BoolPtrOutput `pulumi:"rawMessageDelivery"`
   309  	// JSON String with the redrive policy that will be used in the subscription. Refer to the [SNS docs](https://docs.aws.amazon.com/sns/latest/dg/sns-dead-letter-queues.html#how-messages-moved-into-dead-letter-queue) for more details.
   310  	RedrivePolicy pulumi.StringPtrOutput `pulumi:"redrivePolicy"`
   311  	// JSON String with the archived message replay policy that will be used in the subscription. Refer to the [SNS docs](https://docs.aws.amazon.com/sns/latest/dg/message-archiving-and-replay-subscriber.html) for more details.
   312  	ReplayPolicy pulumi.StringPtrOutput `pulumi:"replayPolicy"`
   313  	// ARN of the IAM role to publish to Kinesis Data Firehose delivery stream. Refer to [SNS docs](https://docs.aws.amazon.com/sns/latest/dg/sns-firehose-as-subscriber.html).
   314  	SubscriptionRoleArn pulumi.StringPtrOutput `pulumi:"subscriptionRoleArn"`
   315  	// ARN of the SNS topic to subscribe to.
   316  	//
   317  	// The following arguments are optional:
   318  	Topic pulumi.StringOutput `pulumi:"topic"`
   319  }
   320  
   321  // NewTopicSubscription registers a new resource with the given unique name, arguments, and options.
   322  func NewTopicSubscription(ctx *pulumi.Context,
   323  	name string, args *TopicSubscriptionArgs, opts ...pulumi.ResourceOption) (*TopicSubscription, error) {
   324  	if args == nil {
   325  		return nil, errors.New("missing one or more required arguments")
   326  	}
   327  
   328  	if args.Endpoint == nil {
   329  		return nil, errors.New("invalid value for required argument 'Endpoint'")
   330  	}
   331  	if args.Protocol == nil {
   332  		return nil, errors.New("invalid value for required argument 'Protocol'")
   333  	}
   334  	if args.Topic == nil {
   335  		return nil, errors.New("invalid value for required argument 'Topic'")
   336  	}
   337  	opts = internal.PkgResourceDefaultOpts(opts)
   338  	var resource TopicSubscription
   339  	err := ctx.RegisterResource("aws:sns/topicSubscription:TopicSubscription", name, args, &resource, opts...)
   340  	if err != nil {
   341  		return nil, err
   342  	}
   343  	return &resource, nil
   344  }
   345  
   346  // GetTopicSubscription gets an existing TopicSubscription resource's state with the given name, ID, and optional
   347  // state properties that are used to uniquely qualify the lookup (nil if not required).
   348  func GetTopicSubscription(ctx *pulumi.Context,
   349  	name string, id pulumi.IDInput, state *TopicSubscriptionState, opts ...pulumi.ResourceOption) (*TopicSubscription, error) {
   350  	var resource TopicSubscription
   351  	err := ctx.ReadResource("aws:sns/topicSubscription:TopicSubscription", name, id, state, &resource, opts...)
   352  	if err != nil {
   353  		return nil, err
   354  	}
   355  	return &resource, nil
   356  }
   357  
   358  // Input properties used for looking up and filtering TopicSubscription resources.
   359  type topicSubscriptionState struct {
   360  	// ARN of the subscription.
   361  	Arn *string `pulumi:"arn"`
   362  	// Integer indicating number of minutes to wait in retrying mode for fetching subscription arn before marking it as failure. Only applicable for http and https protocols. Default is `1`.
   363  	ConfirmationTimeoutInMinutes *int `pulumi:"confirmationTimeoutInMinutes"`
   364  	// Whether the subscription confirmation request was authenticated.
   365  	ConfirmationWasAuthenticated *bool `pulumi:"confirmationWasAuthenticated"`
   366  	// JSON String with the delivery policy (retries, backoff, etc.) that will be used in the subscription - this only applies to HTTP/S subscriptions. Refer to the [SNS docs](https://docs.aws.amazon.com/sns/latest/dg/DeliveryPolicies.html) for more details.
   367  	DeliveryPolicy *string `pulumi:"deliveryPolicy"`
   368  	// Endpoint to send data to. The contents vary with the protocol. See details below.
   369  	Endpoint *string `pulumi:"endpoint"`
   370  	// Whether the endpoint is capable of [auto confirming subscription](http://docs.aws.amazon.com/sns/latest/dg/SendMessageToHttp.html#SendMessageToHttp.prepare) (e.g., PagerDuty). Default is `false`.
   371  	EndpointAutoConfirms *bool `pulumi:"endpointAutoConfirms"`
   372  	// JSON String with the filter policy that will be used in the subscription to filter messages seen by the target resource. Refer to the [SNS docs](https://docs.aws.amazon.com/sns/latest/dg/message-filtering.html) for more details.
   373  	FilterPolicy *string `pulumi:"filterPolicy"`
   374  	// Whether the `filterPolicy` applies to `MessageAttributes` (default) or `MessageBody`.
   375  	FilterPolicyScope *string `pulumi:"filterPolicyScope"`
   376  	// AWS account ID of the subscription's owner.
   377  	OwnerId *string `pulumi:"ownerId"`
   378  	// Whether the subscription has not been confirmed.
   379  	PendingConfirmation *bool `pulumi:"pendingConfirmation"`
   380  	// Protocol to use. Valid values are: `sqs`, `sms`, `lambda`, `firehose`, and `application`. Protocols `email`, `email-json`, `http` and `https` are also valid but partially supported. See details below.
   381  	Protocol *string `pulumi:"protocol"`
   382  	// Whether to enable raw message delivery (the original message is directly passed, not wrapped in JSON with the original message in the message property). Default is `false`.
   383  	RawMessageDelivery *bool `pulumi:"rawMessageDelivery"`
   384  	// JSON String with the redrive policy that will be used in the subscription. Refer to the [SNS docs](https://docs.aws.amazon.com/sns/latest/dg/sns-dead-letter-queues.html#how-messages-moved-into-dead-letter-queue) for more details.
   385  	RedrivePolicy *string `pulumi:"redrivePolicy"`
   386  	// JSON String with the archived message replay policy that will be used in the subscription. Refer to the [SNS docs](https://docs.aws.amazon.com/sns/latest/dg/message-archiving-and-replay-subscriber.html) for more details.
   387  	ReplayPolicy *string `pulumi:"replayPolicy"`
   388  	// ARN of the IAM role to publish to Kinesis Data Firehose delivery stream. Refer to [SNS docs](https://docs.aws.amazon.com/sns/latest/dg/sns-firehose-as-subscriber.html).
   389  	SubscriptionRoleArn *string `pulumi:"subscriptionRoleArn"`
   390  	// ARN of the SNS topic to subscribe to.
   391  	//
   392  	// The following arguments are optional:
   393  	Topic interface{} `pulumi:"topic"`
   394  }
   395  
   396  type TopicSubscriptionState struct {
   397  	// ARN of the subscription.
   398  	Arn pulumi.StringPtrInput
   399  	// Integer indicating number of minutes to wait in retrying mode for fetching subscription arn before marking it as failure. Only applicable for http and https protocols. Default is `1`.
   400  	ConfirmationTimeoutInMinutes pulumi.IntPtrInput
   401  	// Whether the subscription confirmation request was authenticated.
   402  	ConfirmationWasAuthenticated pulumi.BoolPtrInput
   403  	// JSON String with the delivery policy (retries, backoff, etc.) that will be used in the subscription - this only applies to HTTP/S subscriptions. Refer to the [SNS docs](https://docs.aws.amazon.com/sns/latest/dg/DeliveryPolicies.html) for more details.
   404  	DeliveryPolicy pulumi.StringPtrInput
   405  	// Endpoint to send data to. The contents vary with the protocol. See details below.
   406  	Endpoint pulumi.StringPtrInput
   407  	// Whether the endpoint is capable of [auto confirming subscription](http://docs.aws.amazon.com/sns/latest/dg/SendMessageToHttp.html#SendMessageToHttp.prepare) (e.g., PagerDuty). Default is `false`.
   408  	EndpointAutoConfirms pulumi.BoolPtrInput
   409  	// JSON String with the filter policy that will be used in the subscription to filter messages seen by the target resource. Refer to the [SNS docs](https://docs.aws.amazon.com/sns/latest/dg/message-filtering.html) for more details.
   410  	FilterPolicy pulumi.StringPtrInput
   411  	// Whether the `filterPolicy` applies to `MessageAttributes` (default) or `MessageBody`.
   412  	FilterPolicyScope pulumi.StringPtrInput
   413  	// AWS account ID of the subscription's owner.
   414  	OwnerId pulumi.StringPtrInput
   415  	// Whether the subscription has not been confirmed.
   416  	PendingConfirmation pulumi.BoolPtrInput
   417  	// Protocol to use. Valid values are: `sqs`, `sms`, `lambda`, `firehose`, and `application`. Protocols `email`, `email-json`, `http` and `https` are also valid but partially supported. See details below.
   418  	Protocol pulumi.StringPtrInput
   419  	// Whether to enable raw message delivery (the original message is directly passed, not wrapped in JSON with the original message in the message property). Default is `false`.
   420  	RawMessageDelivery pulumi.BoolPtrInput
   421  	// JSON String with the redrive policy that will be used in the subscription. Refer to the [SNS docs](https://docs.aws.amazon.com/sns/latest/dg/sns-dead-letter-queues.html#how-messages-moved-into-dead-letter-queue) for more details.
   422  	RedrivePolicy pulumi.StringPtrInput
   423  	// JSON String with the archived message replay policy that will be used in the subscription. Refer to the [SNS docs](https://docs.aws.amazon.com/sns/latest/dg/message-archiving-and-replay-subscriber.html) for more details.
   424  	ReplayPolicy pulumi.StringPtrInput
   425  	// ARN of the IAM role to publish to Kinesis Data Firehose delivery stream. Refer to [SNS docs](https://docs.aws.amazon.com/sns/latest/dg/sns-firehose-as-subscriber.html).
   426  	SubscriptionRoleArn pulumi.StringPtrInput
   427  	// ARN of the SNS topic to subscribe to.
   428  	//
   429  	// The following arguments are optional:
   430  	Topic pulumi.Input
   431  }
   432  
   433  func (TopicSubscriptionState) ElementType() reflect.Type {
   434  	return reflect.TypeOf((*topicSubscriptionState)(nil)).Elem()
   435  }
   436  
   437  type topicSubscriptionArgs struct {
   438  	// Integer indicating number of minutes to wait in retrying mode for fetching subscription arn before marking it as failure. Only applicable for http and https protocols. Default is `1`.
   439  	ConfirmationTimeoutInMinutes *int `pulumi:"confirmationTimeoutInMinutes"`
   440  	// JSON String with the delivery policy (retries, backoff, etc.) that will be used in the subscription - this only applies to HTTP/S subscriptions. Refer to the [SNS docs](https://docs.aws.amazon.com/sns/latest/dg/DeliveryPolicies.html) for more details.
   441  	DeliveryPolicy *string `pulumi:"deliveryPolicy"`
   442  	// Endpoint to send data to. The contents vary with the protocol. See details below.
   443  	Endpoint string `pulumi:"endpoint"`
   444  	// Whether the endpoint is capable of [auto confirming subscription](http://docs.aws.amazon.com/sns/latest/dg/SendMessageToHttp.html#SendMessageToHttp.prepare) (e.g., PagerDuty). Default is `false`.
   445  	EndpointAutoConfirms *bool `pulumi:"endpointAutoConfirms"`
   446  	// JSON String with the filter policy that will be used in the subscription to filter messages seen by the target resource. Refer to the [SNS docs](https://docs.aws.amazon.com/sns/latest/dg/message-filtering.html) for more details.
   447  	FilterPolicy *string `pulumi:"filterPolicy"`
   448  	// Whether the `filterPolicy` applies to `MessageAttributes` (default) or `MessageBody`.
   449  	FilterPolicyScope *string `pulumi:"filterPolicyScope"`
   450  	// Protocol to use. Valid values are: `sqs`, `sms`, `lambda`, `firehose`, and `application`. Protocols `email`, `email-json`, `http` and `https` are also valid but partially supported. See details below.
   451  	Protocol string `pulumi:"protocol"`
   452  	// Whether to enable raw message delivery (the original message is directly passed, not wrapped in JSON with the original message in the message property). Default is `false`.
   453  	RawMessageDelivery *bool `pulumi:"rawMessageDelivery"`
   454  	// JSON String with the redrive policy that will be used in the subscription. Refer to the [SNS docs](https://docs.aws.amazon.com/sns/latest/dg/sns-dead-letter-queues.html#how-messages-moved-into-dead-letter-queue) for more details.
   455  	RedrivePolicy *string `pulumi:"redrivePolicy"`
   456  	// JSON String with the archived message replay policy that will be used in the subscription. Refer to the [SNS docs](https://docs.aws.amazon.com/sns/latest/dg/message-archiving-and-replay-subscriber.html) for more details.
   457  	ReplayPolicy *string `pulumi:"replayPolicy"`
   458  	// ARN of the IAM role to publish to Kinesis Data Firehose delivery stream. Refer to [SNS docs](https://docs.aws.amazon.com/sns/latest/dg/sns-firehose-as-subscriber.html).
   459  	SubscriptionRoleArn *string `pulumi:"subscriptionRoleArn"`
   460  	// ARN of the SNS topic to subscribe to.
   461  	//
   462  	// The following arguments are optional:
   463  	Topic interface{} `pulumi:"topic"`
   464  }
   465  
   466  // The set of arguments for constructing a TopicSubscription resource.
   467  type TopicSubscriptionArgs struct {
   468  	// Integer indicating number of minutes to wait in retrying mode for fetching subscription arn before marking it as failure. Only applicable for http and https protocols. Default is `1`.
   469  	ConfirmationTimeoutInMinutes pulumi.IntPtrInput
   470  	// JSON String with the delivery policy (retries, backoff, etc.) that will be used in the subscription - this only applies to HTTP/S subscriptions. Refer to the [SNS docs](https://docs.aws.amazon.com/sns/latest/dg/DeliveryPolicies.html) for more details.
   471  	DeliveryPolicy pulumi.StringPtrInput
   472  	// Endpoint to send data to. The contents vary with the protocol. See details below.
   473  	Endpoint pulumi.StringInput
   474  	// Whether the endpoint is capable of [auto confirming subscription](http://docs.aws.amazon.com/sns/latest/dg/SendMessageToHttp.html#SendMessageToHttp.prepare) (e.g., PagerDuty). Default is `false`.
   475  	EndpointAutoConfirms pulumi.BoolPtrInput
   476  	// JSON String with the filter policy that will be used in the subscription to filter messages seen by the target resource. Refer to the [SNS docs](https://docs.aws.amazon.com/sns/latest/dg/message-filtering.html) for more details.
   477  	FilterPolicy pulumi.StringPtrInput
   478  	// Whether the `filterPolicy` applies to `MessageAttributes` (default) or `MessageBody`.
   479  	FilterPolicyScope pulumi.StringPtrInput
   480  	// Protocol to use. Valid values are: `sqs`, `sms`, `lambda`, `firehose`, and `application`. Protocols `email`, `email-json`, `http` and `https` are also valid but partially supported. See details below.
   481  	Protocol pulumi.StringInput
   482  	// Whether to enable raw message delivery (the original message is directly passed, not wrapped in JSON with the original message in the message property). Default is `false`.
   483  	RawMessageDelivery pulumi.BoolPtrInput
   484  	// JSON String with the redrive policy that will be used in the subscription. Refer to the [SNS docs](https://docs.aws.amazon.com/sns/latest/dg/sns-dead-letter-queues.html#how-messages-moved-into-dead-letter-queue) for more details.
   485  	RedrivePolicy pulumi.StringPtrInput
   486  	// JSON String with the archived message replay policy that will be used in the subscription. Refer to the [SNS docs](https://docs.aws.amazon.com/sns/latest/dg/message-archiving-and-replay-subscriber.html) for more details.
   487  	ReplayPolicy pulumi.StringPtrInput
   488  	// ARN of the IAM role to publish to Kinesis Data Firehose delivery stream. Refer to [SNS docs](https://docs.aws.amazon.com/sns/latest/dg/sns-firehose-as-subscriber.html).
   489  	SubscriptionRoleArn pulumi.StringPtrInput
   490  	// ARN of the SNS topic to subscribe to.
   491  	//
   492  	// The following arguments are optional:
   493  	Topic pulumi.Input
   494  }
   495  
   496  func (TopicSubscriptionArgs) ElementType() reflect.Type {
   497  	return reflect.TypeOf((*topicSubscriptionArgs)(nil)).Elem()
   498  }
   499  
   500  type TopicSubscriptionInput interface {
   501  	pulumi.Input
   502  
   503  	ToTopicSubscriptionOutput() TopicSubscriptionOutput
   504  	ToTopicSubscriptionOutputWithContext(ctx context.Context) TopicSubscriptionOutput
   505  }
   506  
   507  func (*TopicSubscription) ElementType() reflect.Type {
   508  	return reflect.TypeOf((**TopicSubscription)(nil)).Elem()
   509  }
   510  
   511  func (i *TopicSubscription) ToTopicSubscriptionOutput() TopicSubscriptionOutput {
   512  	return i.ToTopicSubscriptionOutputWithContext(context.Background())
   513  }
   514  
   515  func (i *TopicSubscription) ToTopicSubscriptionOutputWithContext(ctx context.Context) TopicSubscriptionOutput {
   516  	return pulumi.ToOutputWithContext(ctx, i).(TopicSubscriptionOutput)
   517  }
   518  
   519  // TopicSubscriptionArrayInput is an input type that accepts TopicSubscriptionArray and TopicSubscriptionArrayOutput values.
   520  // You can construct a concrete instance of `TopicSubscriptionArrayInput` via:
   521  //
   522  //	TopicSubscriptionArray{ TopicSubscriptionArgs{...} }
   523  type TopicSubscriptionArrayInput interface {
   524  	pulumi.Input
   525  
   526  	ToTopicSubscriptionArrayOutput() TopicSubscriptionArrayOutput
   527  	ToTopicSubscriptionArrayOutputWithContext(context.Context) TopicSubscriptionArrayOutput
   528  }
   529  
   530  type TopicSubscriptionArray []TopicSubscriptionInput
   531  
   532  func (TopicSubscriptionArray) ElementType() reflect.Type {
   533  	return reflect.TypeOf((*[]*TopicSubscription)(nil)).Elem()
   534  }
   535  
   536  func (i TopicSubscriptionArray) ToTopicSubscriptionArrayOutput() TopicSubscriptionArrayOutput {
   537  	return i.ToTopicSubscriptionArrayOutputWithContext(context.Background())
   538  }
   539  
   540  func (i TopicSubscriptionArray) ToTopicSubscriptionArrayOutputWithContext(ctx context.Context) TopicSubscriptionArrayOutput {
   541  	return pulumi.ToOutputWithContext(ctx, i).(TopicSubscriptionArrayOutput)
   542  }
   543  
   544  // TopicSubscriptionMapInput is an input type that accepts TopicSubscriptionMap and TopicSubscriptionMapOutput values.
   545  // You can construct a concrete instance of `TopicSubscriptionMapInput` via:
   546  //
   547  //	TopicSubscriptionMap{ "key": TopicSubscriptionArgs{...} }
   548  type TopicSubscriptionMapInput interface {
   549  	pulumi.Input
   550  
   551  	ToTopicSubscriptionMapOutput() TopicSubscriptionMapOutput
   552  	ToTopicSubscriptionMapOutputWithContext(context.Context) TopicSubscriptionMapOutput
   553  }
   554  
   555  type TopicSubscriptionMap map[string]TopicSubscriptionInput
   556  
   557  func (TopicSubscriptionMap) ElementType() reflect.Type {
   558  	return reflect.TypeOf((*map[string]*TopicSubscription)(nil)).Elem()
   559  }
   560  
   561  func (i TopicSubscriptionMap) ToTopicSubscriptionMapOutput() TopicSubscriptionMapOutput {
   562  	return i.ToTopicSubscriptionMapOutputWithContext(context.Background())
   563  }
   564  
   565  func (i TopicSubscriptionMap) ToTopicSubscriptionMapOutputWithContext(ctx context.Context) TopicSubscriptionMapOutput {
   566  	return pulumi.ToOutputWithContext(ctx, i).(TopicSubscriptionMapOutput)
   567  }
   568  
   569  type TopicSubscriptionOutput struct{ *pulumi.OutputState }
   570  
   571  func (TopicSubscriptionOutput) ElementType() reflect.Type {
   572  	return reflect.TypeOf((**TopicSubscription)(nil)).Elem()
   573  }
   574  
   575  func (o TopicSubscriptionOutput) ToTopicSubscriptionOutput() TopicSubscriptionOutput {
   576  	return o
   577  }
   578  
   579  func (o TopicSubscriptionOutput) ToTopicSubscriptionOutputWithContext(ctx context.Context) TopicSubscriptionOutput {
   580  	return o
   581  }
   582  
   583  // ARN of the subscription.
   584  func (o TopicSubscriptionOutput) Arn() pulumi.StringOutput {
   585  	return o.ApplyT(func(v *TopicSubscription) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)
   586  }
   587  
   588  // Integer indicating number of minutes to wait in retrying mode for fetching subscription arn before marking it as failure. Only applicable for http and https protocols. Default is `1`.
   589  func (o TopicSubscriptionOutput) ConfirmationTimeoutInMinutes() pulumi.IntPtrOutput {
   590  	return o.ApplyT(func(v *TopicSubscription) pulumi.IntPtrOutput { return v.ConfirmationTimeoutInMinutes }).(pulumi.IntPtrOutput)
   591  }
   592  
   593  // Whether the subscription confirmation request was authenticated.
   594  func (o TopicSubscriptionOutput) ConfirmationWasAuthenticated() pulumi.BoolOutput {
   595  	return o.ApplyT(func(v *TopicSubscription) pulumi.BoolOutput { return v.ConfirmationWasAuthenticated }).(pulumi.BoolOutput)
   596  }
   597  
   598  // JSON String with the delivery policy (retries, backoff, etc.) that will be used in the subscription - this only applies to HTTP/S subscriptions. Refer to the [SNS docs](https://docs.aws.amazon.com/sns/latest/dg/DeliveryPolicies.html) for more details.
   599  func (o TopicSubscriptionOutput) DeliveryPolicy() pulumi.StringPtrOutput {
   600  	return o.ApplyT(func(v *TopicSubscription) pulumi.StringPtrOutput { return v.DeliveryPolicy }).(pulumi.StringPtrOutput)
   601  }
   602  
   603  // Endpoint to send data to. The contents vary with the protocol. See details below.
   604  func (o TopicSubscriptionOutput) Endpoint() pulumi.StringOutput {
   605  	return o.ApplyT(func(v *TopicSubscription) pulumi.StringOutput { return v.Endpoint }).(pulumi.StringOutput)
   606  }
   607  
   608  // Whether the endpoint is capable of [auto confirming subscription](http://docs.aws.amazon.com/sns/latest/dg/SendMessageToHttp.html#SendMessageToHttp.prepare) (e.g., PagerDuty). Default is `false`.
   609  func (o TopicSubscriptionOutput) EndpointAutoConfirms() pulumi.BoolPtrOutput {
   610  	return o.ApplyT(func(v *TopicSubscription) pulumi.BoolPtrOutput { return v.EndpointAutoConfirms }).(pulumi.BoolPtrOutput)
   611  }
   612  
   613  // JSON String with the filter policy that will be used in the subscription to filter messages seen by the target resource. Refer to the [SNS docs](https://docs.aws.amazon.com/sns/latest/dg/message-filtering.html) for more details.
   614  func (o TopicSubscriptionOutput) FilterPolicy() pulumi.StringPtrOutput {
   615  	return o.ApplyT(func(v *TopicSubscription) pulumi.StringPtrOutput { return v.FilterPolicy }).(pulumi.StringPtrOutput)
   616  }
   617  
   618  // Whether the `filterPolicy` applies to `MessageAttributes` (default) or `MessageBody`.
   619  func (o TopicSubscriptionOutput) FilterPolicyScope() pulumi.StringOutput {
   620  	return o.ApplyT(func(v *TopicSubscription) pulumi.StringOutput { return v.FilterPolicyScope }).(pulumi.StringOutput)
   621  }
   622  
   623  // AWS account ID of the subscription's owner.
   624  func (o TopicSubscriptionOutput) OwnerId() pulumi.StringOutput {
   625  	return o.ApplyT(func(v *TopicSubscription) pulumi.StringOutput { return v.OwnerId }).(pulumi.StringOutput)
   626  }
   627  
   628  // Whether the subscription has not been confirmed.
   629  func (o TopicSubscriptionOutput) PendingConfirmation() pulumi.BoolOutput {
   630  	return o.ApplyT(func(v *TopicSubscription) pulumi.BoolOutput { return v.PendingConfirmation }).(pulumi.BoolOutput)
   631  }
   632  
   633  // Protocol to use. Valid values are: `sqs`, `sms`, `lambda`, `firehose`, and `application`. Protocols `email`, `email-json`, `http` and `https` are also valid but partially supported. See details below.
   634  func (o TopicSubscriptionOutput) Protocol() pulumi.StringOutput {
   635  	return o.ApplyT(func(v *TopicSubscription) pulumi.StringOutput { return v.Protocol }).(pulumi.StringOutput)
   636  }
   637  
   638  // Whether to enable raw message delivery (the original message is directly passed, not wrapped in JSON with the original message in the message property). Default is `false`.
   639  func (o TopicSubscriptionOutput) RawMessageDelivery() pulumi.BoolPtrOutput {
   640  	return o.ApplyT(func(v *TopicSubscription) pulumi.BoolPtrOutput { return v.RawMessageDelivery }).(pulumi.BoolPtrOutput)
   641  }
   642  
   643  // JSON String with the redrive policy that will be used in the subscription. Refer to the [SNS docs](https://docs.aws.amazon.com/sns/latest/dg/sns-dead-letter-queues.html#how-messages-moved-into-dead-letter-queue) for more details.
   644  func (o TopicSubscriptionOutput) RedrivePolicy() pulumi.StringPtrOutput {
   645  	return o.ApplyT(func(v *TopicSubscription) pulumi.StringPtrOutput { return v.RedrivePolicy }).(pulumi.StringPtrOutput)
   646  }
   647  
   648  // JSON String with the archived message replay policy that will be used in the subscription. Refer to the [SNS docs](https://docs.aws.amazon.com/sns/latest/dg/message-archiving-and-replay-subscriber.html) for more details.
   649  func (o TopicSubscriptionOutput) ReplayPolicy() pulumi.StringPtrOutput {
   650  	return o.ApplyT(func(v *TopicSubscription) pulumi.StringPtrOutput { return v.ReplayPolicy }).(pulumi.StringPtrOutput)
   651  }
   652  
   653  // ARN of the IAM role to publish to Kinesis Data Firehose delivery stream. Refer to [SNS docs](https://docs.aws.amazon.com/sns/latest/dg/sns-firehose-as-subscriber.html).
   654  func (o TopicSubscriptionOutput) SubscriptionRoleArn() pulumi.StringPtrOutput {
   655  	return o.ApplyT(func(v *TopicSubscription) pulumi.StringPtrOutput { return v.SubscriptionRoleArn }).(pulumi.StringPtrOutput)
   656  }
   657  
   658  // ARN of the SNS topic to subscribe to.
   659  //
   660  // The following arguments are optional:
   661  func (o TopicSubscriptionOutput) Topic() pulumi.StringOutput {
   662  	return o.ApplyT(func(v *TopicSubscription) pulumi.StringOutput { return v.Topic }).(pulumi.StringOutput)
   663  }
   664  
   665  type TopicSubscriptionArrayOutput struct{ *pulumi.OutputState }
   666  
   667  func (TopicSubscriptionArrayOutput) ElementType() reflect.Type {
   668  	return reflect.TypeOf((*[]*TopicSubscription)(nil)).Elem()
   669  }
   670  
   671  func (o TopicSubscriptionArrayOutput) ToTopicSubscriptionArrayOutput() TopicSubscriptionArrayOutput {
   672  	return o
   673  }
   674  
   675  func (o TopicSubscriptionArrayOutput) ToTopicSubscriptionArrayOutputWithContext(ctx context.Context) TopicSubscriptionArrayOutput {
   676  	return o
   677  }
   678  
   679  func (o TopicSubscriptionArrayOutput) Index(i pulumi.IntInput) TopicSubscriptionOutput {
   680  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *TopicSubscription {
   681  		return vs[0].([]*TopicSubscription)[vs[1].(int)]
   682  	}).(TopicSubscriptionOutput)
   683  }
   684  
   685  type TopicSubscriptionMapOutput struct{ *pulumi.OutputState }
   686  
   687  func (TopicSubscriptionMapOutput) ElementType() reflect.Type {
   688  	return reflect.TypeOf((*map[string]*TopicSubscription)(nil)).Elem()
   689  }
   690  
   691  func (o TopicSubscriptionMapOutput) ToTopicSubscriptionMapOutput() TopicSubscriptionMapOutput {
   692  	return o
   693  }
   694  
   695  func (o TopicSubscriptionMapOutput) ToTopicSubscriptionMapOutputWithContext(ctx context.Context) TopicSubscriptionMapOutput {
   696  	return o
   697  }
   698  
   699  func (o TopicSubscriptionMapOutput) MapIndex(k pulumi.StringInput) TopicSubscriptionOutput {
   700  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *TopicSubscription {
   701  		return vs[0].(map[string]*TopicSubscription)[vs[1].(string)]
   702  	}).(TopicSubscriptionOutput)
   703  }
   704  
   705  func init() {
   706  	pulumi.RegisterInputType(reflect.TypeOf((*TopicSubscriptionInput)(nil)).Elem(), &TopicSubscription{})
   707  	pulumi.RegisterInputType(reflect.TypeOf((*TopicSubscriptionArrayInput)(nil)).Elem(), TopicSubscriptionArray{})
   708  	pulumi.RegisterInputType(reflect.TypeOf((*TopicSubscriptionMapInput)(nil)).Elem(), TopicSubscriptionMap{})
   709  	pulumi.RegisterOutputType(TopicSubscriptionOutput{})
   710  	pulumi.RegisterOutputType(TopicSubscriptionArrayOutput{})
   711  	pulumi.RegisterOutputType(TopicSubscriptionMapOutput{})
   712  }