-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Fix root volume lookup. #4489
Fix root volume lookup. #4489
Conversation
This fix looks correct however I'm in the process of adding an acceptance test to cover the behavior. We currently check mismatch behavior of the following AMI layout (us-west-2 ami-ef5b69df), which happens to pass because the first element of "BlockDeviceMappings": [
{
"DeviceName": "/dev/sda",
"Ebs": {
"Encrypted": false,
"DeleteOnTermination": true,
"SnapshotId": "snap-d7cfe852",
"VolumeSize": 3,
"VolumeType": "standard"
}
},
{
"DeviceName": "/dev/sdb",
"VirtualName": "ephemeral0"
}
], The AMI noted in #4469 (us-gov-west-1 ami-e0aa3f81) uses the following "BlockDeviceMappings": [
{
"DeviceName": "/dev/xvdb",
"VirtualName": "ephemeral0"
},
{
"DeviceName": "/dev/xvda",
"Ebs": {
"Encrypted": false,
"DeleteOnTermination": true,
"SnapshotId": "snap-03ae98fbcef8877e4",
"VolumeSize": 8,
"VolumeType": "gp2"
}
}
], I'm trying to find comparable AMI lookups between the two separate partitions, which is proving a little difficult as the |
I'm taking a look at unit tests for this fix, which might be easier than acceptance tests, especially if we want tests to run on multiple regions. |
Fun fact: the
|
76ddec4
to
72bc237
Compare
72bc237
to
53fb1ce
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM -- thank you very much for adding the unit test. Confirmed it previously fails the new unit test and passes both existing acceptance testing and the new unit test with the code update.
Something I also noticed here that I figure is worth mentioning that the code will incorrectly point to the first element in the following scenario, but this is unrelated to this fix:
{
"mismatched root device with ephemeral device",
[]*ec2.Image{{
RootDeviceType: aws.String("ebs"),
RootDeviceName: aws.String("/dev/sda1"),
BlockDeviceMappings: []*ec2.BlockDeviceMapping{
{
DeviceName: aws.String("/dev/sdb")},
VirtualName: aws.String("ephemeral0"),
},
{
DeviceName: aws.String("/dev/sda")},
Ebs: &ec2.EbsBlockDevice{},
},
}},
"/dev/sda",
},
This has been released in version 1.18.0 of the AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks! |
The
rootDeviceNameInMapping
check compares string pointers, which will never be the same. This patch compares string values instead.[Fixes #4469]