1. Packages
  2. AWS Classic
  3. API Docs
  4. iot
  5. ThingPrincipalAttachment

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.42.0 published on Wednesday, Jun 26, 2024 by Pulumi

aws.iot.ThingPrincipalAttachment

Explore with Pulumi AI

aws logo

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.42.0 published on Wednesday, Jun 26, 2024 by Pulumi

    Attaches Principal to AWS IoT Thing.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    import * as std from "@pulumi/std";
    
    const example = new aws.iot.Thing("example", {name: "example"});
    const cert = new aws.iot.Certificate("cert", {
        csr: std.file({
            input: "csr.pem",
        }).then(invoke => invoke.result),
        active: true,
    });
    const att = new aws.iot.ThingPrincipalAttachment("att", {
        principal: cert.arn,
        thing: example.name,
    });
    
    import pulumi
    import pulumi_aws as aws
    import pulumi_std as std
    
    example = aws.iot.Thing("example", name="example")
    cert = aws.iot.Certificate("cert",
        csr=std.file(input="csr.pem").result,
        active=True)
    att = aws.iot.ThingPrincipalAttachment("att",
        principal=cert.arn,
        thing=example.name)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/iot"
    	"github.com/pulumi/pulumi-std/sdk/go/std"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		example, err := iot.NewThing(ctx, "example", &iot.ThingArgs{
    			Name: pulumi.String("example"),
    		})
    		if err != nil {
    			return err
    		}
    		invokeFile, err := std.File(ctx, &std.FileArgs{
    			Input: "csr.pem",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		cert, err := iot.NewCertificate(ctx, "cert", &iot.CertificateArgs{
    			Csr:    invokeFile.Result,
    			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
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    using Std = Pulumi.Std;
    
    return await Deployment.RunAsync(() => 
    {
        var example = new Aws.Iot.Thing("example", new()
        {
            Name = "example",
        });
    
        var cert = new Aws.Iot.Certificate("cert", new()
        {
            Csr = Std.File.Invoke(new()
            {
                Input = "csr.pem",
            }).Apply(invoke => invoke.Result),
            Active = true,
        });
    
        var att = new Aws.Iot.ThingPrincipalAttachment("att", new()
        {
            Principal = cert.Arn,
            Thing = example.Name,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.iot.Thing;
    import com.pulumi.aws.iot.ThingArgs;
    import com.pulumi.aws.iot.Certificate;
    import com.pulumi.aws.iot.CertificateArgs;
    import com.pulumi.aws.iot.ThingPrincipalAttachment;
    import com.pulumi.aws.iot.ThingPrincipalAttachmentArgs;
    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 example = new Thing("example", ThingArgs.builder()
                .name("example")
                .build());
    
            var cert = new Certificate("cert", CertificateArgs.builder()
                .csr(StdFunctions.file(FileArgs.builder()
                    .input("csr.pem")
                    .build()).result())
                .active(true)
                .build());
    
            var att = new ThingPrincipalAttachment("att", ThingPrincipalAttachmentArgs.builder()
                .principal(cert.arn())
                .thing(example.name())
                .build());
    
        }
    }
    
    resources:
      example:
        type: aws:iot:Thing
        properties:
          name: example
      cert:
        type: aws:iot:Certificate
        properties:
          csr:
            fn::invoke:
              Function: std:file
              Arguments:
                input: csr.pem
              Return: result
          active: true
      att:
        type: aws:iot:ThingPrincipalAttachment
        properties:
          principal: ${cert.arn}
          thing: ${example.name}
    

    Create ThingPrincipalAttachment Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new ThingPrincipalAttachment(name: string, args: ThingPrincipalAttachmentArgs, opts?: CustomResourceOptions);
    @overload
    def ThingPrincipalAttachment(resource_name: str,
                                 args: ThingPrincipalAttachmentArgs,
                                 opts: Optional[ResourceOptions] = None)
    
    @overload
    def ThingPrincipalAttachment(resource_name: str,
                                 opts: Optional[ResourceOptions] = None,
                                 principal: Optional[str] = None,
                                 thing: Optional[str] = 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.
    
    

    Parameters

    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.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var thingPrincipalAttachmentResource = new Aws.Iot.ThingPrincipalAttachment("thingPrincipalAttachmentResource", new()
    {
        Principal = "string",
        Thing = "string",
    });
    
    example, err := iot.NewThingPrincipalAttachment(ctx, "thingPrincipalAttachmentResource", &iot.ThingPrincipalAttachmentArgs{
    	Principal: pulumi.String("string"),
    	Thing:     pulumi.String("string"),
    })
    
    var thingPrincipalAttachmentResource = new ThingPrincipalAttachment("thingPrincipalAttachmentResource", ThingPrincipalAttachmentArgs.builder()
        .principal("string")
        .thing("string")
        .build());
    
    thing_principal_attachment_resource = aws.iot.ThingPrincipalAttachment("thingPrincipalAttachmentResource",
        principal="string",
        thing="string")
    
    const thingPrincipalAttachmentResource = new aws.iot.ThingPrincipalAttachment("thingPrincipalAttachmentResource", {
        principal: "string",
        thing: "string",
    });
    
    type: aws:iot:ThingPrincipalAttachment
    properties:
        principal: string
        thing: string
    

    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 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
    AWS Classic pulumi/pulumi-aws
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the aws Terraform Provider.
    aws logo

    Try AWS Native preview for resources not in the classic version.

    AWS Classic v6.42.0 published on Wednesday, Jun 26, 2024 by Pulumi