UNPKG

@pulumi/aws

Version:

A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.

154 lines 6.42 kB
"use strict"; // *** WARNING: this file was generated by pulumi-language-nodejs. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** Object.defineProperty(exports, "__esModule", { value: true }); exports.ProvisioningTemplate = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Manages an IoT fleet provisioning template. For more info, see the AWS documentation on [fleet provisioning](https://docs.aws.amazon.com/iot/latest/developerguide/provision-wo-cert.html). * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const iotAssumeRolePolicy = aws.iam.getPolicyDocument({ * statements: [{ * actions: ["sts:AssumeRole"], * principals: [{ * type: "Service", * identifiers: ["iot.amazonaws.com"], * }], * }], * }); * const iotFleetProvisioning = new aws.iam.Role("iot_fleet_provisioning", { * name: "IoTProvisioningServiceRole", * path: "/service-role/", * assumeRolePolicy: iotAssumeRolePolicy.then(iotAssumeRolePolicy => iotAssumeRolePolicy.json), * }); * const iotFleetProvisioningRegistration = new aws.iam.RolePolicyAttachment("iot_fleet_provisioning_registration", { * role: iotFleetProvisioning.name, * policyArn: "arn:aws:iam::aws:policy/service-role/AWSIoTThingsRegistration", * }); * const devicePolicy = aws.iam.getPolicyDocument({ * statements: [{ * actions: ["iot:Subscribe"], * resources: ["*"], * }], * }); * const devicePolicyPolicy = new aws.iot.Policy("device_policy", { * name: "DevicePolicy", * policy: devicePolicy.then(devicePolicy => devicePolicy.json), * }); * const fleet = new aws.iot.ProvisioningTemplate("fleet", { * name: "FleetTemplate", * description: "My provisioning template", * provisioningRoleArn: iotFleetProvisioning.arn, * enabled: true, * templateBody: pulumi.jsonStringify({ * Parameters: { * SerialNumber: { * Type: "String", * }, * }, * Resources: { * certificate: { * Properties: { * CertificateId: { * Ref: "AWS::IoT::Certificate::Id", * }, * Status: "Active", * }, * Type: "AWS::IoT::Certificate", * }, * policy: { * Properties: { * PolicyName: devicePolicyPolicy.name, * }, * Type: "AWS::IoT::Policy", * }, * }, * }), * }); * ``` * * ## Import * * Using `pulumi import`, import IoT fleet provisioning templates using the `name`. For example: * * ```sh * $ pulumi import aws:iot/provisioningTemplate:ProvisioningTemplate fleet FleetProvisioningTemplate * ``` */ class ProvisioningTemplate extends pulumi.CustomResource { /** * Get an existing ProvisioningTemplate resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state Any extra arguments used during the lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ static get(name, id, state, opts) { return new ProvisioningTemplate(name, state, { ...opts, id: id }); } /** * Returns true if the given object is an instance of ProvisioningTemplate. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj) { if (obj === undefined || obj === null) { return false; } return obj['__pulumiType'] === ProvisioningTemplate.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["arn"] = state?.arn; resourceInputs["defaultVersionId"] = state?.defaultVersionId; resourceInputs["description"] = state?.description; resourceInputs["enabled"] = state?.enabled; resourceInputs["name"] = state?.name; resourceInputs["preProvisioningHook"] = state?.preProvisioningHook; resourceInputs["provisioningRoleArn"] = state?.provisioningRoleArn; resourceInputs["region"] = state?.region; resourceInputs["tags"] = state?.tags; resourceInputs["tagsAll"] = state?.tagsAll; resourceInputs["templateBody"] = state?.templateBody; resourceInputs["type"] = state?.type; } else { const args = argsOrState; if (args?.provisioningRoleArn === undefined && !opts.urn) { throw new Error("Missing required property 'provisioningRoleArn'"); } if (args?.templateBody === undefined && !opts.urn) { throw new Error("Missing required property 'templateBody'"); } resourceInputs["description"] = args?.description; resourceInputs["enabled"] = args?.enabled; resourceInputs["name"] = args?.name; resourceInputs["preProvisioningHook"] = args?.preProvisioningHook; resourceInputs["provisioningRoleArn"] = args?.provisioningRoleArn; resourceInputs["region"] = args?.region; resourceInputs["tags"] = args?.tags; resourceInputs["templateBody"] = args?.templateBody; resourceInputs["type"] = args?.type; resourceInputs["arn"] = undefined /*out*/; resourceInputs["defaultVersionId"] = undefined /*out*/; resourceInputs["tagsAll"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(ProvisioningTemplate.__pulumiType, name, resourceInputs, opts); } } exports.ProvisioningTemplate = ProvisioningTemplate; /** @internal */ ProvisioningTemplate.__pulumiType = 'aws:iot/provisioningTemplate:ProvisioningTemplate'; //# sourceMappingURL=provisioningTemplate.js.map