@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
136 lines (135 loc) • 4.98 kB
TypeScript
import * as pulumi from "@pulumi/pulumi";
import * as inputs from "../types/input";
/**
* Provides an SNS topic policy resource
*
* > **NOTE:** If a Principal is specified as just an AWS account ID rather than an ARN, AWS silently converts it to the ARN for the root user, causing future deployments to differ. To avoid this problem, just specify the full ARN, e.g. `arn:aws:iam::123456789012:root`
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const test = new aws.sns.Topic("test", {name: "my-topic-with-policy"});
* const snsTopicPolicy = test.arn.apply(arn => aws.iam.getPolicyDocumentOutput({
* policyId: "__default_policy_ID",
* statements: [{
* actions: [
* "SNS:Subscribe",
* "SNS:SetTopicAttributes",
* "SNS:RemovePermission",
* "SNS:Receive",
* "SNS:Publish",
* "SNS:ListSubscriptionsByTopic",
* "SNS:GetTopicAttributes",
* "SNS:DeleteTopic",
* "SNS:AddPermission",
* ],
* conditions: [{
* test: "StringEquals",
* variable: "AWS:SourceOwner",
* values: [account_id],
* }],
* effect: "Allow",
* principals: [{
* type: "AWS",
* identifiers: ["*"],
* }],
* resources: [arn],
* sid: "__default_statement_ID",
* }],
* }));
* const _default = new aws.sns.TopicPolicy("default", {
* arn: test.arn,
* policy: snsTopicPolicy.apply(snsTopicPolicy => snsTopicPolicy.json),
* });
* ```
*
* ## Import
*
* Using `pulumi import`, import SNS Topic Policy using the topic ARN. For example:
*
* ```sh
* $ pulumi import aws:sns/topicPolicy:TopicPolicy user_updates arn:aws:sns:us-west-2:123456789012:my-topic
* ```
*/
export declare class TopicPolicy extends pulumi.CustomResource {
/**
* Get an existing TopicPolicy resource's state with the given name, ID, and optional extra
* properties used to qualify the lookup.
*
* @param name The _unique_ name of the resulting resource.
* @param id The _unique_ provider ID of the resource to lookup.
* @param state Any extra arguments used during the lookup.
* @param opts Optional settings to control the behavior of the CustomResource.
*/
static get(name: string, id: pulumi.Input<pulumi.ID>, state?: TopicPolicyState, opts?: pulumi.CustomResourceOptions): TopicPolicy;
/**
* Returns true if the given object is an instance of TopicPolicy. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
static isInstance(obj: any): obj is TopicPolicy;
/**
* The ARN of the SNS topic
*/
readonly arn: pulumi.Output<string>;
/**
* The AWS Account ID of the SNS topic owner
*/
readonly owner: pulumi.Output<string>;
/**
* The fully-formed AWS policy as JSON.
*/
readonly policy: pulumi.Output<string>;
/**
* Region where this resource will be [managed](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints). Defaults to the Region set in the provider configuration.
*/
readonly region: pulumi.Output<string>;
/**
* Create a TopicPolicy resource with the given unique name, arguments, and options.
*
* @param name The _unique_ name of the resource.
* @param args The arguments to use to populate this resource's properties.
* @param opts A bag of options that control this resource's behavior.
*/
constructor(name: string, args: TopicPolicyArgs, opts?: pulumi.CustomResourceOptions);
}
/**
* Input properties used for looking up and filtering TopicPolicy resources.
*/
export interface TopicPolicyState {
/**
* The ARN of the SNS topic
*/
arn?: pulumi.Input<string>;
/**
* The AWS Account ID of the SNS topic owner
*/
owner?: pulumi.Input<string>;
/**
* The fully-formed AWS policy as JSON.
*/
policy?: pulumi.Input<string | inputs.sns.PolicyDocument>;
/**
* Region where this resource will be [managed](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints). Defaults to the Region set in the provider configuration.
*/
region?: pulumi.Input<string>;
}
/**
* The set of arguments for constructing a TopicPolicy resource.
*/
export interface TopicPolicyArgs {
/**
* The ARN of the SNS topic
*/
arn: pulumi.Input<string>;
/**
* The fully-formed AWS policy as JSON.
*/
policy: pulumi.Input<string | inputs.sns.PolicyDocument>;
/**
* Region where this resource will be [managed](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints). Defaults to the Region set in the provider configuration.
*/
region?: pulumi.Input<string>;
}