Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

resource/aws_ssm_document: Add support for Session document_type #5850

Merged
merged 1 commit into from
Sep 12, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions aws/resource_aws_ssm_document.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ func resourceAwsSsmDocument() *schema.Resource {
ssm.DocumentTypeCommand,
ssm.DocumentTypePolicy,
ssm.DocumentTypeAutomation,
ssm.DocumentTypeSession,
}, false),
},
"schema_version": {
Expand Down
42 changes: 42 additions & 0 deletions aws/resource_aws_ssm_document_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,25 @@ func TestAccAWSSSMDocument_automation(t *testing.T) {
})
}

func TestAccAWSSSMDocument_session(t *testing.T) {
name := acctest.RandString(10)
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckAWSSSMDocumentDestroy,
Steps: []resource.TestStep{
{
Config: testAccAWSSSMDocumentTypeSessionConfig(name),
Check: resource.ComposeTestCheckFunc(
testAccCheckAWSSSMDocumentExists("aws_ssm_document.foo"),
resource.TestCheckResourceAttr(
"aws_ssm_document.foo", "document_type", "Session"),
),
},
},
})
}

func TestAccAWSSSMDocument_DocumentFormat_YAML(t *testing.T) {
name := acctest.RandString(10)
content1 := `
Expand Down Expand Up @@ -639,6 +658,29 @@ DOC
`, rName, rName, rName)
}

func testAccAWSSSMDocumentTypeSessionConfig(rName string) string {
return fmt.Sprintf(`
resource "aws_ssm_document" "foo" {
name = "test_document-%s"
document_type = "Session"
content = <<DOC
{
"schemaVersion": "1.0",
"description": "Document to hold regional settings for Session Manager",
"sessionType": "Standard_Stream",
"inputs": {
"s3BucketName": "test",
"s3KeyPrefix": "test",
"s3EncryptionEnabled": true,
"cloudWatchLogGroupName": "/logs/sessions",
"cloudWatchEncryptionEnabled": false
}
}
DOC
}
`, rName)
}

func testAccAWSSSMDocumentConfig_DocumentFormat_YAML(rName, content string) string {
return fmt.Sprintf(`
resource "aws_ssm_document" "foo" {
Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/ssm_document.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ The following arguments are supported:
* `name` - (Required) The name of the document.
* `content` - (Required) The JSON or YAML content of the document.
* `document_format` - (Optional, defaults to JSON) The format of the document. Valid document types include: `JSON` and `YAML`
* `document_type` - (Required) The type of the document. Valid document types include: `Command`, `Policy` and `Automation`
* `document_type` - (Required) The type of the document. Valid document types include: `Command`, `Policy`, `Automation` and `Session`
* `permissions` - (Optional) Additional Permissions to attach to the document. See [Permissions](#permissions) below for details.
* `tags` - (Optional) A mapping of tags to assign to the object.

Expand Down