mirror of
https://github.com/idanoo/fediservices.nz-infra
synced 2025-07-01 22:02:15 +00:00
Add EBS attachment
This commit is contained in:
parent
a689038306
commit
ab30a47e26
2 changed files with 4 additions and 0 deletions
|
@ -3,6 +3,7 @@ data "template_file" "userdata" {
|
|||
template = file("${path.module}/templates/userdata.tpl")
|
||||
|
||||
vars = {
|
||||
region = data.aws_region.current.name
|
||||
data_root = "/data"
|
||||
volume = aws_ebs_volume.ebs.id
|
||||
}
|
||||
|
|
|
@ -25,6 +25,9 @@ ACC_ID=$(echo $METADATA | jq -r .accountId)
|
|||
device="xvdf"
|
||||
volume="${volume}"
|
||||
|
||||
while [[ $(aws ec2 detach-volume --volume-id=$volume --region=${region}) == *"detaching"* ]]; do sleep 1; done;
|
||||
while [[ $(aws ec2 attach-volume --volume-id=$volume --instance-id=$(cat /etc/amazon-ec2/instance-id) --device=$device --region=${region}) == *"attaching"* ]]; do sleep 1; done;
|
||||
|
||||
# Detect if volume is attached
|
||||
while [[ ! $(/bin/lsblk) == *$device* ]]; do
|
||||
# Detect if we are on a Nitro based VM and then lookup nvme device
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue