Document

class Document : KotlinCustomResource

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. 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 for information about which schema versions are supported for the respective document_type.

Example Usage

Create an ssm document in JSON format

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.ssm.Document;
import com.pulumi.aws.ssm.DocumentArgs;
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 foo = new Document("foo", DocumentArgs.builder()
.content("""
{
"schemaVersion": "1.2",
"description": "Check ip configuration of a Linux instance.",
"parameters": {
},
"runtimeConfig": {
"aws:runShellScript": {
"properties": [
{
"id": "0.aws:runShellScript",
"runCommand": ["ifconfig"]
}
]
}
}
}
""")
.documentType("Command")
.build());
}
}

Create an ssm document in YAML format

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.ssm.Document;
import com.pulumi.aws.ssm.DocumentArgs;
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 foo = new Document("foo", DocumentArgs.builder()
.content("""
schemaVersion: '1.2'
description: Check ip configuration of a Linux instance.
parameters: {}
runtimeConfig:
'aws:runShellScript':
properties:
- id: '0.aws:runShellScript'
runCommand:
- ifconfig
""")
.documentFormat("YAML")
.documentType("Command")
.build());
}
}

Permissions

The permissions attribute specifies how you want to share the document. If you share a document privately, you must specify the AWS user account IDs for those people who can use the document. If you share a document publicly, you must specify All as the account ID. The permissions mapping supports the following:

  • type - The permission type for the document. The permission type can be Share.

  • account_ids - The AWS user accounts that should have access to the document. The account IDs can either be a group of account IDs or All.

Import

SSM Documents can be imported using the name, e.g.,

$ 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 provider configuration on an imported resource, this provider will always show a difference. To workaround this behavior, either omit the argument from the configuration or use ignoreChanges to hide the difference, e.g. terraform resource "aws_ssm_document" "test" { name = "test_document" document_type = "Package" attachments_source { key = "SourceUrl" values = "s3://${aws_s3_bucket.object_bucket.bucket}/test.zip" }

There is no AWS SSM API for reading attachments_source info directly

lifecycle { ignore_changes = attachments_source } }

Properties

Link copied to clipboard
val arn: Output<String>
Link copied to clipboard

One or more configuration blocks describing attachments sources to a version of a document. Defined below.

Link copied to clipboard
val content: Output<String>

The JSON or YAML content of the document.

Link copied to clipboard
val createdDate: Output<String>

The date the document was created.

Link copied to clipboard
val defaultVersion: Output<String>

The default version of the document.

Link copied to clipboard
val description: Output<String>

The description of the document.

Link copied to clipboard
val documentFormat: Output<String>?

The format of the document. Valid document types include: JSON and YAML

Link copied to clipboard
val documentType: Output<String>

The type of the document. Valid document types include: Automation, Command, Package, Policy, and Session

Link copied to clipboard
val documentVersion: Output<String>

The document version.

Link copied to clipboard
val hash: Output<String>

The sha1 or sha256 of the document content

Link copied to clipboard
val hashType: Output<String>

"Sha1" "Sha256". The hashing algorithm used when hashing the content.

Link copied to clipboard
val id: Output<String>
Link copied to clipboard
val latestVersion: Output<String>

The latest version of the document.

Link copied to clipboard
val name: Output<String>

The name of the document.

Link copied to clipboard
val owner: Output<String>

The AWS user account of the person who created the document.

Link copied to clipboard

The parameters that are available to this document.

Link copied to clipboard
val permissions: Output<Map<String, String>>?

Additional Permissions to attach to the document. See Permissions below for details.

Link copied to clipboard
val platformTypes: Output<List<String>>

A list of OS platforms compatible with this SSM document, either "Windows" or "Linux".

Link copied to clipboard
val pulumiChildResources: Set<KotlinResource>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val schemaVersion: Output<String>

The schema version of the document.

Link copied to clipboard
val status: Output<String>

"Creating", "Active" or "Deleting". The current status of the document.

Link copied to clipboard
val tags: Output<Map<String, String>>?

A map of tags to assign to the object. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

Link copied to clipboard
val tagsAll: Output<Map<String, String>>

A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Link copied to clipboard
val targetType: Output<String>?

The target type which defines the kinds of resources the document can run on. For example, /AWS::EC2::Instance. For a list of valid resource types, see AWS Resource Types Reference (http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-template-resource-type-ref.html)

Link copied to clipboard
val urn: Output<String>
Link copied to clipboard
val versionName: Output<String>?

A field specifying the version of the artifact you are creating with the document. For example, "Release 12, Update 6". This value is unique across all versions of a document and cannot be changed for an existing document version.