1. Packages
  2. AWS Classic
  3. API Docs
  4. ssm
  5. getDocument

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.30.0 published on Thursday, Apr 11, 2024 by Pulumi

aws.ssm.getDocument

Explore with Pulumi AI

aws logo

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.30.0 published on Thursday, Apr 11, 2024 by Pulumi

    Gets the contents of the specified Systems Manager document.

    Example Usage

    To get the contents of the document owned by AWS.

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const foo = aws.ssm.getDocument({
        name: "AWS-GatherSoftwareInventory",
        documentFormat: "YAML",
    });
    export const content = foo.then(foo => foo.content);
    
    import pulumi
    import pulumi_aws as aws
    
    foo = aws.ssm.get_document(name="AWS-GatherSoftwareInventory",
        document_format="YAML")
    pulumi.export("content", foo.content)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ssm"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		foo, err := ssm.LookupDocument(ctx, &ssm.LookupDocumentArgs{
    			Name:           "AWS-GatherSoftwareInventory",
    			DocumentFormat: pulumi.StringRef("YAML"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("content", foo.Content)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var foo = Aws.Ssm.GetDocument.Invoke(new()
        {
            Name = "AWS-GatherSoftwareInventory",
            DocumentFormat = "YAML",
        });
    
        return new Dictionary<string, object?>
        {
            ["content"] = foo.Apply(getDocumentResult => getDocumentResult.Content),
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.ssm.SsmFunctions;
    import com.pulumi.aws.ssm.inputs.GetDocumentArgs;
    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) {
            final var foo = SsmFunctions.getDocument(GetDocumentArgs.builder()
                .name("AWS-GatherSoftwareInventory")
                .documentFormat("YAML")
                .build());
    
            ctx.export("content", foo.applyValue(getDocumentResult -> getDocumentResult.content()));
        }
    }
    
    variables:
      foo:
        fn::invoke:
          Function: aws:ssm:getDocument
          Arguments:
            name: AWS-GatherSoftwareInventory
            documentFormat: YAML
    outputs:
      content: ${foo.content}
    

    To get the contents of the custom document.

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const test = aws.ssm.getDocument({
        name: testAwsSsmDocument.name,
        documentFormat: "JSON",
    });
    
    import pulumi
    import pulumi_aws as aws
    
    test = aws.ssm.get_document(name=test_aws_ssm_document["name"],
        document_format="JSON")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ssm"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := ssm.LookupDocument(ctx, &ssm.LookupDocumentArgs{
    			Name:           testAwsSsmDocument.Name,
    			DocumentFormat: pulumi.StringRef("JSON"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var test = Aws.Ssm.GetDocument.Invoke(new()
        {
            Name = testAwsSsmDocument.Name,
            DocumentFormat = "JSON",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.ssm.SsmFunctions;
    import com.pulumi.aws.ssm.inputs.GetDocumentArgs;
    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) {
            final var test = SsmFunctions.getDocument(GetDocumentArgs.builder()
                .name(testAwsSsmDocument.name())
                .documentFormat("JSON")
                .build());
    
        }
    }
    
    variables:
      test:
        fn::invoke:
          Function: aws:ssm:getDocument
          Arguments:
            name: ${testAwsSsmDocument.name}
            documentFormat: JSON
    

    Using getDocument

    Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

    function getDocument(args: GetDocumentArgs, opts?: InvokeOptions): Promise<GetDocumentResult>
    function getDocumentOutput(args: GetDocumentOutputArgs, opts?: InvokeOptions): Output<GetDocumentResult>
    def get_document(document_format: Optional[str] = None,
                     document_version: Optional[str] = None,
                     name: Optional[str] = None,
                     opts: Optional[InvokeOptions] = None) -> GetDocumentResult
    def get_document_output(document_format: Optional[pulumi.Input[str]] = None,
                     document_version: Optional[pulumi.Input[str]] = None,
                     name: Optional[pulumi.Input[str]] = None,
                     opts: Optional[InvokeOptions] = None) -> Output[GetDocumentResult]
    func LookupDocument(ctx *Context, args *LookupDocumentArgs, opts ...InvokeOption) (*LookupDocumentResult, error)
    func LookupDocumentOutput(ctx *Context, args *LookupDocumentOutputArgs, opts ...InvokeOption) LookupDocumentResultOutput

    > Note: This function is named LookupDocument in the Go SDK.

    public static class GetDocument 
    {
        public static Task<GetDocumentResult> InvokeAsync(GetDocumentArgs args, InvokeOptions? opts = null)
        public static Output<GetDocumentResult> Invoke(GetDocumentInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetDocumentResult> getDocument(GetDocumentArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: aws:ssm/getDocument:getDocument
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Name string
    Name of the Systems Manager document.
    DocumentFormat string
    Returns the document in the specified format. The document format can be either JSON, YAML and TEXT. JSON is the default format.
    DocumentVersion string
    Document version for which you want information.
    Name string
    Name of the Systems Manager document.
    DocumentFormat string
    Returns the document in the specified format. The document format can be either JSON, YAML and TEXT. JSON is the default format.
    DocumentVersion string
    Document version for which you want information.
    name String
    Name of the Systems Manager document.
    documentFormat String
    Returns the document in the specified format. The document format can be either JSON, YAML and TEXT. JSON is the default format.
    documentVersion String
    Document version for which you want information.
    name string
    Name of the Systems Manager document.
    documentFormat string
    Returns the document in the specified format. The document format can be either JSON, YAML and TEXT. JSON is the default format.
    documentVersion string
    Document version for which you want information.
    name str
    Name of the Systems Manager document.
    document_format str
    Returns the document in the specified format. The document format can be either JSON, YAML and TEXT. JSON is the default format.
    document_version str
    Document version for which you want information.
    name String
    Name of the Systems Manager document.
    documentFormat String
    Returns the document in the specified format. The document format can be either JSON, YAML and TEXT. JSON is the default format.
    documentVersion String
    Document version for which you want information.

    getDocument Result

    The following output properties are available:

    Arn string
    ARN of the document. If the document is an AWS managed document, this value will be set to the name of the document instead.
    Content string
    Contents of the document.
    DocumentType string
    Type of the document.
    Id string
    The provider-assigned unique ID for this managed resource.
    Name string
    DocumentFormat string
    DocumentVersion string
    Arn string
    ARN of the document. If the document is an AWS managed document, this value will be set to the name of the document instead.
    Content string
    Contents of the document.
    DocumentType string
    Type of the document.
    Id string
    The provider-assigned unique ID for this managed resource.
    Name string
    DocumentFormat string
    DocumentVersion string
    arn String
    ARN of the document. If the document is an AWS managed document, this value will be set to the name of the document instead.
    content String
    Contents of the document.
    documentType String
    Type of the document.
    id String
    The provider-assigned unique ID for this managed resource.
    name String
    documentFormat String
    documentVersion String
    arn string
    ARN of the document. If the document is an AWS managed document, this value will be set to the name of the document instead.
    content string
    Contents of the document.
    documentType string
    Type of the document.
    id string
    The provider-assigned unique ID for this managed resource.
    name string
    documentFormat string
    documentVersion string
    arn str
    ARN of the document. If the document is an AWS managed document, this value will be set to the name of the document instead.
    content str
    Contents of the document.
    document_type str
    Type of the document.
    id str
    The provider-assigned unique ID for this managed resource.
    name str
    document_format str
    document_version str
    arn String
    ARN of the document. If the document is an AWS managed document, this value will be set to the name of the document instead.
    content String
    Contents of the document.
    documentType String
    Type of the document.
    id String
    The provider-assigned unique ID for this managed resource.
    name String
    documentFormat String
    documentVersion String

    Package Details

    Repository
    AWS Classic pulumi/pulumi-aws
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the aws Terraform Provider.
    aws logo

    Try AWS Native preview for resources not in the classic version.

    AWS Classic v6.30.0 published on Thursday, Apr 11, 2024 by Pulumi