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
{
Active = true,
Csr = File.ReadAllText("csr.pem"),
});
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",
active=True,
csr=(lambda path: open(path).read())("csr.pem"))
att = aws.iot.PolicyAttachment("att",
policy=pubsub.name,
target=cert.arn)import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
import * as fs 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", {
active: true,
csr: fs.readFileSync("csr.pem", "utf-8"),
});
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);def PolicyAttachment(resource_name, opts=None, policy=None, target=None, __props__=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.
- opts ResourceOptions
- A bag of options that control this 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:
Outputs
All input properties are implicitly available as output properties. Additionally, the PolicyAttachment resource produces the following output properties:
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): PolicyAttachmentstatic get(resource_name, id, opts=None, policy=None, target=None, __props__=None);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:
Package Details
- Repository
- https://github.com/pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
awsTerraform Provider.