AWS IoT Thing Principal Attachment

This page shows how to write Terraform and CloudFormation for AWS IoT Thing Principal Attachment and write them securely.

aws_iot_thing_principal_attachment (Terraform)

The Thing Principal Attachment in AWS IoT can be configured in Terraform with the resource name aws_iot_thing_principal_attachment. The following sections describe 5 examples of how to use the resource and its parameters.

Example Usage from GitHub

certificate.tf#L5
resource "aws_iot_thing_principal_attachment" "subscriber_cert_attachment" {
  for_each  = aws_iot_thing.aws_subscriber_thing
  principal = aws_iot_certificate.things_cert.arn
  thing     = each.value.name
}

main.tf#L11
resource "aws_iot_thing_principal_attachment" "princ_attach" {
  principal = aws_iot_certificate.cert.arn
  thing     = aws_iot_thing.thing.name
}

resource "aws_iot_policy_attachment" "pol_attach" {
main.tf#L11
resource "aws_iot_thing_principal_attachment" "princ_attach" {
  principal = aws_iot_certificate.cert.arn
  thing     = aws_iot_thing.thing.name
}

resource "aws_iot_policy_attachment" "pol_attach" {
main.tf#L36
resource "aws_iot_thing_principal_attachment" "this" {
  for_each = aws_iot_thing.this

  principal = aws_iot_certificate.this.arn
  thing     = each.value.name
}
thing.tf#L21
resource "aws_iot_thing_principal_attachment" "something_pubsuball" {
  principal = module.aws_iot_own_device_certificate.arn
  thing     = aws_iot_thing.something.name
}

Parameters

Explanation in Terraform Registry

Attaches Principal to AWS IoT Thing.

AWS::IoT::ThingPrincipalAttachment (CloudFormation)

The ThingPrincipalAttachment in IoT can be configured in CloudFormation with the resource name AWS::IoT::ThingPrincipalAttachment. The following sections describe how to use the resource and its parameters.

Example Usage from GitHub

An example could not be found in GitHub.

Parameters

Explanation in CloudFormation Registry

Use the AWS::IoT::ThingPrincipalAttachment resource to attach a principal (an X.

509 certificate or another credential) to a thing.

For more information about working with AWS IoT things and principals, see Authorization in the AWS IoT Developer Guide.

Frequently asked questions

What is AWS IoT Thing Principal Attachment?

AWS IoT Thing Principal Attachment is a resource for IoT of Amazon Web Service. Settings can be wrote in Terraform and CloudFormation.

Where can I find the example code for the AWS IoT Thing Principal Attachment?

For Terraform, the moraesjeremias/terraform-aws-iot-core, j0rzsh/aws-iot-meetup and j0rzsh/aws-iot-tfg source code examples are useful. See the Terraform Example section for further details.