-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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
aws_ami: Add root_snapshot_id attribute #1572
Conversation
Current limitations in HCL prevent it from being possible to reference an AMI's root snapshot ID via its ID. This is because the snapshot ID is deeply nested in the `block_device_mappings` set. HCL is not yet flexible enough to allow a lookup expression to extract the snapshot ID embedded within that structure. This makes it impossible to use resources like `aws_snapshot_create_volume_permission` without manually doing the AMI ID -> Snapshot ID translation outside of Terraform. Here, we promote the Snapshot ID of the root volume to a top-level `root_snapshot_id` attribute for AMI data sources and resources. This field will be blank for instance store AMIs or for weird conditions where there's no snapshot ID recorded (See commit message here: bed5f62), but it enables usage of the resource referenced above for the majority of scenarios.
/cc @apparentlymart as we discussed this a bit |
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.
Besides 2 nitpicks this LGTM.
size = 8 | ||
tags { | ||
Name = "testAccAmiConfig_basic" | ||
} |
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.
Nitpick - I think the convention is 2 spaces per indentation.
size = 20 | ||
tags { | ||
Name = "testAccAmiConfig_snapshotSize" | ||
} |
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.
^
I'm not sure why did I point out the correct indentation as incorrect 🤔 Thanks for the PR. 👍 |
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! |
Current limitations in HCL prevent it from being possible to reference
an AMI's root snapshot ID via its ID. This is because the snapshot ID is
deeply nested in the
block_device_mappings
set. HCL is notyet flexible enough to allow a lookup expression to extract the snapshot
ID embedded within that structure.
This makes it impossible to use resources like
aws_snapshot_create_volume_permission
without manually doing the AMIID -> Snapshot ID translation outside of Terraform.
Here, we promote the Snapshot ID of the root volume to a top-level
root_snapshot_id
attribute for AMI data sources and resources.This field will be blank for instance store AMIs or for weird conditions
where there's no snapshot ID recorded (See commit message here:
bed5f62), but it enables usage of the
resource referenced above for the majority of scenarios.