AWS v6.60.0 published on Tuesday, Nov 19, 2024 by Pulumi
aws.ssm.getDocument
Explore with Pulumi AI
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
- The name of the document.
- Document
Format string - The format of the document. Valid values:
JSON
,TEXT
,YAML
. - Document
Version string - The document version.
- Name string
- The name of the document.
- Document
Format string - The format of the document. Valid values:
JSON
,TEXT
,YAML
. - Document
Version string - The document version.
- name String
- The name of the document.
- document
Format String - The format of the document. Valid values:
JSON
,TEXT
,YAML
. - document
Version String - The document version.
- name string
- The name of the document.
- document
Format string - The format of the document. Valid values:
JSON
,TEXT
,YAML
. - document
Version string - The document version.
- name 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 String
- The name of the document.
- document
Format String - The format of the document. Valid values:
JSON
,TEXT
,YAML
. - document
Version 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.
- Document
Type string - The type of the document.
- Id string
- The provider-assigned unique ID for this managed resource.
- Name string
- Document
Format string - Document
Version 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.
- Document
Type string - The type of the document.
- Id string
- The provider-assigned unique ID for this managed resource.
- Name string
- Document
Format string - Document
Version 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.
- document
Type String - The type of the document.
- id String
- The provider-assigned unique ID for this managed resource.
- name String
- document
Format String - document
Version 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.
- document
Type string - The type of the document.
- id string
- The provider-assigned unique ID for this managed resource.
- name string
- document
Format string - document
Version 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.
- document
Type String - The type of the document.
- id String
- The provider-assigned unique ID for this managed resource.
- name String
- document
Format String - document
Version String
Package Details
- Repository
- AWS Classic pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
aws
Terraform Provider.