AWS Classic

Pulumi Official
Package maintained by Pulumi
v5.10.0 published on Monday, Jul 11, 2022 by Pulumi

ThingPrincipalAttachment

Attaches Principal to AWS IoT Thing.

Example Usage

using System.IO;
using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
    public MyStack()
    {
        var example = new Aws.Iot.Thing("example", new Aws.Iot.ThingArgs
        {
        });
        var cert = new Aws.Iot.Certificate("cert", new Aws.Iot.CertificateArgs
        {
            Csr = File.ReadAllText("csr.pem"),
            Active = true,
        });
        var att = new Aws.Iot.ThingPrincipalAttachment("att", new Aws.Iot.ThingPrincipalAttachmentArgs
        {
            Principal = cert.Arn,
            Thing = example.Name,
        });
    }

}
package main

import (
	"io/ioutil"

	"github.com/pulumi/pulumi-aws/sdk/v5/go/aws"
	"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/iot"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func readFileOrPanic(path string) pulumi.StringPtrInput {
	data, err := ioutil.ReadFile(path)
	if err != nil {
		panic(err.Error())
	}
	return pulumi.String(string(data))
}

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		example, err := iot.NewThing(ctx, "example", nil)
		if err != nil {
			return err
		}
		cert, err := iot.NewCertificate(ctx, "cert", &iot.CertificateArgs{
			Csr:    readFileOrPanic("csr.pem"),
			Active: pulumi.Bool(true),
		})
		if err != nil {
			return err
		}
		_, err = iot.NewThingPrincipalAttachment(ctx, "att", &iot.ThingPrincipalAttachmentArgs{
			Principal: cert.Arn,
			Thing:     example.Name,
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import java.util.*;
import java.io.*;
import java.nio.*;
import com.pulumi.*;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var example = new Thing("example");

        var cert = new Certificate("cert", CertificateArgs.builder()        
            .csr(Files.readString("csr.pem"))
            .active(true)
            .build());

        var att = new ThingPrincipalAttachment("att", ThingPrincipalAttachmentArgs.builder()        
            .principal(cert.arn())
            .thing(example.name())
            .build());

    }
}
import pulumi
import pulumi_aws as aws

example = aws.iot.Thing("example")
cert = aws.iot.Certificate("cert",
    csr=(lambda path: open(path).read())("csr.pem"),
    active=True)
att = aws.iot.ThingPrincipalAttachment("att",
    principal=cert.arn,
    thing=example.name)
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
import * from "fs";

const example = new aws.iot.Thing("example", {});
const cert = new aws.iot.Certificate("cert", {
    csr: fs.readFileSync("csr.pem"),
    active: true,
});
const att = new aws.iot.ThingPrincipalAttachment("att", {
    principal: cert.arn,
    thing: example.name,
});

Coming soon!

Create a ThingPrincipalAttachment Resource

new ThingPrincipalAttachment(name: string, args: ThingPrincipalAttachmentArgs, opts?: CustomResourceOptions);
@overload
def ThingPrincipalAttachment(resource_name: str,
                             opts: Optional[ResourceOptions] = None,
                             principal: Optional[str] = None,
                             thing: Optional[str] = None)
@overload
def ThingPrincipalAttachment(resource_name: str,
                             args: ThingPrincipalAttachmentArgs,
                             opts: Optional[ResourceOptions] = None)
func NewThingPrincipalAttachment(ctx *Context, name string, args ThingPrincipalAttachmentArgs, opts ...ResourceOption) (*ThingPrincipalAttachment, error)
public ThingPrincipalAttachment(string name, ThingPrincipalAttachmentArgs args, CustomResourceOptions? opts = null)
public ThingPrincipalAttachment(String name, ThingPrincipalAttachmentArgs args)
public ThingPrincipalAttachment(String name, ThingPrincipalAttachmentArgs args, CustomResourceOptions options)
type: aws:iot:ThingPrincipalAttachment
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args ThingPrincipalAttachmentArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
args ThingPrincipalAttachmentArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args ThingPrincipalAttachmentArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args ThingPrincipalAttachmentArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args ThingPrincipalAttachmentArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

ThingPrincipalAttachment Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

The ThingPrincipalAttachment resource accepts the following input properties:

Principal string

The AWS IoT Certificate ARN or Amazon Cognito Identity ID.

Thing string

The name of the thing.

Principal string

The AWS IoT Certificate ARN or Amazon Cognito Identity ID.

Thing string

The name of the thing.

principal String

The AWS IoT Certificate ARN or Amazon Cognito Identity ID.

thing String

The name of the thing.

principal ARN

The AWS IoT Certificate ARN or Amazon Cognito Identity ID.

thing string

The name of the thing.

principal str

The AWS IoT Certificate ARN or Amazon Cognito Identity ID.

thing str

The name of the thing.

principal

The AWS IoT Certificate ARN or Amazon Cognito Identity ID.

thing String

The name of the thing.

Outputs

All input properties are implicitly available as output properties. Additionally, the ThingPrincipalAttachment resource produces the following output properties:

Id string

The provider-assigned unique ID for this managed resource.

Id string

The provider-assigned unique ID for this managed resource.

id String

The provider-assigned unique ID for this managed resource.

id string

The provider-assigned unique ID for this managed resource.

id str

The provider-assigned unique ID for this managed resource.

id String

The provider-assigned unique ID for this managed resource.

Look up an Existing ThingPrincipalAttachment Resource

Get an existing ThingPrincipalAttachment resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: ThingPrincipalAttachmentState, opts?: CustomResourceOptions): ThingPrincipalAttachment
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        principal: Optional[str] = None,
        thing: Optional[str] = None) -> ThingPrincipalAttachment
func GetThingPrincipalAttachment(ctx *Context, name string, id IDInput, state *ThingPrincipalAttachmentState, opts ...ResourceOption) (*ThingPrincipalAttachment, error)
public static ThingPrincipalAttachment Get(string name, Input<string> id, ThingPrincipalAttachmentState? state, CustomResourceOptions? opts = null)
public static ThingPrincipalAttachment get(String name, Output<String> id, ThingPrincipalAttachmentState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
Principal string

The AWS IoT Certificate ARN or Amazon Cognito Identity ID.

Thing string

The name of the thing.

Principal string

The AWS IoT Certificate ARN or Amazon Cognito Identity ID.

Thing string

The name of the thing.

principal String

The AWS IoT Certificate ARN or Amazon Cognito Identity ID.

thing String

The name of the thing.

principal ARN

The AWS IoT Certificate ARN or Amazon Cognito Identity ID.

thing string

The name of the thing.

principal str

The AWS IoT Certificate ARN or Amazon Cognito Identity ID.

thing str

The name of the thing.

principal

The AWS IoT Certificate ARN or Amazon Cognito Identity ID.

thing String

The name of the thing.

Package Details

Repository
https://github.com/pulumi/pulumi-aws
License
Apache-2.0
Notes

This Pulumi package is based on the aws Terraform Provider.