Skip to content

Resource: awsIotPolicy

Provides an IoT policy.

Example Usage

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
new aws.iotPolicy.IotPolicy(this, "pubsub", {
  name: "PubSubToAnyTopic",
  policy:
    '${jsonencode({\n    Version = "2012-10-17"\n    Statement = [\n      {\n        Action = [\n          "iot:*",\n        ]\n        Effect   = "Allow"\n        Resource = "*"\n      },\n    ]\n  })}',
});

Argument Reference

The following arguments are supported:

  • name - (Required) The name of the policy.
  • policy - (Required) The policy document. This is a JSON formatted string. Use the IoT Developer Guide for more information on IoT Policies. For more information about building AWS IAM policy documents with Terraform, see the AWS IAM Policy Document Guide.

Attributes Reference

In addition to all arguments above, the following attributes are exported:

  • arn - The ARN assigned by AWS to this policy.
  • name - The name of this policy.
  • defaultVersionId - The default version of this policy.
  • policy - The policy document.

Import

IoT policies can be imported using the name, e.g.,

$ terraform import aws_iot_policy.pubsub PubSubToAnyTopic