Skip to content

Commit 01bfcd6

Browse files
committed
Made minor cosmetic changes.
1 parent 7735c6d commit 01bfcd6

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

Management-Utilities/fsxn-rotate-secret/README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ The Secrets Manager should invoke the function four times, each time with the `s
77

88
| Stage | Description |
99
|------------|-------------|
10-
|createSecret|The function will create a new version of the secret with a "Version Staging ID" of "AWSPENDING". At this point the original secret is still be left as is, and will be the default secret returned if no versionStagingID is provided.|
10+
|createSecret|The function will create a new version of the secret with a "Version Staging ID" of "AWSPENDING". At this point the original secret is still be left as is and will be the default secret returned if no Version Staging ID is provided.|
1111
|setSecret |The function will update the password for the FSxN file system using the new version of the secret.|
1212
|testSecret |Currently no testing is performed. The Lambda function would have to be attached to the same VPC as the FSxN file system to test the password. Since that would potentially make it where you'd have to have a separate function for each FSxN deployment, and potentially have to setup AWS Endpoints for AWS services, a decision was made to not do that. If the Lambda function fails to set the password correctly, you can always use the AWS console, or API, to set it to whatever you need.|
1313
|finishSecret|The function will promote the new password to the "AWSCURRENT" Version Staging ID. This will set the Version Staging ID of the old password to "AWSPREVIOUS".|
@@ -27,10 +27,10 @@ relationship with the AWS Lambda service.
2727
| secretsManager:UpdateSecretVersionStage | \<secretARN> | \<secretARN> is the AWS ARN of the secret to rotate. |
2828
| secretsManager:DescribeSecret | \<secretARN> | \<secretARN> is the AWS ARN of the secret to rotate. |
2929
| secretsmanager:GetRandomPassword | \* | The scope doesn't matter, since this function doesn't have anything to do with any AWS resources. |
30-
| fsx:UpdateFileSystem | \<fileSystemARN> | \<fileSytemARN> is the AWS ARN of the FSxN file system to manage. |
31-
| logs:CreateLogGroup | arn:aws:logs:\<region>:\<accountID>:\* | This allows the Lambda function to create a log group in CloudWatch. This is optional, but allows you to get diagnostic information from the Lambda function. |
32-
| logs:CreateLogStream | arn:aws:logs:\<region>:\<accountID>:log-group:/aws/lambda/\<Lambda_function_name>:\* | This allows the Lambda function to create a log streams in CloudWatch. This is optional, but allows you to get diagnostic information from the function.|
33-
| logs:PutLogEvents | arn:aws:logs:\<region>:\<accountID>:log-group:/aws/lambda/\<Lambda_function_name>:\* | This allows the Lambda function to write log events to a log stream in CloudWatch. This is optional, but allows you to get diagnostic information from the function.|
30+
| fsx:UpdateFileSystem | \<fileSystemARN> | \<fileSystemARN> is the AWS ARN of the FSxN file system to manage. |
31+
| logs:CreateLogGroup | arn:aws:logs:\<region>:\<accountID>:\* | This allows the Lambda function to create a log group in CloudWatch. This is optional but allows you to get diagnostic information from the Lambda function. |
32+
| logs:CreateLogStream | arn:aws:logs:\<region>:\<accountID>:log-group:/aws/lambda/\<Lambda_function_name>:\* | This allows the Lambda function to create a log stream in CloudWatch. This is optional but allows you to get diagnostic information from the function.|
33+
| logs:PutLogEvents | arn:aws:logs:\<region>:\<accountID>:log-group:/aws/lambda/\<Lambda_function_name>:\* | This allows the Lambda function to write log events to a log stream in CloudWatch. This is optional but allows you to get diagnostic information from the function.|
3434

3535
#### Step 2 - Create the Lambda Function
3636
##### Step 2.1
@@ -43,7 +43,7 @@ Create a Lambda function with the following parameters:
4343
After you create the function, you will be able to insert the code included with this
4444
sample into the code box and click "Deployed" to save it.
4545

46-
##### Step 2.3 - Change permisisons
46+
##### Step 2.3 - Change permissisons
4747
Change to the `Configuration` tab and select `Permissions` and add a `Resource-based policy` statement that will allow the
4848
secretsmanager AWS service to invoke the Lambda function. Do that do the following:
4949

@@ -62,9 +62,9 @@ want. The default is 30 days.
6262
### Terraform Method
6363
The Terraform module provided in the `terraform` directory can be used to create the Secrets Manager
6464
secret setup to use a rotation policy that uses the Lambda function. It will create the following resources:
65-
- Lambda function used to rotate the secret.
66-
- IAM role that allows the Lambda function to rotate the secret.
67-
- A Secrets Manager secret with a rotation schedule of 30 days.
65+
- A Lambda function used to rotate the secret.
66+
- An IAM role that allows the Lambda function to rotate the secret.
67+
- A Secrets Manager secret with a rotation enabled.
6868

6969
#### Prerequisites
7070

Management-Utilities/fsxn-rotate-secret/terraform/main.tf

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ locals {
7474
# Create the IAM role for the Lambda function.
7575
resource "aws_iam_role" "iam_for_lambda" {
7676
name = "iam_for_lambda-${random_id.id.hex}"
77-
decription = "IAM role for the Rotate FSxN Secret Lambda function."
77+
description = "IAM role for the Rotate FSxN Secret Lambda function."
7878
assume_role_policy = data.aws_iam_policy_document.assume_role.json
7979
inline_policy {
8080
name = "required_policy"
@@ -92,6 +92,7 @@ data "archive_file" "lambda" {
9292
# Create the Lambda function.
9393
resource "aws_lambda_function" "rotateLambdaFunction" {
9494
function_name = local.lambdaName
95+
description = "Lambda function to rotate the FSxN secret."
9596
role = aws_iam_role.iam_for_lambda.arn
9697
runtime = "python3.12"
9798
handler = "fsxn_rotate_secret.lambda_handler"
@@ -110,7 +111,8 @@ resource "aws_lambda_permission" "allowSecretsManager" {
110111
#
111112
# Create the secret with the required tags.
112113
resource "aws_secretsmanager_secret" "secret" {
113-
name = "${var.secretNamePrefix}-${random_id.id.hex}"
114+
name = "${var.secretNamePrefix}-${random_id.id.hex}"
115+
description = "Secret for the FSxN file system (${var.fsxId})."
114116

115117
tags = {
116118
fsxId = var.fsxId

0 commit comments

Comments
 (0)