1. Packages
  2. AWS
  3. API Docs
  4. ssm
  5. getDocument
AWS v6.78.0 published on Thursday, Apr 24, 2025 by Pulumi

aws.ssm.getDocument

Explore with Pulumi AI

AWS v6.78.0 published on Thursday, Apr 24, 2025 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);
Copy
import pulumi
import pulumi_aws as aws

foo = aws.ssm.get_document(name="AWS-GatherSoftwareInventory",
    document_format="YAML")
pulumi.export("content", foo.content)
Copy
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
	})
}
Copy
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),
    };
});
Copy
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.content());
    }
}
Copy
variables:
  foo:
    fn::invoke:
      function: aws:ssm:getDocument
      arguments:
        name: AWS-GatherSoftwareInventory
        documentFormat: YAML
outputs:
  content: ${foo.content}
Copy

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",
});
Copy
import pulumi
import pulumi_aws as aws

test = aws.ssm.get_document(name=test_aws_ssm_document["name"],
    document_format="JSON")
Copy
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
	})
}
Copy
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",
    });

});
Copy
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());

    }
}
Copy
variables:
  test:
    fn::invoke:
      function: aws:ssm:getDocument
      arguments:
        name: ${testAwsSsmDocument.name}
        documentFormat: JSON
Copy

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>
Copy
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]
Copy
func LookupDocument(ctx *Context, args *LookupDocumentArgs, opts ...InvokeOption) (*LookupDocumentResult, error)
func LookupDocumentOutput(ctx *Context, args *LookupDocumentOutputArgs, opts ...InvokeOption) LookupDocumentResultOutput
Copy

> 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)
}
Copy
public static CompletableFuture<GetDocumentResult> getDocument(GetDocumentArgs args, InvokeOptions options)
public static Output<GetDocumentResult> getDocument(GetDocumentArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: aws:ssm/getDocument:getDocument
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

Name This property is required. string
The name of the document.
DocumentFormat string
The format of the document. Valid values: JSON, TEXT, YAML.
DocumentVersion string
The document version.
Name This property is required. string
The name of the document.
DocumentFormat string
The format of the document. Valid values: JSON, TEXT, YAML.
DocumentVersion string
The document version.
name This property is required. String
The name of the document.
documentFormat String
The format of the document. Valid values: JSON, TEXT, YAML.
documentVersion String
The document version.
name This property is required. string
The name of the document.
documentFormat string
The format of the document. Valid values: JSON, TEXT, YAML.
documentVersion string
The document version.
name This property is required. str
The name of the document.
document_format str
The format of the document. Valid values: JSON, TEXT, YAML.
document_version str
The document version.
name This property is required. String
The name of the document.
documentFormat String
The format of the document. Valid values: JSON, TEXT, YAML.
documentVersion String
The document version.

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
The content for the SSM document in JSON or YAML format.
DocumentType string
The 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
The content for the SSM document in JSON or YAML format.
DocumentType string
The 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
The content for the SSM document in JSON or YAML format.
documentType String
The 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
The content for the SSM document in JSON or YAML format.
documentType string
The 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
The content for the SSM document in JSON or YAML format.
document_type str
The 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
The content for the SSM document in JSON or YAML format.
documentType String
The 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 v6.78.0 published on Thursday, Apr 24, 2025 by Pulumi