Document class
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 documentType.
Example Usage
Create an ssm document in JSON format
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\\"]
}
]
}
}
}
`,
});
import pulumi
import pulumi_aws as aws
foo = aws.ssm.Document("foo",
name="test_document",
document_type="Command",
content=""" {
\"schemaVersion\": \"1.2\",
\"description\": \"Check ip configuration of a Linux instance.\",
\"parameters\": {
},
\"runtimeConfig\": {
\"aws:runShellScript\": {
\"properties\": [
{
\"id\": \"0.aws:runShellScript\",
\"runCommand\": [\"ifconfig\"]
}
]
}
}
}
""")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var foo = new Aws.Ssm.Document("foo", new()
{
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\""]
}
]
}
}
}
",
});
});
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/ssm"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := ssm.NewDocument(ctx, "foo", &ssm.DocumentArgs{
Name: pulumi.String("test_document"),
DocumentType: pulumi.String("Command"),
Content: pulumi.String(` {
\"schemaVersion\": \"1.2\",
\"description\": \"Check ip configuration of a Linux instance.\",
\"parameters\": {
},
\"runtimeConfig\": {
\"aws:runShellScript\": {
\"properties\": [
{
\"id\": \"0.aws:runShellScript\",
\"runCommand\": [\"ifconfig\"]
}
]
}
}
}
`),
})
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
aws = {
source = "pulumi/aws"
}
}
}
resource "aws_ssm_document" "foo" {
name = "test_document"
document_type = "Command"
content = " {\n \\\"schemaVersion\\\": \\\"1.2\\\",\n \\\"description\\\": \\\"Check ip configuration of a Linux instance.\\\",\n \\\"parameters\\\": {\n\n },\n \\\"runtimeConfig\\\": {\n \\\"aws:runShellScript\\\": {\n \\\"properties\\\": [\n {\n \\\"id\\\": \\\"0.aws:runShellScript\\\",\n \\\"runCommand\\\": [\\\"ifconfig\\\"]\n }\n ]\n }\n }\n }\n"
}
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.ArrayList;
import java.util.Arrays;
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()
.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\"]
}
]
}
}
}
""")
.build());
}
}
resources:
foo:
type: aws:ssm:Document
properties:
name: test_document
documentType: Command
content: |2
{
\"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
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 pulumi
import pulumi_aws as aws
foo = aws.ssm.Document("foo",
name="test_document",
document_format="YAML",
document_type="Command",
content="""schemaVersion: '1.2'
description: Check ip configuration of a Linux instance.
parameters: {}
runtimeConfig:
'aws:runShellScript':
properties:
- id: '0.aws:runShellScript'
runCommand:
- ifconfig
""")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var foo = new Aws.Ssm.Document("foo", new()
{
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
",
});
});
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/ssm"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := ssm.NewDocument(ctx, "foo", &ssm.DocumentArgs{
Name: pulumi.String("test_document"),
DocumentFormat: pulumi.String("YAML"),
DocumentType: pulumi.String("Command"),
Content: pulumi.String(`schemaVersion: '1.2'
description: Check ip configuration of a Linux instance.
parameters: {}
runtimeConfig:
'aws:runShellScript':
properties:
- id: '0.aws:runShellScript'
runCommand:
- ifconfig
`),
})
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
aws = {
source = "pulumi/aws"
}
}
}
resource "aws_ssm_document" "foo" {
name = "test_document"
document_format = "YAML"
document_type = "Command"
content = "schemaVersion: '1.2'\ndescription: Check ip configuration of a Linux instance.\nparameters: {}\nruntimeConfig:\n 'aws:runShellScript':\n properties:\n - id: '0.aws:runShellScript'\n runCommand:\n - ifconfig\n"
}
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.ArrayList;
import java.util.Arrays;
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()
.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
""")
.build());
}
}
resources:
foo:
type: aws:ssm:Document
properties:
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
Identity Schema
Required
name- (String) Name of the SSM document.
Optional
accountId(String) AWS Account where this resource is managed.region(String) Region where this resource is managed.
Using pulumi import, import SSM Documents using the name. For example:
$ pulumi import aws:ssm/document:Document example example
The attachmentsSource 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 ignoreChanges to hide the difference. For example:
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const test = new aws.ssm.Document("test", {
attachmentsSources: [{
key: "SourceUrl",
values: [`s3://${objectBucket.bucket}/test.zip`],
}],
name: "test_document",
documentType: "Package",
}, {
ignoreChanges: ["attachmentsSources"],
});
import pulumi
import pulumi_aws as aws
test = aws.ssm.Document("test",
attachments_sources=[{
"key": "SourceUrl",
"values": [f"s3://{object_bucket['bucket']}/test.zip"],
}],
name="test_document",
document_type="Package",
opts = pulumi.ResourceOptions(ignore_changes=["attachmentsSources"]))
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var test = new Aws.Ssm.Document("test", new()
{
AttachmentsSources = new[]
{
new Aws.Ssm.Inputs.DocumentAttachmentsSourceArgs
{
Key = "SourceUrl",
Values = new[]
{
$"s3://{objectBucket.Bucket}/test.zip",
},
},
},
Name = "test_document",
DocumentType = "Package",
}, new CustomResourceOptions
{
IgnoreChanges =
{
"attachmentsSources",
},
});
});
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/ssm"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := ssm.NewDocument(ctx, "test", &ssm.DocumentArgs{
AttachmentsSources: ssm.DocumentAttachmentsSourceArray{
&ssm.DocumentAttachmentsSourceArgs{
Key: pulumi.String("SourceUrl"),
Values: pulumi.StringArray{
pulumi.Sprintf("s3://%v/test.zip", objectBucket.Bucket),
},
},
},
Name: pulumi.String("test_document"),
DocumentType: pulumi.String("Package"),
}, pulumi.IgnoreChanges([]string{
"attachmentsSources",
}))
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
aws = {
source = "pulumi/aws"
}
}
}
resource "aws_ssm_document" "test" {
lifecycle {
ignore_changes = [attachmentsSources]
}
attachments_sources {
key = "SourceUrl"
values = ["s3://${objectBucket.bucket}/test.zip"]
}
name = "test_document"
document_type = "Package"
}
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 com.pulumi.aws.ssm.inputs.DocumentAttachmentsSourceArgs;
import com.pulumi.resources.CustomResourceOptions;
import java.util.ArrayList;
import java.util.Arrays;
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 test = new Document("test", DocumentArgs.builder()
.attachmentsSources(DocumentAttachmentsSourceArgs.builder()
.key("SourceUrl")
.values(String.format("s3://%s/test.zip", objectBucket.bucket()))
.build())
.name("test_document")
.documentType("Package")
.build(), CustomResourceOptions.builder()
.ignoreChanges("attachmentsSources")
.build());
}
}
resources:
test:
type: aws:ssm:Document
properties:
attachmentsSources:
- key: SourceUrl
values:
- s3://${objectBucket.bucket}/test.zip
name: test_document
documentType: Package
options:
ignoreChanges:
- attachmentsSources
Constructors
- Document(String name, {DocumentArgs? args, CustomResourceOptions? options})
-
Creates a new Document.
nameThe Pulumi resource name.argsArguments used to configure this Document. The set of arguments for Document.optionsResource options controlling this resource's behavior. - Document.reference(String urn)
- Creates a typed reference to an existing Document resource.
Properties
-
arn
↔ Output<
String> -
ARN of the document.
latefinal
-
attachmentsSources
↔ Output<
List< DocumentAttachmentsSource> ?> -
One or more configuration blocks describing attachments sources to a version of a document. See
attachmentsSourceblock below for details.latefinal -
childResources
→ Set<
Resource> -
finalinherited
-
completionSources
↔ Map<
String, IOutputCompletionSource> -
latefinalinherited
-
content
↔ Output<
String> -
The content for the SSM document in JSON or YAML format. The content of the document must not exceed 64KB. This quota also includes the content specified for input parameters at runtime. We recommend storing the contents for your new document in an external JSON or YAML file and referencing the file in a command.
latefinal
-
createdDate
↔ Output<
String> -
The date the document was created.
latefinal
-
defaultVersion
↔ Output<
String> -
The default version of the document.
latefinal
-
description
↔ Output<
String> -
A description of what the parameter does, how to use it, the default value, and whether or not the parameter is optional.
latefinal
-
documentFormat
↔ Output<
String?> -
The format of the document. Valid values:
JSON,TEXT,YAML.latefinal -
documentType
↔ Output<
String> -
The type of the document. For a list of valid values, see the API Reference.
latefinal
-
documentVersion
↔ Output<
String> -
The document version.
latefinal
-
hash
↔ Output<
String> -
The Sha256 or Sha1 hash created by the system when the document was created.
latefinal
- hashCode → int
-
The hash code for this object.
no setterinherited
-
hashType
↔ Output<
String> -
The hash type of the document. Valid values:
Sha256,Sha1.latefinal -
id
↔ Output<
String> -
getter/setter pairinherited
- isCustom → bool
-
Returns whether this resource is provider-managed.
no setterinherited
- isProtected → bool
-
Returns whether this resource is protected from deletion.
no setterinherited
- isRemote → bool
-
Whether this resource is registered as remote.
no setterinherited
- isResourceReference → bool
-
Whether this instance represents a resource value returned over RPC.
finalinherited
-
latestVersion
↔ Output<
String> -
The latest version of the document.
latefinal
-
name
↔ Output<
String> -
The name of the document.
latefinal
-
owner
↔ Output<
String> -
The Amazon Web Services user that created the document.
latefinal
-
parameters
↔ Output<
List< DocumentParameter> > -
One or more configuration blocks describing the parameters for the document. See
parameterblock below for details.latefinal -
permissions
↔ Output<
Map< String, String> ?> -
Additional permissions to attach to the document. See Permissions below for details.
latefinal
-
platformTypes
↔ Output<
List< String> > -
The list of operating system (OS) platforms compatible with this SSM document. Valid values:
Windows,Linux,MacOS.latefinal -
region
↔ Output<
String> -
Region where this resource will be managed. Defaults to the Region set in the provider configuration.
latefinal
-
resourceTransforms
→ List<
ResourceTransform> -
Inherited/explicit async transforms.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
schemaVersion
↔ Output<
String> -
The schema version of the document.
latefinal
-
status
↔ Output<
String> -
The status of the SSM document. Valid values:
Creating,Active,Updating,Deleting,Failed.latefinal -
A map of tags to assign to the object. .If configured with a provider
defaultTagsconfiguration block present, tags with matching keys will overwrite those defined at the provider-level.latefinal -
A map of tags assigned to the resource, including those inherited from the provider
defaultTagsconfiguration block.latefinal -
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 and property types reference.latefinal -
transformations
→ List<
ResourceTransformation> -
Inherited/explicit legacy transformations.
no setterinherited
-
urn
↔ Output<
String> -
latefinalinherited
-
versionName
↔ Output<
String?> -
The version of the artifact associated with the document. For example,
12.6. This value is unique across all versions of a document, and can't be changed.latefinal
Methods
-
failId(
Object error) → void -
Completes this resource ID with an error when registration fails.
inherited
-
failOutputs(
Object error) → void -
Completes all output properties with
error.inherited -
failUrn(
Object error) → void -
Completes this resource URN with an error when registration fails.
inherited
-
getProvider(
String moduleMember) → ProviderResource? -
Returns provider for
moduleMember's package, if configured.inherited -
getResourceName(
) → String -
Returns this resource's logical name.
inherited
-
getResourceType(
) → String -
Returns this resource's Pulumi type token.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
registerOutput<
T> (String propertyName, {Object? decoder(Object?)?, bool isSecret = false}) → Output< T> -
Registers a dynamic output property for this resource.
inherited
-
resolveId(
String? value, {required bool isKnown}) → void -
Resolves the provider-assigned ID for this resource.
inherited
-
resolveOutputs(
Struct outputs) → void -
Resolves all output properties from a monitor response payload.
inherited
-
resolveUrn(
String value) → void -
Resolves this resource's URN once assigned by the engine.
inherited
-
serializeProperties(
Map< String, dynamic> properties) → Future<Struct> -
Serializes resource properties for RPC transmission.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited