Skip to content

Commit 7c1ecc9

Browse files
committed
Set RootVolumeName appropriately
This replaces the hardcoded /dev/xvda value with appropriate default values for amazon linux 2 and windows instances and also allows for overriding the value. Signed-off-by: Jeremiah Snapp <[email protected]>
1 parent d2b16af commit 7c1ecc9

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

templates/aws-stack.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ Parameters:
244244
RootVolumeName:
245245
Description: Name of the root block device for your AMI
246246
Type: String
247-
Default: "/dev/xvda"
247+
Default: ""
248248

249249
RootVolumeType:
250250
Description: Type of root volume to use
@@ -406,6 +406,9 @@ Conditions:
406406
UseDefaultAMI:
407407
!Equals [ !Ref ImageId, "" ]
408408

409+
UseDefaultRootVolumeName:
410+
!Equals [ !Ref RootVolumeName, "" ]
411+
409412
UseManagedPolicyARN:
410413
!Not [ !Equals [ !Join [ "", !Ref ManagedPolicyARN ], "" ] ]
411414

@@ -714,7 +717,7 @@ Resources:
714717
- !Ref "AWS::NoValue"
715718
ImageId: !If [ UseDefaultAMI, !FindInMap [ AWSRegion2AMI, !Ref 'AWS::Region', !Ref InstanceOperatingSystem ], !Ref ImageId ]
716719
BlockDeviceMappings:
717-
- DeviceName: /dev/xvda
720+
- DeviceName: !If [ UseDefaultRootVolumeName, !If [ UseWindowsAgents, /dev/sda1, /dev/xvda ], !Ref RootVolumeName ]
718721
Ebs: { VolumeSize: !Ref RootVolumeSize, VolumeType: !Ref RootVolumeType }
719722
TagSpecifications:
720723
- ResourceType: instance

0 commit comments

Comments
 (0)