@@ -21,12 +21,12 @@ Metadata:
2121 - Label :
2222 default : " FSxN Configuration"
2323 Parameters :
24- - SecretName
25- - AWSRegion
24+ - SecretArn
2625 - ManagementEndpointIP
2726 - VolumeName
2827 - VolumeSize
2928 - SvmName
29+ - Username
3030 - DriveLetter
3131 - Label :
3232 default : " Networking"
@@ -50,10 +50,8 @@ Metadata:
5050 default : " VPC ID"
5151 SubnetId :
5252 default : " Subnet ID"
53- SecretName :
54- default : " AWS Secret Name"
55- AWSRegion :
56- default : " AWS Region"
53+ SecretArn :
54+ default : " AWS Secret ARN"
5755 ManagementEndpointIP :
5856 default : " Management Endpoint IP"
5957 VolumeName :
@@ -62,6 +60,8 @@ Metadata:
6260 default : " Volume Size (GiB)"
6361 SvmName :
6462 default : " SVM Name"
63+ Username :
64+ default : " Username"
6565 DriveLetter :
6666 default : " Drive Letter (Windows Only)"
6767 CidrIp :
@@ -97,12 +97,9 @@ Parameters:
9797 SubnetId :
9898 Type : AWS::EC2::Subnet::Id
9999 Description : Subnet ID
100- SecretName :
100+ SecretArn :
101101 Type : String
102- Description : Aws Secret name
103- AWSRegion :
104- Type : String
105- Description : AWS Secret region(in which you have yours secret)
102+ Description : Full ARN of the AWS Secrets Manager secret containing FSxN credentials
106103 ManagementEndpointIP :
107104 Type : String
108105 Description : Management endpoint IP Address of your FSxN
@@ -116,6 +113,9 @@ Parameters:
116113 Type : String
117114 Default : fsx
118115 Description : SVM Name
116+ Username :
117+ Type : String
118+ Description : Username to run under
119119 DriveLetter :
120120 Type : String
121121 Default : d
@@ -182,7 +182,7 @@ Resources:
182182 Action :
183183 - " secretsManager:GetSecretValue"
184184 Resource :
185- - !Sub " arn:aws:secretsmanager:${AWSRegion}:${AWS::AccountId}:secret:${SecretName}* "
185+ - !Ref SecretArn
186186
187187 EC2InstanceProfile :
188188 Type : AWS::IAM::InstanceProfile
@@ -209,12 +209,12 @@ Resources:
209209 curl -o /tmp/userdata-script.sh ${LinuxUserDataUrl}
210210 chmod +x /tmp/userdata-script.sh
211211 # Pass parameters to the script
212- /tmp/userdata-script.sh "${SecretName }" "${AWSRegion }" "${ManagementEndpointIP }" "${VolumeName }" "${VolumeSize }" "${SvmName }"
212+ /tmp/userdata-script.sh "${SecretArn }" "${ManagementEndpointIP }" "${VolumeName }" "${VolumeSize }" "${SvmName }" "${Username }"
213213 - Fn::Base64 : !Sub |
214214 <powershell>
215215 Invoke-WebRequest -Uri ${WindowsUserDataUrl} -OutFile C:\userdata-script.ps1
216216 (Get-Content 'C:\userdata-script.ps1') | Where-Object { $_ -notmatch '^<powershell>$|^</powershell>$' } | Set-Content 'C:\userdata-script.ps1'
217- powershell.exe -ExecutionPolicy Bypass -File C:\userdata-script.ps1 -SecretIdParam "${SecretName }" -FSxNAdminIpParam "${ManagementEndpointIP }" -VolumeNameParam "${VolumeName}" -VolumeSizeParam "${VolumeSize}" -DriveLetterParam "${DriveLetter}" -SvmNameParam "${SvmName}"
217+ powershell.exe -ExecutionPolicy Bypass -File C:\userdata-script.ps1 -SecretIdParam "${SecretArn }" -FSxNAdminIpParam "${ManagementEndpointIP }" -VolumeNameParam "${VolumeName}" -VolumeSizeParam "${VolumeSize}" -DriveLetterParam "${DriveLetter}" -SvmNameParam "${SvmName}" -UsernameParam "${Username }"
218218 </powershell>
219219Outputs :
220220 InstanceId :
0 commit comments