UNPKG

@pulumi/aws

Version:

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

171 lines 7.63 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.Document = void 0; const pulumi = require("@pulumi/pulumi"); const utilities = require("../utilities"); /** * Provides an SSM Document resource * * > **NOTE on updating SSM documents:** Only documents with a schema version of 2.0 * or greater can update their content once created, see [SSM Schema Features](http://docs.aws.amazon.com/systems-manager/latest/userguide/sysman-ssm-docs.html#document-schemas-features). To update a document with an older schema version you must recreate the resource. Not all document types support a schema version of 2.0 or greater. Refer to [SSM document schema features and examples](https://docs.aws.amazon.com/systems-manager/latest/userguide/document-schemas-features.html) for information about which schema versions are supported for the respective `documentType`. * * ## Example Usage * * ### Create an ssm document in JSON format * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const foo = new aws.ssm.Document("foo", { * name: "test_document", * documentType: "Command", * content: ` { * "schemaVersion": "1.2", * "description": "Check ip configuration of a Linux instance.", * "parameters": { * * }, * "runtimeConfig": { * "aws:runShellScript": { * "properties": [ * { * "id": "0.aws:runShellScript", * "runCommand": ["ifconfig"] * } * ] * } * } * } * `, * }); * ``` * * ### Create an ssm document in YAML format * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as aws from "@pulumi/aws"; * * const foo = new aws.ssm.Document("foo", { * name: "test_document", * documentFormat: "YAML", * documentType: "Command", * content: `schemaVersion: '1.2' * description: Check ip configuration of a Linux instance. * parameters: {} * runtimeConfig: * 'aws:runShellScript': * properties: * - id: '0.aws:runShellScript' * runCommand: * - ifconfig * `, * }); * ``` * * ## Import * * Using `pulumi import`, import SSM Documents using the name. For example: * * ```sh * $ pulumi import aws:ssm/document:Document example example * ``` * The `attachments_source` argument does not have an SSM API method for reading the attachment information detail after creation. If the argument is set in the Pulumi program on an imported resource, Pulumi will always show a difference. To workaround this behavior, either omit the argument from the Pulumi program or use `ignore_changes` to hide the difference. For example: */ class Document extends pulumi.CustomResource { /** * Get an existing Document 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 Document(name, state, { ...opts, id: id }); } /** * Returns true if the given object is an instance of Document. 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'] === Document.__pulumiType; } constructor(name, argsOrState, opts) { let resourceInputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState; resourceInputs["arn"] = state?.arn; resourceInputs["attachmentsSources"] = state?.attachmentsSources; resourceInputs["content"] = state?.content; resourceInputs["createdDate"] = state?.createdDate; resourceInputs["defaultVersion"] = state?.defaultVersion; resourceInputs["description"] = state?.description; resourceInputs["documentFormat"] = state?.documentFormat; resourceInputs["documentType"] = state?.documentType; resourceInputs["documentVersion"] = state?.documentVersion; resourceInputs["hash"] = state?.hash; resourceInputs["hashType"] = state?.hashType; resourceInputs["latestVersion"] = state?.latestVersion; resourceInputs["name"] = state?.name; resourceInputs["owner"] = state?.owner; resourceInputs["parameters"] = state?.parameters; resourceInputs["permissions"] = state?.permissions; resourceInputs["platformTypes"] = state?.platformTypes; resourceInputs["region"] = state?.region; resourceInputs["schemaVersion"] = state?.schemaVersion; resourceInputs["status"] = state?.status; resourceInputs["tags"] = state?.tags; resourceInputs["tagsAll"] = state?.tagsAll; resourceInputs["targetType"] = state?.targetType; resourceInputs["versionName"] = state?.versionName; } else { const args = argsOrState; if (args?.content === undefined && !opts.urn) { throw new Error("Missing required property 'content'"); } if (args?.documentType === undefined && !opts.urn) { throw new Error("Missing required property 'documentType'"); } resourceInputs["attachmentsSources"] = args?.attachmentsSources; resourceInputs["content"] = args?.content; resourceInputs["documentFormat"] = args?.documentFormat; resourceInputs["documentType"] = args?.documentType; resourceInputs["name"] = args?.name; resourceInputs["permissions"] = args?.permissions; resourceInputs["region"] = args?.region; resourceInputs["tags"] = args?.tags; resourceInputs["targetType"] = args?.targetType; resourceInputs["versionName"] = args?.versionName; resourceInputs["arn"] = undefined /*out*/; resourceInputs["createdDate"] = undefined /*out*/; resourceInputs["defaultVersion"] = undefined /*out*/; resourceInputs["description"] = undefined /*out*/; resourceInputs["documentVersion"] = undefined /*out*/; resourceInputs["hash"] = undefined /*out*/; resourceInputs["hashType"] = undefined /*out*/; resourceInputs["latestVersion"] = undefined /*out*/; resourceInputs["owner"] = undefined /*out*/; resourceInputs["parameters"] = undefined /*out*/; resourceInputs["platformTypes"] = undefined /*out*/; resourceInputs["schemaVersion"] = undefined /*out*/; resourceInputs["status"] = undefined /*out*/; resourceInputs["tagsAll"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(Document.__pulumiType, name, resourceInputs, opts); } } exports.Document = Document; /** @internal */ Document.__pulumiType = 'aws:ssm/document:Document'; //# sourceMappingURL=document.js.map