PolicyAttachment

Provides an IoT policy attachment.

Example Usage

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

class MyStack : Stack
{
    public MyStack()
    {
        var pubsub = new Aws.Iot.Policy("pubsub", new Aws.Iot.PolicyArgs
        {
            Policy = @"{
  ""Version"": ""2012-10-17"",
  ""Statement"": [
    {
      ""Action"": [
        ""iot:*""
      ],
      ""Effect"": ""Allow"",
      ""Resource"": ""*""
    }
  ]
}
",
        });
        var cert = new Aws.Iot.Certificate("cert", new Aws.Iot.CertificateArgs
        {
            Csr = File.ReadAllText("csr.pem"),
            Active = true,
        });
        var att = new Aws.Iot.PolicyAttachment("att", new Aws.Iot.PolicyAttachmentArgs
        {
            Policy = pubsub.Name,
            Target = cert.Arn,
        });
    }

}

Coming soon!

import pulumi
import pulumi_aws as aws

pubsub = aws.iot.Policy("pubsub", policy="""{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Action": [
        "iot:*"
      ],
      "Effect": "Allow",
      "Resource": "*"
    }
  ]
}
""")
cert = aws.iot.Certificate("cert",
    csr=(lambda path: open(path).read())("csr.pem"),
    active=True)
att = aws.iot.PolicyAttachment("att",
    policy=pubsub.name,
    target=cert.arn)
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
import * from "fs";

const pubsub = new aws.iot.Policy("pubsub", {policy: `{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Action": [
        "iot:*"
      ],
      "Effect": "Allow",
      "Resource": "*"
    }
  ]
}
`});
const cert = new aws.iot.Certificate("cert", {
    csr: fs.readFileSync("csr.pem"),
    active: true,
});
const att = new aws.iot.PolicyAttachment("att", {
    policy: pubsub.name,
    target: cert.arn,
});

Create a PolicyAttachment Resource

new PolicyAttachment(name: string, args: PolicyAttachmentArgs, opts?: CustomResourceOptions);
@overload
def PolicyAttachment(resource_name: str,
                     opts: Optional[ResourceOptions] = None,
                     policy: Optional[str] = None,
                     target: Optional[str] = None)
@overload
def PolicyAttachment(resource_name: str,
                     args: PolicyAttachmentArgs,
                     opts: Optional[ResourceOptions] = None)
func NewPolicyAttachment(ctx *Context, name string, args PolicyAttachmentArgs, opts ...ResourceOption) (*PolicyAttachment, error)
public PolicyAttachment(string name, PolicyAttachmentArgs args, CustomResourceOptions? opts = null)
name string
The unique name of the resource.
args PolicyAttachmentArgs
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 PolicyAttachmentArgs
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 PolicyAttachmentArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args PolicyAttachmentArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

PolicyAttachment Resource Properties

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

Inputs

The PolicyAttachment resource accepts the following input properties:

Policy string | string
The name of the policy to attach.
Target string
The identity to which the policy is attached.
Policy string | string
The name of the policy to attach.
Target string
The identity to which the policy is attached.
policy string | Policy
The name of the policy to attach.
target ARN
The identity to which the policy is attached.
policy str | str
The name of the policy to attach.
target str
The identity to which the policy is attached.

Outputs

All input properties are implicitly available as output properties. Additionally, the PolicyAttachment 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 str
The provider-assigned unique ID for this managed resource.

Look up an Existing PolicyAttachment Resource

Get an existing PolicyAttachment 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?: PolicyAttachmentState, opts?: CustomResourceOptions): PolicyAttachment
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        policy: Optional[str] = None,
        target: Optional[str] = None) -> PolicyAttachment
func GetPolicyAttachment(ctx *Context, name string, id IDInput, state *PolicyAttachmentState, opts ...ResourceOption) (*PolicyAttachment, error)
public static PolicyAttachment Get(string name, Input<string> id, PolicyAttachmentState? state, CustomResourceOptions? opts = null)
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.

The following state arguments are supported:

Policy string | string
The name of the policy to attach.
Target string
The identity to which the policy is attached.
Policy string | string
The name of the policy to attach.
Target string
The identity to which the policy is attached.
policy string | Policy
The name of the policy to attach.
target ARN
The identity to which the policy is attached.
policy str | str
The name of the policy to attach.
target str
The identity to which the policy is attached.

Package Details

Repository
https://github.com/pulumi/pulumi-aws
License
Apache-2.0
Notes
This Pulumi package is based on the aws Terraform Provider.