Class Document


  • public class Document
    extends com.pulumi.resources.CustomResource
    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 `document_type`. ## Example Usage ### Create an ssm document in JSON format <!--Start PulumiCodeChooser -->
     
     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()        
                 .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());
     
         }
     }
     
     
    <!--End PulumiCodeChooser --> ### Create an ssm document in YAML format <!--Start PulumiCodeChooser -->
     
     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()        
                 .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());
     
         }
     }
     
     
    <!--End PulumiCodeChooser --> ## 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:
    • Nested Class Summary

      • Nested classes/interfaces inherited from class com.pulumi.resources.CustomResource

        com.pulumi.resources.CustomResource.CustomResourceInternal
      • Nested classes/interfaces inherited from class com.pulumi.resources.Resource

        com.pulumi.resources.Resource.LazyField<T extends java.lang.Object>, com.pulumi.resources.Resource.LazyFields, com.pulumi.resources.Resource.ResourceInternal
    • Field Summary

      • Fields inherited from class com.pulumi.resources.Resource

        childResources, remote
    • Constructor Summary

      Constructors 
      Constructor Description
      Document​(java.lang.String name)  
      Document​(java.lang.String name, DocumentArgs args)  
      Document​(java.lang.String name, DocumentArgs args, com.pulumi.resources.CustomResourceOptions options)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      com.pulumi.core.Output<java.lang.String> arn()  
      com.pulumi.core.Output<java.util.Optional<java.util.List<DocumentAttachmentsSource>>> attachmentsSources()  
      com.pulumi.core.Output<java.lang.String> content()  
      com.pulumi.core.Output<java.lang.String> createdDate()  
      com.pulumi.core.Output<java.lang.String> defaultVersion()  
      com.pulumi.core.Output<java.lang.String> description()  
      com.pulumi.core.Output<java.util.Optional<java.lang.String>> documentFormat()  
      com.pulumi.core.Output<java.lang.String> documentType()  
      com.pulumi.core.Output<java.lang.String> documentVersion()  
      static Document get​(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, DocumentState state, com.pulumi.resources.CustomResourceOptions options)
      Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
      com.pulumi.core.Output<java.lang.String> hash()  
      com.pulumi.core.Output<java.lang.String> hashType()  
      com.pulumi.core.Output<java.lang.String> latestVersion()  
      com.pulumi.core.Output<java.lang.String> name()  
      com.pulumi.core.Output<java.lang.String> owner()  
      com.pulumi.core.Output<java.util.List<DocumentParameter>> parameters()  
      com.pulumi.core.Output<java.util.Optional<java.util.Map<java.lang.String,​java.lang.String>>> permissions()  
      com.pulumi.core.Output<java.util.List<java.lang.String>> platformTypes()  
      com.pulumi.core.Output<java.lang.String> schemaVersion()  
      com.pulumi.core.Output<java.lang.String> status()  
      com.pulumi.core.Output<java.util.Optional<java.util.Map<java.lang.String,​java.lang.String>>> tags()  
      com.pulumi.core.Output<java.util.Map<java.lang.String,​java.lang.String>> tagsAll()  
      com.pulumi.core.Output<java.util.Optional<java.lang.String>> targetType()  
      com.pulumi.core.Output<java.util.Optional<java.lang.String>> versionName()  
      • Methods inherited from class com.pulumi.resources.CustomResource

        getId, id, idFuture
      • Methods inherited from class com.pulumi.resources.Resource

        getChildResources, getResourceName, getResourceType, getUrn, pulumiChildResources, pulumiResourceName, pulumiResourceType, urn
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Document

        public Document​(java.lang.String name)
        Parameters:
        name - The _unique_ name of the resulting resource.
      • Document

        public Document​(java.lang.String name,
                        DocumentArgs args)
        Parameters:
        name - The _unique_ name of the resulting resource.
        args - The arguments to use to populate this resource's properties.
      • Document

        public Document​(java.lang.String name,
                        DocumentArgs args,
                        @Nullable
                        com.pulumi.resources.CustomResourceOptions options)
        Parameters:
        name - The _unique_ name of the resulting resource.
        args - The arguments to use to populate this resource's properties.
        options - A bag of options that control this resource's behavior.
    • Method Detail

      • arn

        public com.pulumi.core.Output<java.lang.String> arn()
        Returns:
        The Amazon Resource Name (ARN) of the document.
      • attachmentsSources

        public com.pulumi.core.Output<java.util.Optional<java.util.List<DocumentAttachmentsSource>>> attachmentsSources()
        Returns:
        One or more configuration blocks describing attachments sources to a version of a document. See `attachments_source` block below for details.
      • content

        public com.pulumi.core.Output<java.lang.String> content()
        Returns:
        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.
      • createdDate

        public com.pulumi.core.Output<java.lang.String> createdDate()
        Returns:
        The date the document was created.
      • defaultVersion

        public com.pulumi.core.Output<java.lang.String> defaultVersion()
        Returns:
        The default version of the document.
      • description

        public com.pulumi.core.Output<java.lang.String> description()
        Returns:
        A description of what the parameter does, how to use it, the default value, and whether or not the parameter is optional.
      • documentFormat

        public com.pulumi.core.Output<java.util.Optional<java.lang.String>> documentFormat()
        Returns:
        The format of the document. Valid values: `JSON`, `TEXT`, `YAML`.
      • documentType

        public com.pulumi.core.Output<java.lang.String> documentType()
        Returns:
        The type of the document. For a list of valid values, see the [API Reference](https://docs.aws.amazon.com/systems-manager/latest/APIReference/API_CreateDocument.html#systemsmanager-CreateDocument-request-DocumentType).
      • documentVersion

        public com.pulumi.core.Output<java.lang.String> documentVersion()
        Returns:
        The document version.
      • hash

        public com.pulumi.core.Output<java.lang.String> hash()
        Returns:
        The Sha256 or Sha1 hash created by the system when the document was created.
      • hashType

        public com.pulumi.core.Output<java.lang.String> hashType()
        Returns:
        The hash type of the document. Valid values: `Sha256`, `Sha1`.
      • latestVersion

        public com.pulumi.core.Output<java.lang.String> latestVersion()
        Returns:
        The latest version of the document.
      • name

        public com.pulumi.core.Output<java.lang.String> name()
        Returns:
        The name of the document.
      • owner

        public com.pulumi.core.Output<java.lang.String> owner()
        Returns:
        The Amazon Web Services user that created the document.
      • parameters

        public com.pulumi.core.Output<java.util.List<DocumentParameter>> parameters()
        Returns:
        One or more configuration blocks describing the parameters for the document. See `parameter` block below for details.
      • permissions

        public com.pulumi.core.Output<java.util.Optional<java.util.Map<java.lang.String,​java.lang.String>>> permissions()
        Returns:
        Additional permissions to attach to the document. See Permissions below for details.
      • platformTypes

        public com.pulumi.core.Output<java.util.List<java.lang.String>> platformTypes()
        Returns:
        The list of operating system (OS) platforms compatible with this SSM document. Valid values: `Windows`, `Linux`, `MacOS`.
      • schemaVersion

        public com.pulumi.core.Output<java.lang.String> schemaVersion()
        Returns:
        The schema version of the document.
      • status

        public com.pulumi.core.Output<java.lang.String> status()
        Returns:
        The status of the SSM document. Valid values: `Creating`, `Active`, `Updating`, `Deleting`, `Failed`.
      • tags

        public com.pulumi.core.Output<java.util.Optional<java.util.Map<java.lang.String,​java.lang.String>>> tags()
        Returns:
        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.
      • tagsAll

        public com.pulumi.core.Output<java.util.Map<java.lang.String,​java.lang.String>> tagsAll()
        Returns:
        A map of tags assigned to the resource, including those inherited from the provider `default_tags` configuration block.
      • targetType

        public com.pulumi.core.Output<java.util.Optional<java.lang.String>> targetType()
        Returns:
        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](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-template-resource-type-ref.html).
      • versionName

        public com.pulumi.core.Output<java.util.Optional<java.lang.String>> versionName()
        Returns:
        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.
      • get

        public static Document get​(java.lang.String name,
                                   com.pulumi.core.Output<java.lang.String> id,
                                   @Nullable
                                   DocumentState state,
                                   @Nullable
                                   com.pulumi.resources.CustomResourceOptions options)
        Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
        Parameters:
        name - The _unique_ name of the resulting resource.
        id - The _unique_ provider ID of the resource to lookup.
        state -
        options - Optional settings to control the behavior of the CustomResource.