TopicRule

class TopicRule : KotlinCustomResource

Example Usage

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.iam.IamFunctions;
import com.pulumi.aws.iam.inputs.GetPolicyDocumentArgs;
import com.pulumi.aws.iam.Role;
import com.pulumi.aws.iam.RoleArgs;
import com.pulumi.aws.iot.TopicRule;
import com.pulumi.aws.iot.TopicRuleArgs;
import com.pulumi.aws.iot.inputs.TopicRuleSnsArgs;
import com.pulumi.aws.iot.inputs.TopicRuleErrorActionArgs;
import com.pulumi.aws.iot.inputs.TopicRuleErrorActionSnsArgs;
import com.pulumi.aws.iam.RolePolicy;
import com.pulumi.aws.iam.RolePolicyArgs;
import java.util.List;
import java.util.ArrayList;
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 mytopic = new Topic("mytopic");
var myerrortopic = new Topic("myerrortopic");
final var assumeRole = IamFunctions.getPolicyDocument(GetPolicyDocumentArgs.builder()
.statements(GetPolicyDocumentStatementArgs.builder()
.effect("Allow")
.principals(GetPolicyDocumentStatementPrincipalArgs.builder()
.type("Service")
.identifiers("iot.amazonaws.com")
.build())
.actions("sts:AssumeRole")
.build())
.build());
var role = new Role("role", RoleArgs.builder()
.assumeRolePolicy(assumeRole.applyValue(getPolicyDocumentResult -> getPolicyDocumentResult.json()))
.build());
var rule = new TopicRule("rule", TopicRuleArgs.builder()
.description("Example rule")
.enabled(true)
.sql("SELECT * FROM 'topic/test'")
.sqlVersion("2016-03-23")
.sns(TopicRuleSnsArgs.builder()
.messageFormat("RAW")
.roleArn(role.arn())
.targetArn(mytopic.arn())
.build())
.errorAction(TopicRuleErrorActionArgs.builder()
.sns(TopicRuleErrorActionSnsArgs.builder()
.messageFormat("RAW")
.roleArn(role.arn())
.targetArn(myerrortopic.arn())
.build())
.build())
.build());
final var iamPolicyForLambdaPolicyDocument = IamFunctions.getPolicyDocument(GetPolicyDocumentArgs.builder()
.statements(GetPolicyDocumentStatementArgs.builder()
.effect("Allow")
.actions("sns:Publish")
.resources(mytopic.arn())
.build())
.build());
var iamPolicyForLambdaRolePolicy = new RolePolicy("iamPolicyForLambdaRolePolicy", RolePolicyArgs.builder()
.role(role.id())
.policy(iamPolicyForLambdaPolicyDocument.applyValue(getPolicyDocumentResult -> getPolicyDocumentResult).applyValue(iamPolicyForLambdaPolicyDocument -> iamPolicyForLambdaPolicyDocument.applyValue(getPolicyDocumentResult -> getPolicyDocumentResult.json())))
.build());
}
}

Import

Using pulumi import, import IoT Topic Rules using the name. For example:

$ pulumi import aws:iot/topicRule:TopicRule rule <name>

Properties

Link copied to clipboard
val arn: Output<String>

The ARN of the topic rule

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val description: Output<String>?

The description of the rule.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val enabled: Output<Boolean>

Specifies whether the rule is enabled.

Link copied to clipboard

Configuration block with error action to be associated with the rule. See the documentation for cloudwatch_alarm, cloudwatch_logs, cloudwatch_metric, dynamodb, dynamodbv2, elasticsearch, firehose, http, iot_analytics, iot_events, kafka, kinesis, lambda, republish, s3, sns, sqs, step_functions, timestream configuration blocks for further configuration details.

Link copied to clipboard
Link copied to clipboard
val https: Output<List<TopicRuleHttp>>?
Link copied to clipboard
val id: Output<String>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val kafkas: Output<List<TopicRuleKafka>>?
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val name: Output<String>

The name of the rule.

Link copied to clipboard
val pulumiChildResources: Set<KotlinResource>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val s3: Output<List<TopicRuleS3>>?
Link copied to clipboard
val sns: Output<List<TopicRuleSns>>?
Link copied to clipboard
val sql: Output<String>

The SQL statement used to query the topic. For more information, see AWS IoT SQL Reference (http://docs.aws.amazon.com/iot/latest/developerguide/iot-rules.html#aws-iot-sql-reference) in the AWS IoT Developer Guide.

Link copied to clipboard
val sqlVersion: Output<String>

The version of the SQL rules engine to use when evaluating the rule.

Link copied to clipboard
val sqs: Output<List<TopicRuleSqs>>?
Link copied to clipboard
Link copied to clipboard
val tags: Output<Map<String, String>>?

Key-value map of resource tags. If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

Link copied to clipboard
val tagsAll: Output<Map<String, String>>

A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Link copied to clipboard
Link copied to clipboard
val urn: Output<String>