Skip to content

Commit e34b537

Browse files
committed
Initial commit
0 parents  commit e34b537

4 files changed

Lines changed: 68 additions & 0 deletions

File tree

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.terraform*
2+
terraform.tfstate*

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# terraform-aws-session-manager-settings
2+
3+
Session preferences let you specify a location to store log output for all sessions in your account. You can also enable server-side encryption using an AWS Key Management Service (KMS) key for a specified stream to ensure your session records are transferred securely.
4+
5+
Requires `aws` provider >= 1.36.0
6+
7+
## Argument Reference
8+
9+
The following arguments are supported:
10+
11+
* `s3_bucket_name` - (Optional) The name of bucket to store session logs. Specifying this enables writing session output to an Amazon S3 bucket.
12+
* `s3_key_prefix` - (Optional) To write output to a sub-folder, enter a sub-folder name.
13+
* `s3_encryption_enabled` - (Optional) Encrypt log data.
14+
* `cloudwatch_log_group_name` - (Optional) The name of the log group to upload session logs to. Specifying this enables sending session output to CloudWatch Logs.
15+
* `cloudwatch_encryption_enabled` - (Optional) Encrypt log data.
16+
17+
## Attributes Reference
18+
19+
No extra attributes are exported.

main.tf

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
terraform {
2+
required_version = ">= 0.11"
3+
4+
required_providers {
5+
aws = ">= 1.36.0"
6+
}
7+
}
8+
9+
resource "aws_ssm_document" "session_manager_prefs" {
10+
name = "SSM-SessionManagerRunShell"
11+
document_type = "Session"
12+
document_format = "JSON"
13+
14+
content = <<DOC
15+
{
16+
"schemaVersion": "1.0",
17+
"description": "Document to hold regional settings for Session Manager",
18+
"sessionType": "Standard_Stream",
19+
"inputs": {
20+
"s3BucketName": "${var.s3_bucket_name}",
21+
"s3KeyPrefix": "${var.s3_key_prefix}",
22+
"s3EncryptionEnabled": ${var.s3_encryption_enabled ? "true" : "false"},
23+
"cloudWatchLogGroupName": "${var.cloudwatch_log_group_name}",
24+
"cloudWatchEncryptionEnabled": ${var.cloudwatch_encryption_enabled ? "true" : "false"}
25+
}
26+
}
27+
DOC
28+
}

variables.tf

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
variable "s3_bucket_name" {
2+
default = ""
3+
}
4+
5+
variable "s3_key_prefix" {
6+
default = ""
7+
}
8+
9+
variable "s3_encryption_enabled" {
10+
default = true
11+
}
12+
13+
variable "cloudwatch_log_group_name" {
14+
default = ""
15+
}
16+
17+
variable "cloudwatch_encryption_enabled" {
18+
default = true
19+
}

0 commit comments

Comments
 (0)