Resource: aws_iot_policy

Provides an IoT policy.

Example Usage

resource "aws_iot_policy" "pubsub" {
  name = "PubSubToAnyTopic"

  # Terraform's "jsonencode" function converts a
  # Terraform expression result to valid JSON syntax.
  policy = jsonencode({
    Version = "2012-10-17"
    Statement = [
      {
        Action = [
          "iot:*",
        ]
        Effect   = "Allow"
        Resource = "*"
      },
    ]
  })
}

Argument Reference

This resource supports the following arguments:

Attribute Reference

This resource exports the following attributes in addition to the arguments above:

Timeouts

Configuration options:

Import

In Terraform v1.5.0 and later, use an import block to import IoT policies using the name. For example:

import {
  to = aws_iot_policy.pubsub
  id = "PubSubToAnyTopic"
}

Using terraform import, import IoT policies using the name. For example:

% terraform import aws_iot_policy.pubsub PubSubToAnyTopic